From bccac772fd0f64d44ebc68a1ce5878ba4b0df62e Mon Sep 17 00:00:00 2001 From: Wes Rich Date: Thu, 27 Aug 2026 15:46:36 -0400 Subject: [PATCH] Scope the pre-Rspec wait barrier to Rspec's actual dependencies #patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Run Rspec Tests` only needs gems/Ruby, apt packages, yarn/node_modules, compiled assets, the Playwright browser, and the parallel test DBs. The `wait-all: true` immediately before it also blocked on Rubocop, ESLint, Brakeman, Dependency Audit, and Project Stats, even though none of those publish anything Rspec reads — they report their own check results independently later in the job. Measured across two real bgea_volunteer_care CI runs, every Rspec dependency was ready well before the old barrier released, but Brakeman (and once, Rubocop's slim_lint step) was consistently the last background step to finish, and Rspec started within ~2ms of it finishing every time. That's ~11s of pure idle time on a 32vcpu run and ~22s on an 8vcpu run, wasted on every CI run of every app using this workflow. Replaced the barrier with a `wait:` scoped to Rspec's real dependencies (adding `id:`s to Compile Assets, Install Playwright Chromium Browser, and Setup Parallel Databases so they can be referenced). Rubocop/ESLint/ Brakeman/Dependency Audit/Project Stats keep running in the background concurrently with Rspec instead of gating it. To preserve correctness, replaced the later `wait: [save-asset-cache]` with `wait-all: true` so those steps are still joined before the job's final parallel block — otherwise a lint/security failure could go unnoticed and steps.project-stats.outputs.table could be read before it's populated. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/rails-ci.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rails-ci.yml b/.github/workflows/rails-ci.yml index fb40b88..3cf74a9 100644 --- a/.github/workflows/rails-ci.yml +++ b/.github/workflows/rails-ci.yml @@ -234,6 +234,7 @@ jobs: background: true - name: Setup Parallel Databases + id: setup-parallel-databases run: bundle exec rake parallel:create parallel:load_schema background: true @@ -250,6 +251,7 @@ jobs: - wait: [cache-assets] - name: Compile Assets + id: compile-assets if: ${{ steps.cache-assets.outputs.cache-hit != 'true' }} run: bundle exec rails assets:precompile background: true @@ -257,11 +259,21 @@ jobs: - wait: [cache-playwright] - name: Install Playwright Chromium Browser + id: install-playwright if: ${{ inputs.playwright && steps.cache-playwright.outputs.cache-hit != 'true' }} run: yarn playwright install --with-deps chromium background: true - - wait-all: true + # Run Rspec Tests only needs gems/ruby, apt packages, yarn/node_modules, + # assets, Playwright, and the parallel test DBs — not Rubocop, ESLint, + # Brakeman, Dependency Audit, or Project Stats, which publish their own + # check results independently later in the job. Waiting on all of them + # here (the previous `wait-all: true`) measured as ~11-22s of pure idle + # time per run, gated on whichever of those unrelated steps ran longest + # (usually Brakeman) — wasted on every CI run of every app using this + # workflow. They still run concurrently with Rspec; see the `wait-all` + # below that joins them again before the job concludes. + - wait: [install-ruby, install-apt, install-yarn, compile-assets, install-playwright, setup-parallel-databases] # Doesn't need to finish before tests start, only before the job ends — # the wait below is a cheap correctness net, not an expected delay, @@ -282,7 +294,13 @@ jobs: env: CAPYBARA_DRIVER: js - - wait: [save-asset-cache] + # Rubocop, ESLint, Brakeman, Dependency Audit, and Project Stats were + # no longer joined by the narrower `wait:` above `Run Rspec Tests`, so + # they're still running in the background at this point. Join all of + # them (along with save-asset-cache) here so a lint/security failure + # still fails the job and `steps.project-stats.outputs.table` is ready + # before the parallel block below publishes it. + - wait-all: true # None of these read each other's output — all four only consume # artifacts already produced by Run Rspec Tests above.