Skip to content

Commit 18d1a96

Browse files
committed
[green] Make clean CI portable across hosts
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th>
1 parent d380e8b commit 18d1a96

9 files changed

Lines changed: 229 additions & 123 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
# hard-coded display text in lib/app (BLD-5, CON-9, FR-I18N-1..4).
1111
# - sha-drift : checked-out submodule SHA == versions.lock, else refuse (BLD-1/2).
1212
# - app : Flutter app gate (X-03) — resolve against the TRACKED lockfile,
13-
# static analysis, and the unit/widget/golden/conformance suites (BLD-2).
13+
# static analysis, and unit/widget/conformance suites (BLD-2).
14+
# - app-goldens : exact pixel baselines on pinned macOS, matching the
15+
# renderer used to review and commit the reference PNGs.
1416
# - web : pinned-Node install, formatting, lint, type, unit, and
1517
# static-export build checks for tools/web.
1618
# - docs : every repository-local Markdown target exists.
@@ -129,6 +131,12 @@ jobs:
129131
timeout-minutes: 20
130132
steps:
131133
- uses: actions/checkout@v4
134+
with:
135+
submodules: true
136+
- name: Initialize pinned MicroPython host dependency
137+
run: |
138+
git -C firmware/upstream/micropython submodule update --init --depth 1 \
139+
lib/micropython-lib
132140
- name: Firmware shell and conformance gates
133141
run: tests/firmware_tests/run_tests.sh
134142
- name: Complete firmware host and release suite
@@ -137,7 +145,7 @@ jobs:
137145
app:
138146
# The Flutter app gate (X-03). Resolves strictly against the TRACKED
139147
# app/pubspec.lock (BLD-2), runs static analysis, and runs the full test
140-
# suite (unit/widget/golden/conformance — G1). Runs only after the fast
148+
# non-pixel suite (unit/widget/conformance — G1). Runs only after the fast
141149
# bash gates pass, so a leak / SPDX / import-boundary / locale-parity failure
142150
# short-circuits before the heavier toolchain setup. (dco runs as its own
143151
# required check.)
@@ -172,14 +180,46 @@ jobs:
172180
run: dart format --output=none --set-exit-if-changed lib test integration_test
173181
- name: Static analysis
174182
run: flutter analyze
175-
- name: Test suite — unit/widget/golden/conformance (G1)
176-
run: flutter test
183+
- name: Test suite — unit/widget/conformance (G1)
184+
run: flutter test --exclude-tags golden
185+
186+
app-goldens:
187+
# Pixel goldens are renderer-specific. Run them on pinned Apple Silicon
188+
# macOS, matching the environment used to review and commit the baselines;
189+
# the Linux app job still runs every non-pixel Flutter test.
190+
needs: [no-leak, spdx, locale-parity]
191+
runs-on: macos-15
192+
timeout-minutes: 15
193+
defaults:
194+
run:
195+
working-directory: app
196+
steps:
197+
- uses: actions/checkout@v4
198+
- name: Cache pub packages (keyed on OS and tracked lockfile)
199+
uses: actions/cache@v4
200+
with:
201+
path: ~/.pub-cache
202+
key: pub-${{ runner.os }}-${{ hashFiles('app/pubspec.lock') }}
203+
restore-keys: |
204+
pub-${{ runner.os }}-
205+
- name: Set up Flutter 3.44.1 (pinned, stable) + SDK cache
206+
uses: subosito/flutter-action@v2
207+
with:
208+
flutter-version: 3.44.1
209+
channel: stable
210+
cache: true
211+
- name: Resolve deps against the TRACKED lockfile (BLD-2)
212+
run: flutter pub get --enforce-lockfile
213+
- name: Generate localizations from ARB (gen-l10n, X-12/FR-I18N-1)
214+
run: flutter gen-l10n
215+
- name: Pixel golden suite — reviewed macOS baselines (G1)
216+
run: flutter test --tags golden
177217

178218
android-webview:
179219
# Exercise the real Android WebView/JavaScript-channel boundary, not the
180220
# host-side widget substitute. Keep the AVD construction in plain Android
181221
# SDK tools so the image, memory, boot bound, and diagnostics are visible.
182-
needs: app
222+
needs: [app, app-goldens]
183223
runs-on: ubuntu-24.04
184224
timeout-minutes: 40
185225
defaults:

‎CONTRIBUTING.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ flutter pub get --enforce-lockfile
7575
flutter gen-l10n
7676
dart format --output=none --set-exit-if-changed lib test integration_test
7777
flutter analyze
78-
flutter test
78+
flutter test --exclude-tags golden
79+
```
80+
81+
On macOS, also run the renderer-specific pixel baselines:
82+
83+
```sh
84+
flutter test --tags golden
7985
```
8086

8187
Use a recent stable Flutter SDK matching the version pinned by CI.

‎app/README.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ flutter pub get --enforce-lockfile
3131
flutter gen-l10n
3232
dart format --output=none --set-exit-if-changed lib test integration_test
3333
flutter analyze
34-
flutter test
34+
flutter test --exclude-tags golden
35+
```
36+
37+
Pixel goldens use reviewed macOS baselines. Run them separately on macOS:
38+
39+
```sh
40+
flutter test --tags golden
3541
```
3642

3743
Run on a connected device:
@@ -40,9 +46,9 @@ Run on a connected device:
4046
flutter run
4147
```
4248

43-
Platform WebView integration tests live under `integration_test/`. The normal
44-
unit, widget, golden, and PBLE/1 conformance suites run through
45-
`flutter test`.
49+
Platform WebView integration tests live under `integration_test/`. CI runs
50+
unit, widget, and PBLE/1 conformance tests on Linux, exact pixel goldens on a
51+
pinned macOS runner, and the real Blockly WebView integration on Android.
4652

4753
## Architecture and dependencies
4854

‎app/dart_test.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-License-Identifier: MIT
2+
# Part of PyBLE (https://pyble.dev) — see /LICENSE.
3+
4+
tags:
5+
golden:

‎app/test/golden/about_page_golden_test.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void main() {
4949
find.byType(AboutPage),
5050
matchesGoldenFile('goldens/about_${surface.name}.png'),
5151
);
52-
});
52+
}, tags: const ['golden']);
5353
}
5454
});
5555
}

0 commit comments

Comments
 (0)