Repository navigation
chore(ci): build the E2E dev image with the GitHub Actions cache - #122
Merged
Merged
Conversation
Every workflow that runs on pull requests gets a concurrency group keyed on the PR number, with cancel-in-progress. Other events (push, tag, schedule, manual) key on the run id, so they never cancel or queue behind each other. Refs #115
The merged commit already passed both suites on its pull request. A push to main now runs only the fast gates (PHPStan, ts-check, API contract, plugin build). PHPUnit and the Playwright E2E suite run on pull requests, every night on main, and on demand. Refs #115
Fixture::reset() runs before every test and re-seeded the admin row with a fresh password_hash(). bcrypt costs 12 by default since PHP 8.4, about 0.22 s a hash, so ~1,770 resets spent most of the PHPUnit run hashing the same password. The hash is now computed once per process. BansTest (80 tests) locally: 24 s -> 8 s, same assertions. Refs #115
Fixture::reset() truncates and re-seeds every table before each test, so the job was bound by fsync. MariaDB now starts from a step (a service container cannot pass server options) with its datadir on tmpfs, innodb_flush_log_at_trx_commit=0, no doublewrite buffer and no binlog. It boots while PHP and Composer install, listens on a free loopback port, has a per-run name, and is removed when the job ends, so a self-hosted runner keeps no leftover container. BansTest (80 tests) locally: 43-49 s on disk -> 8-9 s on tmpfs. Refs #115
The suite ran on one worker because every spec shares the sourcebans_e2e database. Each shard now brings up its own dev stack and database and runs --shard=N/3, so workers: 1 no longer sets the total time. From the per-test durations of the PR #114 run (428 s of tests), the three contiguous slices carry 158 / 132 / 138 s. fail-fast is off, so a red run still lists every failing spec, and on failure a report job merges the shards' blob reports into the usual playwright-report artifact. Refs #115
Hashing once per process still cost 0.22 s in every #[RunInSeparateProcess] child (165 tests) and on every E2E reset, which runs in a fresh process. The fixture now seeds a precomputed cost-12 bcrypt hash of 'admin': same password, cost and format, and password_needs_rehash() stays false. Refs #115
TRUNCATE is DDL that recreates each tablespace: 27 of them took 65-125 ms per reset on MariaDB 10.11 with a tmpfs datadir, and the reset runs before every test. The fixture now DELETEs every table and runs ALTER TABLE ... AUTO_INCREMENT = 1 only where information_schema shows the counter moved (MySQL 8's cached value is switched off for the session). Same end state, ~12 ms per reset. The E2E reset shim shares this code. Full suite locally (tmpfs DB): 235 s -> 176 s, same 1,770 tests. Refs #115
Every E2E shard built the dev web image from scratch inside docker compose up (62 s of the 93 s bring-up on the PR #114 run). The image is now built by buildx with the gha cache under the tag docker-compose.yml uses, so compose finds it and skips its build. Only shard 1 writes the cache; the nightly run on main fills the scope that pull requests read. Refs #115
This was referenced Nov 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docker compose up -d --waitbuilds the dev web image (docker/Dockerfile: apt packages,docker-php-ext-install) in every E2E run. On the PR #114 run that took 62 s of the 93 sBring up the dev stackstep, and with three shards (#120) it is paid three times (#115).Change
docker/setup-buildx-action@v4+docker/build-push-action@v7builddocker/Dockerfilewithcache-from: type=gha,scope=e2e-dev-web,load: true, taggedsbpp-dev-web:latest(theimage:name indocker-compose.yml).compose upthen finds the image and skips its own build; the stack itself does not change.mode=max), so the shards do not race on it.mainno longer runs E2E, so the nightly run onmainfills the cache scope that pull requests read (a PR first falls back to its own scope, then tomain's).docker-image.yml.Checked
actionlint: no finding.Build the dev web image13-14 s (34 s on shard 1, which writes the cache), thenBring up the dev stack12-14 s. Before: 108-128 s for the bring-up alone. E2E jobs 214 / 253 / 300 s, workflow wall 369 s -> 334 s.Version
2.2.31 -> 2.2.32 (stacked on #121)
Merge order
Stack for #115, squash one at a time from the bottom:
chore(ci): cancel the outdated run on a new PR push (2.2.26)chore(ci): PHPUnit + E2E nightly on main instead of on every push (2.2.27)perf(tests): precomputed fixture admin password hash (2.2.28)chore(ci): PHPUnit MariaDB on tmpfs without fsync (2.2.29)chore(ci): Playwright E2E as three parallel shards (2.2.30)perf(tests): fixture reset with DELETE instead of TRUNCATE (2.2.31)chore(ci): E2E dev image built with the gha cache (2.2.32)fix(e2e): password generator spec waits for the settings bounce (2.2.33)