Skip to content

Commit 4739cc3

Browse files
ci: parallelize analyze job to unblock builds earlier (#329)
* ci: parallelize analyze job to unblock builds earlier Extract flutter analyze into its own job that runs in parallel with fmt and test. build-web and build-android now gate on [fmt, analyze] instead of [fmt, test], so builds start ~2-3 min earlier while tests are still running. deploy-web-preview retains test as a dependency so no code ships before unit tests pass. Also cache Playwright Chromium browsers in test-e2e-web keyed on package-lock.json, saving ~1.5 min on E2E runs when the browser version hasn't changed. https://claude.ai/code/session_01C6APCuJxZbNcmJpbTJUyB9 * ci: fix stale path filter for workflow file The changes job was watching .github/workflows/build-deploy.yml (old name) instead of ci.yml, so changes to the CI file itself never triggered the test pipeline. https://claude.ai/code/session_01C6APCuJxZbNcmJpbTJUyB9 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent bb39f7a commit 4739cc3

1 file changed

Lines changed: 33 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- 'package.json'
4343
- 'playwright.config.ts'
4444
- 'android/**'
45-
- '.github/workflows/build-deploy.yml'
45+
- '.github/workflows/ci.yml'
4646
- 'mise.toml'
4747
functions:
4848
- 'functions/**'
@@ -96,8 +96,8 @@ jobs:
9696
mapfile -t SH_FILES < <(find . -name '*.sh' -not -path './.git/*' -not -path './.mise/*' -not -path '*/node_modules/*' | sort)
9797
[[ ${#SH_FILES[@]} -gt 0 ]] && shfmt -d -i 0 -ci "${SH_FILES[@]}"
9898
99-
# Run tests once before building
100-
test:
99+
# Analyze code in parallel with tests so builds can start sooner
100+
analyze:
101101
needs: changes
102102
runs-on: ubuntu-latest
103103
if: |
@@ -117,6 +117,24 @@ jobs:
117117
- name: Analyze code
118118
run: flutter analyze --no-fatal-infos
119119

120+
# Run tests once before building
121+
test:
122+
needs: changes
123+
runs-on: ubuntu-latest
124+
if: |
125+
github.event_name == 'workflow_dispatch' ||
126+
needs.changes.outputs.app == 'true' ||
127+
needs.changes.outputs.functions == 'true'
128+
steps:
129+
- name: Checkout
130+
uses: actions/checkout@v4
131+
132+
- name: Setup Flutter App
133+
uses: ./.github/actions/setup-flutter-app
134+
with:
135+
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
136+
generate-mocks: 'true'
137+
120138
- name: Run tests with coverage
121139
run: flutter test --coverage
122140

@@ -133,9 +151,9 @@ jobs:
133151
npm ci
134152
npm test
135153
136-
# Build web after tests pass
154+
# Build web after analysis passes (tests run in parallel; deploy gates on test)
137155
build-web:
138-
needs: [changes, test, fmt]
156+
needs: [changes, analyze, fmt]
139157
runs-on: ubuntu-latest
140158
if: |
141159
github.event_name == 'workflow_dispatch' ||
@@ -191,6 +209,13 @@ jobs:
191209
- name: Install npm dependencies
192210
run: npm ci
193211

212+
- name: Cache Playwright browsers
213+
uses: actions/cache@v4
214+
with:
215+
path: ~/.cache/ms-playwright
216+
key: playwright-chromium-${{ hashFiles('package-lock.json') }}
217+
restore-keys: playwright-chromium-
218+
194219
- name: Install Playwright browsers
195220
run: npx playwright install --with-deps chromium
196221

@@ -226,9 +251,9 @@ jobs:
226251
rm .http-server.pid
227252
fi
228253
229-
# Build Android after tests pass
254+
# Build Android after analysis passes (tests run in parallel)
230255
build-android:
231-
needs: [changes, test, fmt]
256+
needs: [changes, analyze, fmt]
232257
runs-on: ubuntu-latest
233258
if: |
234259
github.event_name == 'workflow_dispatch' ||
@@ -282,7 +307,7 @@ jobs:
282307
if-no-files-found: error
283308

284309
deploy-web-preview:
285-
needs: [changes, build-web, test-e2e-web]
310+
needs: [changes, build-web, test-e2e-web, test]
286311
runs-on: ubuntu-latest
287312
if: |
288313
github.event_name == 'workflow_dispatch' ||

0 commit comments

Comments
 (0)