Skip to content

Commit

Permalink
feat(Logging): Updates logging to allow for tracking processing time
Browse files Browse the repository at this point in the history
- Supports #516
- Updates the logging to also allow for tracking processing time of actions.
- Refactors logging to allow for unit testing.
- Adds unit tests for logging.
- Updates Composer dependencies to the latest versions.
- Changes GitHub Actions unit testing to reduce failures.
- Updates Dev Container to be less noisy and remove false positive errors during startup.
  • Loading branch information
timnolte committed Mar 15, 2024
1 parent a110fd4 commit 57c08c4
Show file tree
Hide file tree
Showing 10 changed files with 673 additions and 495 deletions.
12 changes: 12 additions & 0 deletions .devcontainer/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -eu

# Activate the plugin.
cd "/app"
echo "Activating plugin..."
if ! wp plugin is-active daggerhart-openid-connect-generic 2>/dev/null; then
wp plugin activate daggerhart-openid-connect-generic --quiet
fi

echo "Done!"
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"postCreateCommand": "chmod +x .devcontainer/setup.sh && .devcontainer/setup.sh",

// Use 'postStartCommand' to run commands after the container has started.
"postStartCommand": "cd /app && wp plugin activate daggerhart-openid-connect-generic",
"postStartCommand": "chmod +x .devcontainer/activate.sh && .devcontainer/activate.sh",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "wp_php",
Expand Down
12 changes: 8 additions & 4 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -eux
set -eu

# true is shell command and always return 0
# false always return 1
Expand All @@ -17,17 +17,21 @@ sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

# Install Composer dependencies.
cd "${PLUGIN_DIR}"
COMPOSER_ALLOW_XDEBUG=0 COMPOSER_MEMORY_LIMIT=-1 composer install
echo "Installing Composer dependencies..."
COMPOSER_NO_INTERACTION=1 COMPOSER_ALLOW_XDEBUG=0 COMPOSER_MEMORY_LIMIT=-1 composer install --no-progress --quiet

# Install NPM dependencies.
cd "${PLUGIN_DIR}"
if [ ! -d "node_modules" ]; then
echo "Installing NPM dependencies..."
npm ci
fi

# Setup the WordPress environment.
cd "/app"
echo "Setting up WordPress at $SITE_HOST"
wp core install --url="$SITE_HOST" --title="OpenID Connect Development" --admin_user="admin" --admin_email="[email protected]" --admin_password="password" --skip-email
if ! wp core is-installed 2>/dev/null; then
echo "Setting up WordPress at $SITE_HOST"
wp core install --url="$SITE_HOST" --title="OpenID Connect Development" --admin_user="admin" --admin_email="[email protected]" --admin_password="password" --skip-email --quiet
fi

echo "Done!"
4 changes: 3 additions & 1 deletion .github/workflows/pr-unit-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
workflow_dispatch:
# Triggers the workflow on pull request events
pull_request:
branches:
- develop

env:
ACTION_VERSION: 3
Expand Down Expand Up @@ -36,7 +38,7 @@ jobs:
run: docker compose down

- name: Generate Coverage Report
if: success()
if: success() && ${{ github.event_name == 'pull_request' }}
# https://github.com/marketplace/actions/coverage-report-as-comment-clover
uses: lucassabreu/comment-coverage-clover@main
with:
Expand Down
Loading

0 comments on commit 57c08c4

Please sign in to comment.