From efb3f95b0f9429b3c4ae4a4ad6d3206b9398ccf8 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Wed, 7 Jan 2026 16:55:54 +0000 Subject: [PATCH 1/2] ci: add path filters to skip tests for irrelevant changes --- .github/workflows/e2e-and-js-tests.yml | 33 ++++++++++++++++++++++---- .github/workflows/integration.yml | 21 ++++++++++++---- .github/workflows/php-lint.yml | 19 +++++++++++---- 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/.github/workflows/e2e-and-js-tests.yml b/.github/workflows/e2e-and-js-tests.yml index ba3a1f17..44e0b657 100644 --- a/.github/workflows/e2e-and-js-tests.yml +++ b/.github/workflows/e2e-and-js-tests.yml @@ -1,11 +1,36 @@ name: E2E and JS tests on: - pull_request: push: - branches-ignore: - - develop - - main + paths: + - '**.js' + - '**.jsx' + - '**.ts' + - '**.tsx' + - '**.scss' + - '**.css' + - 'package.json' + - 'package-lock.json' + - 'webpack.config.js' + - '.wp-env.json' + - 'tests/e2e/**' + - '.github/workflows/e2e-and-js-tests.yml' + pull_request: + branches: [develop, main] + paths: + - '**.js' + - '**.jsx' + - '**.ts' + - '**.tsx' + - '**.scss' + - '**.css' + - 'package.json' + - 'package-lock.json' + - 'webpack.config.js' + - '.wp-env.json' + - 'tests/e2e/**' + - '.github/workflows/e2e-and-js-tests.yml' + workflow_dispatch: # Disable all permissions by default; grant minimal permissions per job permissions: {} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 57480671..67a804a7 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,11 +1,24 @@ name: Integration Tests on: - pull_request: push: - branches-ignore: - - develop - - main + paths: + - '**.php' + - 'composer.json' + - 'composer.lock' + - 'phpunit.xml.dist' + - '.wp-env.json' + - '.github/workflows/integration.yml' + pull_request: + branches: [develop, main] + paths: + - '**.php' + - 'composer.json' + - 'composer.lock' + - 'phpunit.xml.dist' + - '.wp-env.json' + - '.github/workflows/integration.yml' + workflow_dispatch: # Disable all permissions by default; grant minimal permissions per job permissions: {} diff --git a/.github/workflows/php-lint.yml b/.github/workflows/php-lint.yml index c609c23b..ac1ded3e 100644 --- a/.github/workflows/php-lint.yml +++ b/.github/workflows/php-lint.yml @@ -1,11 +1,22 @@ name: PHP Lint on: - pull_request: push: - branches-ignore: - - develop - - main + paths: + - '**.php' + - 'composer.json' + - 'composer.lock' + - '.phpcs.xml.dist' + - '.github/workflows/php-lint.yml' + pull_request: + branches: [develop, main] + paths: + - '**.php' + - 'composer.json' + - 'composer.lock' + - '.phpcs.xml.dist' + - '.github/workflows/php-lint.yml' + workflow_dispatch: # Disable all permissions by default; grant minimal permissions per job permissions: {} From 5aa5ac51bdb362cb477e92de240a957ad48f0403 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Wed, 7 Jan 2026 17:25:43 +0000 Subject: [PATCH 2/2] ci: split JS tests and E2E tests into separate workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jest unit tests don't need wp-env, so separating them provides faster feedback for pure JS changes. E2E tests still require the full WordPress environment with Playwright. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../{e2e-and-js-tests.yml => e2e-tests.yml} | 17 +++--- .github/workflows/js-tests.yml | 60 +++++++++++++++++++ 2 files changed, 67 insertions(+), 10 deletions(-) rename .github/workflows/{e2e-and-js-tests.yml => e2e-tests.yml} (92%) create mode 100644 .github/workflows/js-tests.yml diff --git a/.github/workflows/e2e-and-js-tests.yml b/.github/workflows/e2e-tests.yml similarity index 92% rename from .github/workflows/e2e-and-js-tests.yml rename to .github/workflows/e2e-tests.yml index 44e0b657..ca78870c 100644 --- a/.github/workflows/e2e-and-js-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,4 +1,4 @@ -name: E2E and JS tests +name: E2E Tests on: push: @@ -14,7 +14,7 @@ on: - 'webpack.config.js' - '.wp-env.json' - 'tests/e2e/**' - - '.github/workflows/e2e-and-js-tests.yml' + - '.github/workflows/e2e-tests.yml' pull_request: branches: [develop, main] paths: @@ -29,7 +29,7 @@ on: - 'webpack.config.js' - '.wp-env.json' - 'tests/e2e/**' - - '.github/workflows/e2e-and-js-tests.yml' + - '.github/workflows/e2e-tests.yml' workflow_dispatch: # Disable all permissions by default; grant minimal permissions per job @@ -41,7 +41,7 @@ concurrency: jobs: build: - name: Build and Lint + name: Build runs-on: ubuntu-latest permissions: contents: read @@ -85,9 +85,6 @@ jobs: echo "| custom-status-block.js | $(du -h build/custom-status-block.js | cut -f1) |" >> $GITHUB_STEP_SUMMARY echo "| calendar-react.js | $(du -h build/calendar-react.js | cut -f1) |" >> $GITHUB_STEP_SUMMARY - - name: Run Lint JS - run: npm run lint-js - - name: Upload build artifacts uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: @@ -96,7 +93,7 @@ jobs: retention-days: 1 test: - name: E2E and Jest tests + name: E2E Tests # Pin to ubuntu-22.04 for Playwright compatibility # ubuntu-latest (24.04) has library version mismatches with Playwright's WebKit dependencies runs-on: ubuntu-22.04 @@ -131,5 +128,5 @@ jobs: - name: Install WordPress with wp-env run: npm run wp-env start - - name: Run tests - run: npm run test + - name: Run E2E tests + run: npm run test-e2e diff --git a/.github/workflows/js-tests.yml b/.github/workflows/js-tests.yml new file mode 100644 index 00000000..f185470f --- /dev/null +++ b/.github/workflows/js-tests.yml @@ -0,0 +1,60 @@ +name: JS Tests + +on: + push: + paths: + - '**.js' + - '**.jsx' + - '**.ts' + - '**.tsx' + - 'package.json' + - 'package-lock.json' + - 'jest.config.js' + - '.github/workflows/js-tests.yml' + pull_request: + branches: [develop, main] + paths: + - '**.js' + - '**.jsx' + - '**.ts' + - '**.tsx' + - 'package.json' + - 'package-lock.json' + - 'jest.config.js' + - '.github/workflows/js-tests.yml' + workflow_dispatch: + +# Disable all permissions by default; grant minimal permissions per job +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint-and-test: + name: Lint and Jest Tests + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + persist-credentials: false + + - name: Set up NodeJS 20 + uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 + with: + node-version: '20' + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Run Lint JS + run: npm run lint-js + + - name: Run Jest tests + run: npm run test-jest