Repository navigation
193 lines (184 loc) · 6.55 KB
/
Copy pathci.yaml
File metadata and controls
193 lines (184 loc) · 6.55 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
name: CI Gate
on:
pull_request:
branches: [master]
jobs:
version_sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check version sync
run: bash scripts/check_version_sync.sh
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
working-directory: zorphy
# Runs the shared pub-get + example build_runner work once and uploads the
# whole workspace (incl. .dart_tool and generated sources) as an artifact so
# the analyze/test/build_runner_smoke/analyzer_compat jobs can reuse it
# instead of each repeating the 1-3 min codegen. The committed example
# pubspec.lock pins identical resolution in every leg, so the artifact is
# byte-identical for all consumers; analyzer_compat still re-resolves zorphy
# itself with its pinned analyzer after restoring.
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies (zorphy_annotation)
run: dart pub get
working-directory: zorphy_annotation
- name: Install dependencies (zorphy)
run: dart pub get
working-directory: zorphy
- name: Install dependencies (example)
run: dart pub get
working-directory: zorphy/example
- name: Run build_runner (example)
run: dart run build_runner build --delete-conflicting-outputs
working-directory: zorphy/example
- name: Archive prepared workspace
# The archive must live outside the tree being archived: creating it
# inside "." changes the root dir's metadata mid-walk, and GNU tar
# then fails with "tar: .: file changed as we read it".
run: tar -czf "$RUNNER_TEMP/prepared-workspace.tar.gz" --exclude=.git .
- name: Upload prepared workspace
uses: actions/upload-artifact@v4
with:
name: prepared-workspace
path: ${{ runner.temp }}/prepared-workspace.tar.gz
retention-days: 1
analyze:
runs-on: ubuntu-latest
needs: [version_sync, prepare]
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- uses: actions/download-artifact@v4
with:
name: prepared-workspace
- name: Restore prepared workspace
run: tar -xzf prepared-workspace.tar.gz
- name: Install dependencies (zorphy_annotation)
run: dart pub get
working-directory: zorphy_annotation
- name: Install dependencies (zorphy)
run: dart pub get
working-directory: zorphy
- name: Install dependencies (example)
run: dart pub get
working-directory: zorphy/example
- name: Analyze (zorphy_annotation)
run: dart analyze
working-directory: zorphy_annotation
- name: Analyze (zorphy)
run: dart analyze
working-directory: zorphy
test:
runs-on: ubuntu-latest
needs: [version_sync, format, prepare]
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- uses: actions/download-artifact@v4
with:
name: prepared-workspace
- name: Restore prepared workspace
run: tar -xzf prepared-workspace.tar.gz
- name: Install dependencies (zorphy)
run: dart pub get
working-directory: zorphy
- name: Run tests (zorphy)
run: dart test
working-directory: zorphy
build_runner_smoke:
runs-on: ubuntu-latest
needs: [version_sync, prepare]
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- uses: actions/download-artifact@v4
with:
name: prepared-workspace
- name: Restore prepared workspace
run: tar -xzf prepared-workspace.tar.gz
- name: Install dependencies (example)
run: dart pub get
working-directory: zorphy/example
- name: Verify generated code analyzes clean
run: dart analyze
working-directory: zorphy/example
analyzer_compat:
runs-on: ubuntu-latest
needs: [version_sync, prepare]
strategy:
fail-fast: false
matrix:
analyzer: ["13", "14"]
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- uses: actions/download-artifact@v4
with:
name: prepared-workspace
- name: Restore prepared workspace
run: tar -xzf prepared-workspace.tar.gz
- name: Pin analyzer ${{ matrix.analyzer }}.x
working-directory: zorphy
run: |
if [ "${{ matrix.analyzer }}" = "14" ]; then
printf 'dependency_overrides:\n zorphy_annotation:\n path: ../zorphy_annotation\n analyzer: ^14.0.0\n json_serializable:\n git:\n url: https://github.com/google/json_serializable.dart\n path: json_serializable\n' > pubspec_overrides.yaml
else
printf 'dependency_overrides:\n zorphy_annotation:\n path: ../zorphy_annotation\n analyzer: ^13.0.0\n' > pubspec_overrides.yaml
fi
cat pubspec_overrides.yaml
- name: Install dependencies
run: dart pub get
working-directory: zorphy
- name: Verify resolved analyzer major
working-directory: zorphy
run: |
resolved=$(dart pub deps --style=compact | grep -m1 -o 'analyzer [0-9.]*' | awk '{print $2}')
echo "resolved analyzer: $resolved"
case "$resolved" in
${{ matrix.analyzer }}.*) echo "OK" ;;
*) echo "expected analyzer ${{ matrix.analyzer }}.x, got $resolved"; exit 1 ;;
esac
- name: Analyze (analyzer ${{ matrix.analyzer }})
run: dart analyze lib
working-directory: zorphy
- name: Run tests (analyzer ${{ matrix.analyzer }})
run: dart test
working-directory: zorphy
migrator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies (zorphy_migrator)
run: dart pub get
working-directory: zorphy_migrator
- name: Analyze (zorphy_migrator)
run: dart analyze
working-directory: zorphy_migrator
- name: Run tests (zorphy_migrator)
run: dart test
working-directory: zorphy_migrator