-
Notifications
You must be signed in to change notification settings - Fork 58
319 lines (248 loc) · 7.96 KB
/
Copy pathtest.yml
File metadata and controls
319 lines (248 loc) · 7.96 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# Workflow for running linting, tests, and other checks
#
# Detects where file changes occur so that the main Rust-based job
# (which takes up to 30 mins) is only run when there are related changes
# (and not when the `web` module changes for example).
#
# Tries to take a fail fast approach : dependency audits, linting etc,
# (which are faster), are run before tests (which are slower, particularly
# for Rust-based modules including the Node and Python SDKs).
name: Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
RUST_VERSION: "1.94.0"
CARGO_TERM_COLOR: always
NODE_VERSION: "22"
PYTHON_VERSION: "3.12"
jobs:
license:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install REUSE
run: pip install reuse
- name: Run license checks
run: make license
# Detect which folders have changes
changes:
runs-on: ubuntu-latest
outputs:
main: ${{ steps.changes.outputs.main }}
ts: ${{ steps.changes.outputs.ts }}
vscode: ${{ steps.changes.outputs.vscode }}
web: ${{ steps.changes.outputs.web }}
claude: ${{ steps.changes.outputs.claude }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Detect changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
main:
- 'rust/**'
ts:
- 'ts/**'
- 'package.json'
vscode:
- 'vscode/**'
web:
- 'web/**'
- 'package.json'
claude:
- 'claude/**'
- '.claude-plugin/**'
- 'site/docs/documents/**'
main:
runs-on: ubuntu-latest-16core
needs: changes
if: needs.changes.outputs.main == 'true'
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
# Skip because on `ubuntu-latest-m` seems to be detrimental
if: false
with:
root-reserve-mb: "4096"
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy,llvm-tools
- name: Setup linker
run: make -C rust setup-linker
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Setup Python dev dependencies
run: pip install reuse ruff pyright
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Chrome for web e2e tests
uses: browser-actions/setup-chrome@v1
- name: Show disk usage
run: df -h && du -hd1
- name: Install dependencies
run: make install
- name: Run dependency audits
# Skip running `cargo audit` which stopped working on GitHub actions
# in January 2025 for unknown reason despite being installed above
# e.g. https://github.com/stencila/stencila/actions/runs/13016959215/job/36308449923#step:15:26
# TODO: Try to reinstate
if: false
run: make audit
- name: Run package publishing checks
run: make pubcheck
- name: Run linting
run: make lint
- name: Install tools required for tests
run: make install-tools
env:
ASSUME_YES: true
- name: Run tests with coverage
run: make cover
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
verbose: true
# TODO: reinstate these
#- name: Run end-to-end tests
# if: ${{ !startsWith(github.ref, 'refs/heads/renovate/') }}
# env:
# ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: make -C web e2e
- name: Run accessibility checks
run: make a11y
- name: Make generated files
run: make generated
- name: Pull branch before commit
if: github.ref == 'refs/heads/main'
run: git pull origin main
- name: Commit generated files
if: github.ref == 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(*): update generated files"
- name: Show disk usage
run: df -h && du -hd1
ts:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.ts == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install dependencies
run: make -C ts install
- name: Run dependency audit and publishing checks
run: make -C ts audit pubcheck
- name: Run linting
run: make -C ts lint
- name: Run tests
run: make -C ts test
vscode:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
needs: changes
if: needs.changes.outputs.vscode == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: make -C vscode install
- name: Lint
run: make -C vscode lint
if: runner.os == 'Linux'
- name: Test
run: make -C vscode test
if: runner.os != 'Linux'
- name: Test with xvfb
run: xvfb-run -a make -C vscode test
if: runner.os == 'Linux'
claude:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.claude == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Stencila CLI
run: |
curl -LsSf https://stencila.io/install.sh | bash
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Check generated references are up to date
run: |
./claude/scripts/gen-references.sh
if [ -n "$(git status --porcelain -- claude/skills/authoring/references)" ]; then
git status --porcelain -- claude/skills/authoring/references
git diff -- claude/skills/authoring/references
echo "Generated references are out of date: run 'make -C claude generated' and commit" >&2
exit 1
fi
- name: Run skill example golden tests
run: ./claude/scripts/test-examples.sh
- name: Run CLI flag drift guard
run: ./claude/scripts/check-flags.sh
- name: Install Claude Code CLI
id: claude-cli
continue-on-error: true
run: npm install -g @anthropic-ai/claude-code
- name: Validate plugin and marketplace manifests
if: steps.claude-cli.outcome == 'success'
run: |
claude plugin validate ./claude --strict
claude plugin validate .
web:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.web == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: make -C web install
- name: Run dependency audit
run: make -C web audit
- name: Run linting
run: make -C web lint
- name: Run tests
run: make -C web test