From 80888641e5a7a6f311f296531af227b9d6c9c845 Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Sun, 9 Aug 2026 11:24:10 -0400 Subject: [PATCH] ci: local TIA test runs; simplify e2e (drop sharding + e2e-gate) (#262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: name e2e shards descriptively and add time-balanced sharding - e2e job now shows as "e2e (shard 1/2)" / "e2e (shard 2/2)" in checks instead of the unlabeled matrix "(1)" / "(2)" suffix - add scheduled/manual "Update Shards" workflow that generates and commits tests/.pest/shards.json so Pest balances the two e2e shards by real execution time instead of file count * ci: enable Pest TIA for local test runs Scoped to local via locally() so CI keeps running the full suite on every commit. Add composer test:tia script using herd coverage, since Herd bundles Xdebug but doesn't load it by default. * ci: drop Herd-specific prefix from test:tia composer script trypost is open-source and self-hosted; not every contributor runs Herd. The script now just needs a coverage driver (Xdebug/PCOV) active however the environment provides it — Herd users can run it via "herd coverage composer test:tia". * ci: revert e2e sharding, drop Update Shards workflow Sharding across 2 runners added complexity (unbalanced shards without timing data, plus an Update Shards workflow that can't push straight to main under branch protection) that isn't worth it here. e2e now runs tests/Browser as a single job again; e2e-gate stays as a pass-through so the required branch protection check name is unchanged. * ci: drop redundant e2e-gate job e2e-gate only mirrored e2e's own result once sharding was removed. Updated main's branch protection required_status_checks to require "e2e" directly instead of "e2e-gate". --- .github/workflows/tests.yml | 17 ++--------------- composer.json | 3 +++ tests/Pest.php | 13 +++++++++++++ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 497efe6d..ab2e1962 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -64,11 +64,6 @@ jobs: e2e: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - shard: [1, 2] - services: postgres: image: postgres:16 @@ -115,21 +110,13 @@ jobs: env: DB_PORT: ${{ job.services.postgres.ports['5432'] }} REDIS_PORT: ${{ job.services.redis.ports['6379'] }} - run: php artisan test tests/Browser --compact --shard=${{ matrix.shard }}/2 + run: php artisan test tests/Browser --compact - name: Upload Playwright artifacts if: failure() uses: actions/upload-artifact@v7 with: - name: playwright-artifacts-${{ matrix.shard }} + name: playwright-artifacts path: tests/Browser/Screenshots if-no-files-found: ignore retention-days: 7 - - e2e-gate: - if: always() - needs: e2e - runs-on: ubuntu-latest - steps: - - name: Require all e2e shards to pass - run: '[ "${{ needs.e2e.result }}" = "success" ] || exit 1' diff --git a/composer.json b/composer.json index 6904ab78..8690d44b 100644 --- a/composer.json +++ b/composer.json @@ -125,6 +125,9 @@ "@test", "@php artisan test tests/Browser" ], + "test:tia": [ + "vendor/bin/pest --parallel --tia" + ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" diff --git a/tests/Pest.php b/tests/Pest.php index 8c954741..ecebbc50 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -33,6 +33,19 @@ ->use(RefreshDatabase::class) ->in('Browser'); +/* +|-------------------------------------------------------------------------- +| Test Impact Analysis +|-------------------------------------------------------------------------- +| +| Only re-run tests affected by local changes, replaying cached results for +| the rest. Scoped to local runs via "locally()" — automatically skipped on +| CI (or when the "--ci" flag is passed), which always runs the full suite. +| +*/ + +pest()->tia()->locally(); + /* |-------------------------------------------------------------------------- | Expectations