-
Notifications
You must be signed in to change notification settings - Fork 1
235 lines (212 loc) · 8.7 KB
/
test.yml
File metadata and controls
235 lines (212 loc) · 8.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: Core Validation
# ─────────────────────────────────────────────────────────────────────────────
# Pipeline 2 — Core Validation (target: < 5 min on PR)
#
# Two jobs, gated by a shared path-filter:
#
# test-pr — PR trigger only.
# Single runner (ubuntu-22.04, pinned Flutter).
# Only the packages that changed are tested, so a one-line
# fix in hyper_render_html doesn't re-run core/markdown/etc.
#
# test-matrix — Push to main/develop only.
# Full 3-OS × 2-channel matrix to catch platform regressions
# before the tag lands.
#
# What this job does NOT do (handled by Pipeline 1 — analyze.yml):
# • dart format
# • flutter analyze
# ─────────────────────────────────────────────────────────────────────────────
env:
FLUTTER_VERSION: "3.41.5"
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
# ── Changed-path detection ─────────────────────────────────────────────────
path-filter:
name: Detect Changed Packages
runs-on: ubuntu-22.04
outputs:
changed_core: ${{ steps.filter.outputs.core }}
changed_html: ${{ steps.filter.outputs.html }}
changed_markdown: ${{ steps.filter.outputs.markdown }}
changed_highlight: ${{ steps.filter.outputs.highlight }}
changed_clipboard: ${{ steps.filter.outputs.clipboard }}
changed_devtools: ${{ steps.filter.outputs.devtools }}
changed_root: ${{ steps.filter.outputs.root }}
changed_any_dart: ${{ steps.filter.outputs.any_dart }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
core:
- 'packages/hyper_render_core/**'
html:
- 'packages/hyper_render_html/**'
markdown:
- 'packages/hyper_render_markdown/**'
highlight:
- 'packages/hyper_render_highlight/**'
clipboard:
- 'packages/hyper_render_clipboard/**'
devtools:
- 'packages/hyper_render_devtools/**'
root:
- 'lib/**'
- 'test/**'
- 'pubspec.yaml'
- 'pubspec.lock'
any_dart:
- '**/*.dart'
- '**/pubspec.yaml'
- '**/pubspec.lock'
- '**/analysis_options.yaml'
# ── PR: fast single-OS run — only changed packages ─────────────────────────
test-pr:
name: Tests (PR · ubuntu-22.04 · stable)
runs-on: ubuntu-22.04
needs: path-filter
if: >-
github.event_name == 'pull_request' &&
needs.path-filter.outputs.changed_any_dart == 'true'
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- name: Restore pub cache
uses: actions/cache@v4
with:
path: |
~/.pub-cache
${{ env.PUB_CACHE }}
key: pub-ubuntu-${{ hashFiles('**/pubspec.lock') }}
restore-keys: pub-ubuntu-
- name: flutter pub get
run: flutter pub get
# Root package — always run when root lib/test or pubspec changed.
# Also covers tests that exercise the core package from the root.
- name: Test root package
if: >-
needs.path-filter.outputs.changed_root == 'true' ||
needs.path-filter.outputs.changed_core == 'true'
run: flutter test --no-pub
- name: Test hyper_render_core
if: needs.path-filter.outputs.changed_core == 'true'
working-directory: packages/hyper_render_core
run: flutter test --no-pub
- name: Test hyper_render_html
if: >-
needs.path-filter.outputs.changed_html == 'true' ||
needs.path-filter.outputs.changed_core == 'true'
working-directory: packages/hyper_render_html
run: flutter test --no-pub
- name: Test hyper_render_markdown
if: >-
needs.path-filter.outputs.changed_markdown == 'true' ||
needs.path-filter.outputs.changed_core == 'true'
working-directory: packages/hyper_render_markdown
run: |
if [ -d test ]; then flutter test --no-pub; else echo "No tests in this package — skipping."; fi
- name: Test hyper_render_highlight
if: >-
needs.path-filter.outputs.changed_highlight == 'true' ||
needs.path-filter.outputs.changed_core == 'true'
working-directory: packages/hyper_render_highlight
run: |
if [ -d test ]; then flutter test --no-pub; else echo "No tests in this package — skipping."; fi
- name: Test hyper_render_clipboard
if: >-
needs.path-filter.outputs.changed_clipboard == 'true' ||
needs.path-filter.outputs.changed_core == 'true'
working-directory: packages/hyper_render_clipboard
run: |
if [ -d test ]; then flutter test --no-pub; else echo "No tests in this package — skipping."; fi
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-pr-${{ github.run_number }}
path: |
test-results/
**/test-results/
retention-days: 7
# ── Push to main/develop: full 3-OS × 2-channel matrix ────────────────────
test-matrix:
name: Tests (${{ matrix.os }} · ${{ matrix.flutter-channel }})
runs-on: ${{ matrix.os }}
needs: path-filter
if: >-
github.event_name == 'push' &&
needs.path-filter.outputs.changed_any_dart == 'true'
strategy:
fail-fast: false # let all matrix legs complete so we see the full picture
matrix:
include:
# Stable: all 3 OS — pinned Flutter version
- { os: ubuntu-22.04, flutter-channel: stable, flutter-version: "3.41.5" }
- { os: macos-latest, flutter-channel: stable, flutter-version: "3.41.5" }
- { os: windows-latest, flutter-channel: stable, flutter-version: "3.41.5" }
# Beta: ubuntu only, no version pin (use latest beta build)
- { os: ubuntu-22.04, flutter-channel: beta, flutter-version: "" }
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}
cache: true
- name: flutter pub get
run: flutter pub get
- name: Run all tests (exclude golden — pixel refs are ubuntu-22.04 only)
# Golden tests are pinned to ubuntu-22.04 in golden.yml.
# Running them on macOS/Windows would always fail due to font/subpixel differences.
run: >-
flutter test --no-pub
test/accessibility_test.dart
test/css_keyframes_test.dart
test/fragment_test.dart
test/giant_div_test.dart
test/html_heuristics_test.dart
test/html_sanitizer_test.dart
test/hyper_render_test.dart
test/hyper_render_widget_test.dart
test/hyper_selection_overlay_test.dart
test/hyper_viewer_animated_switcher_test.dart
test/integration/
test/integration_test.dart
test/integration_test_all.dart
test/integration_test_extended.dart
test/layout_logic_test.dart
test/lru_cache_test.dart
test/media_test.dart
test/memory/
test/model/
test/render_hyper_box_test.dart
test/reproduce_semantics_error_test.dart
test/ruby_selection_test.dart
test/security_edge_cases_test.dart
test/style/
test/svg_builder_test.dart
test/system_test.dart
test/table_layout_test.dart
test/v120/
test/widget/
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-${{ matrix.flutter-channel }}-${{ github.run_number }}
path: |
test-results/
**/test-results/
retention-days: 7