Repository navigation
feat(logging): add a search bar to the All Logs page #772
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This does the following: | |
| # 1. Detects modified plugins that have .wp-env.json configuration | |
| # 2. Runs Playwright E2E tests on those plugins using the custom action | |
| # 3. Creates a matrix job for each plugin that has a quality configuration | |
| # Bonus: This means you can have plugin specific badges e.g. | |
| # [](https://github.com/wpengine/hwptoolkit/actions) | |
| name: End-to-End Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'plugins/*/**.php' | |
| - 'plugins/*/**.js' | |
| - 'plugins/*/**.css' | |
| - 'plugins/*/**.json' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'plugins/*/**.php' | |
| - 'plugins/*/**.js' | |
| - 'plugins/*/**.css' | |
| - 'plugins/*/**.json' | |
| jobs: | |
| detect-plugin: | |
| runs-on: ubuntu-latest | |
| name: Detect plugin with E2E tests | |
| outputs: | |
| plugin: ${{ steps.detect.outputs.plugin }} | |
| has-plugin: ${{ steps.detect.outputs.has-plugin }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # get_plugin_slug.sh diffs against history, so fetch all of it without file contents. | |
| fetch-depth: 0 | |
| # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. | |
| filter: blob:none | |
| sparse-checkout-cone-mode: false | |
| sparse-checkout: | | |
| /* | |
| !**/wp-env/uploads.zip | |
| - name: Get changed plugin directory | |
| id: plugin | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| bash .github/scripts/get_plugin_slug.sh main | |
| else | |
| bash .github/scripts/get_plugin_slug.sh \ | |
| ${{ github.event.pull_request.base.sha }} \ | |
| ${{ github.event.pull_request.head.sha }} | |
| fi | |
| - name: Detect changed plugin with E2E config | |
| id: detect | |
| run: | | |
| if [ -z "${{ steps.plugin.outputs.slug }}" ]; then | |
| echo "No plugin slug detected" | |
| echo "plugin=" >> $GITHUB_OUTPUT | |
| echo "has-plugin=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| PLUGIN="${{ steps.plugin.outputs.slug }}" | |
| # Check for .wp-env.json file in the plugin directory | |
| if [ -f "plugins/$PLUGIN/.wp-env.json" ]; then | |
| echo "plugin=$PLUGIN" >> $GITHUB_OUTPUT | |
| echo "has-plugin=true" >> $GITHUB_OUTPUT | |
| echo "✅ Found .wp-env.json for plugin: $PLUGIN" | |
| else | |
| echo "plugin=" >> $GITHUB_OUTPUT | |
| echo "has-plugin=false" >> $GITHUB_OUTPUT | |
| echo "ℹ️ No .wp-env.json found for plugin: $PLUGIN, skipping E2E tests" | |
| fi | |
| playwright-e2e-tests: | |
| needs: detect-plugin | |
| if: needs.detect-plugin.outputs.has-plugin == 'true' | |
| runs-on: ubuntu-24.04 | |
| name: ${{ needs.detect-plugin.outputs.plugin }} Playwright E2E Tests | |
| env: | |
| PLUGIN: ${{ needs.detect-plugin.outputs.plugin }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # Skip the example sites' uploads.zip files (590 MB), which plugin jobs don't use. | |
| filter: blob:none | |
| sparse-checkout-cone-mode: false | |
| sparse-checkout: | | |
| /* | |
| !**/wp-env/uploads.zip | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 # Min version required by the repo | |
| - name: Install pnpm | |
| run: pnpm install | |
| - name: Setup PHP with Cached Composer | |
| uses: ./.github/actions/setup-php-composer | |
| with: | |
| php-version: 8.2 | |
| working-directory: plugins/${{ env.PLUGIN }} | |
| composer-options: '--no-progress --optimize-autoloader --no-dev' | |
| - name: Install playwright browsers | |
| # Use the locked @playwright/test, and only Chromium since that's all the config runs. | |
| # Skip --with-deps because the runner image has Chromium's libraries and its apt | |
| # step has hung for up to 40 minutes. | |
| run: pnpm exec playwright install chromium | |
| working-directory: plugins/${{ env.PLUGIN }} | |
| - name: Start wp-env | |
| run: | | |
| pnpm wp-env start | |
| working-directory: plugins/${{ env.PLUGIN }} | |
| - name: Run Playwright tests | |
| run: pnpm test:e2e | |
| working-directory: plugins/${{ env.PLUGIN }} |