-
Notifications
You must be signed in to change notification settings - Fork 0
293 lines (240 loc) · 8.33 KB
/
ci.yaml
File metadata and controls
293 lines (240 loc) · 8.33 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
name: CI
on:
push:
branches: [main]
tags: ["*"]
pull_request:
workflow_dispatch:
jobs:
example:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
- if: runner.os != 'Windows'
run: uv run camas matrix
# zuban non-deterministically fails to find test deps under UV_PROJECT_ENVIRONMENT on
# Windows in CI (cannot reproduce locally); inline the matrix without zuban there.
- if: runner.os == 'Windows'
run: |
uv run camas 'Sequential(
"uv sync",
{format_check, lint, mypy, pyright, ty, pyrefly, test},
env={"UV_PROJECT_ENVIRONMENT": ".venv-{PY}", "UV_PYTHON": "{PY}"},
matrix={"PY": ("3.10", "3.11", "3.12", "3.13", "3.14", "3.15")},
)'
check:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- run: uv run camas check
env:
UV_PYTHON: ${{ matrix.python }}
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
- run: uv run camas coverage --effects='(Status(StatusOptions(output_mode="all")),)'
- uses: codecov/codecov-action@v5
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
github-checks-demo:
permissions:
checks: write
contents: read
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- run: |
uv run --extra github_checks camas matrix --effects='(
Status(StatusOptions(output_mode="github")),
GitHubChecks(GitHubChecksOptions(
sha="${{ github.event.pull_request.head.sha || github.sha }}",
)),
)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
status-modes-demo:
# Showcases each Status output_mode so reviewers can click through and compare;
# the auto-detected default (Status output_mode='github') is exercised by every
# other job, so only the non-default modes are matrixed here.
strategy:
matrix:
mode: [quiet, all, errors, stream]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- run: uv run camas check --effects='(Status(StatusOptions(output_mode="${{ matrix.mode }}")),)'
nix:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: DeterminateSystems/nix-installer-action@v22
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: nix flake check --print-build-logs
tauri-fixture:
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: tests/fixtures/tauri-app
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
- uses: actions/setup-node@v4
with:
node-version-file: tests/fixtures/tauri-app/.nvmrc
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
working-directory: .
- run: uv tool install .
working-directory: .
- run: npm ci
# First run: verify pipeline + warm caches (cargo, uv, node_modules).
- run: camas all
# Too slow to be a useful example, but you get the idea
# - run: camas build
- run: shellcheck .github/scripts/*.sh
working-directory: .
- name: Install shfmt
working-directory: .
run: |
mkdir -p "$HOME/.local/bin"
curl -fsSL --retry 3 -o "$HOME/.local/bin/shfmt" \
https://github.com/mvdan/sh/releases/download/v3.13.1/shfmt_v3.13.1_linux_amd64
chmod +x "$HOME/.local/bin/shfmt"
- run: $HOME/.local/bin/shfmt -d .github/scripts/*.sh
working-directory: .
- name: Install demo recording tools
working-directory: .
run: bash .github/scripts/ci-setup.sh
# Second run: record demo on warm caches.
- name: Record demo
working-directory: .
run: bash .github/scripts/record-demo.sh
- run: test -s .demo/demo.gif
working-directory: .
- uses: actions/upload-artifact@v7
with:
name: demo
path: .demo/
- name: Publish demo to gh-storage branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
working-directory: .
run: |
SHORT_SHA="${GITHUB_SHA::7}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git ls-remote --exit-code origin gh-storage >/dev/null; then
git fetch origin gh-storage
git worktree add storage gh-storage
else
git worktree add --orphan -b gh-storage storage
(cd storage && git rm -rf . >/dev/null 2>&1 || true)
fi
mkdir -p storage/demos/archive
cp .demo/demo.gif storage/demos/demo-latest.gif
cp .demo/demo.gif "storage/demos/archive/demo-${SHORT_SHA}.gif"
cp .demo/demo.cast storage/demos/demo-latest.cast
cp .demo/demo.cast "storage/demos/archive/demo-${SHORT_SHA}.cast"
cd storage
git add demos
if git diff --cached --quiet; then
echo "No changes to publish"
else
git commit -m "Render demo for ${SHORT_SHA}"
git push origin gh-storage
fi
wheels:
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
python: ["311", "312", "313", "314"]
fail-fast: false
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: "cp${{ matrix.python }}-*"
CIBW_SKIP: "*-musllinux_i686 *-win32"
CIBW_ENVIRONMENT: CAMAS_USE_MYPYC=1
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_ALL_LINUX: git config --global --add safe.directory '*'
CIBW_TEST_REQUIRES: pytest pytest-asyncio cyclopts httpx ty
CIBW_TEST_COMMAND: >
python -c "import camas.main.dispatch, camas.main.entrypoint, camas.effect.summary, camas.effect.termtree;
assert all(not m.__file__.endswith('.py') for m in (camas.main.dispatch, camas.main.entrypoint, camas.effect.summary, camas.effect.termtree))" &&
pytest {project}/tests -v -m "not slow"
- if: always()
uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}-cp${{ matrix.python }}
path: ./wheelhouse/*.whl
if-no-files-found: ignore
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
- run: uv build --sdist
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
publish:
if: startsWith(github.ref, 'refs/tags/')
needs: [check, coverage, wheels, sdist, tauri-fixture, example, nix]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/camas
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v7
with:
path: dist
pattern: wheels-*
merge-multiple: true
- uses: actions/download-artifact@v7
with:
path: dist
name: sdist
- uses: pypa/gh-action-pypi-publish@release/v1