Repository navigation
243 lines (233 loc) · 10.7 KB
/
Copy pathci.yml
File metadata and controls
243 lines (233 loc) · 10.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
236
237
238
239
240
241
242
243
name: CI
# Every push to main is checked whole: the gates and unit tests, every journey on Windows and
# on Linux, and the installers built and tried out on each system. Nothing of that is
# published: the latest commit is had by building it from the source.
#
# A release is a commit of its own (ADR-043): "release: <version>", the version that
# package.json and the changelog have, pushed to main. When everything here has passed for
# it, the installers made and tried for that commit are published as that version, tagged at
# that commit: a pre-release for an alpha ("0.2.0-alpha.1"), the latest release otherwise.
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
# A newer push stops the checks of an older one, but never a release.
group: "ci-${{ github.ref }}-${{ startsWith(github.event.head_commit.message, 'release: ') && github.sha || 'latest' }}"
cancel-in-progress: true
env:
# A Python that uv manages, the same one on every machine, never the machine's own.
UV_PYTHON_PREFERENCE: only-managed
jobs:
release:
# Only for a release commit. Said at once if it is not one that can be published, before
# anything is built for it.
name: Release notes
if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release: ')"
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
- name: The commit names this version, it is not released yet, and the changelog has it
id: version
env:
MESSAGE: ${{ github.event.head_commit.message }}
run: |
subject=$(printf '%s\n' "$MESSAGE" | head -n 1)
version=${subject#release: }
if ! printf '%s' "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+)?$'; then
echo "A release commit says \"release: <version>\", for an alpha (0.2.0-alpha.1) or a stable version (0.2.0). This one says \"$subject\"." >&2
exit 1
fi
released=$(git ls-remote --tags origin "refs/tags/v$version" | cut -f1)
if [ -n "$released" ] && [ "$released" != "$GITHUB_SHA" ]; then
echo "$version was released already, from $released." >&2
exit 1
fi
node scripts/release-notes.mjs --tag="v$version" > release-notes.md
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release-notes
path: release-notes.md
if-no-files-found: error
retention-days: 14
checks:
name: Static checks and unit tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
enable-cache: true
- name: Install JavaScript dependencies
run: npm ci
- name: Install Python dependencies
run: npm run core:sync
- name: Contracts, format, lint, types, unit tests
run: node scripts/check.mjs --all
- name: Dependency audit (npm)
run: npm audit --audit-level=high
- name: Dependency audit (Python, everything in uv.lock)
run: |
uv export --directory services/core --frozen --no-emit-project --no-hashes --format requirements-txt --quiet --output-file requirements-audit.txt
uv tool run pip-audit -r services/core/requirements-audit.txt --disable-pip --no-deps
- name: Dependency audit (Python, the programs a natural voice is set up with)
# Downloaded at the learner's word and never shipped (ADR-042). The advisories set
# aside here were each read: every one needs a model file or repository Adle did not
# pin, or a part of a library the voice never runs (training, converting or saving a
# model, building a package, compiling a script). ADR-042 lists them. A new one
# fails this step.
run: |
for lock in services/core/adle_core/voice/data/*.txt; do
echo "$lock"
uv tool run pip-audit -r "$lock" --disable-pip --no-deps \
--ignore-vuln PYSEC-2025-194 \
--ignore-vuln PYSEC-2026-3447 --ignore-vuln GHSA-xmj3-9gf7-h52w \
--ignore-vuln PYSEC-2026-3804 \
--ignore-vuln PYSEC-2025-217 --ignore-vuln PYSEC-2026-2288 \
--ignore-vuln PYSEC-2026-2289 --ignore-vuln PYSEC-2026-2290 \
--ignore-vuln PYSEC-2026-3929 --ignore-vuln PYSEC-2026-4174
done
- name: Dependency audit (Python, the programs the film maker is set up with)
# Downloaded at the learner's word and never shipped (ADR-065). None is set aside:
# a new advisory fails this step.
run: |
for lock in services/core/adle_core/film/data/manimgx-*.txt; do
echo "$lock"
uv tool run pip-audit -r "$lock" --disable-pip --no-deps
done
e2e:
name: End-to-end (${{ matrix.os }})
needs: checks
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
enable-cache: true
- name: Install JavaScript dependencies
run: npm ci
- name: Download the pinned Electron binary
run: npx install-electron --no
- name: Install Python dependencies
run: npm run core:sync
- name: Run end-to-end tests (Windows)
if: runner.os == 'Windows'
run: npm run e2e
- name: A keyring for the test session (Linux)
if: runner.os == 'Linux'
# Adle keeps a provider's key only where the system can keep a secret, and says so
# where it cannot. A build machine has no keyring of its own, and twenty-three
# journeys save a key: without one they stop at the first step, as they should.
# (They stopped with one, too, until e2e/support/keep-secrets.cjs: the test tool
# tells the app to keep secrets as plain text, which Adle refuses just the same.)
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends gnome-keyring libsecret-1-0 libsecret-tools dbus-daemon
- name: Run end-to-end tests (Linux, virtual display)
if: runner.os == 'Linux'
# Run from its folder, Electron's sandbox helper is nobody's, so the sandbox is built
# from namespaces, which this build machine is told to allow. The sandbox stays on.
# The session has a message bus and an unlocked keyring on it, and says it is a
# GNOME one, which is how Chromium knows to keep secrets there.
run: |
sudo sysctl --write kernel.apparmor_restrict_unprivileged_userns=0 || true
dbus-run-session -- bash -c '
set -euo pipefail
printf "%s" "a-keyring-for-tests-only" | gnome-keyring-daemon --daemonize --unlock --components=secrets > /dev/null
# Is the keyring there, open, and keeping what it is given? Said here, in one
# line, rather than by twenty-three journeys half an hour later.
printf "%s" "kept" | secret-tool store --label="Adle test session" adle-test-session check
test "$(secret-tool lookup adle-test-session check)" = "kept"
export XDG_CURRENT_DESKTOP=GNOME
xvfb-run --auto-servernum npm run e2e
'
- name: Upload report and screenshots
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: e2e-${{ matrix.os }}
path: |
apps/desktop/playwright-report
apps/desktop/test-results
retention-days: 7
installers:
name: Installers
needs: checks
uses: ./.github/workflows/build.yml
with:
# Made for the check and kept a day for it, except a release's: those are published.
keep-days: "${{ github.event_name == 'push' && startsWith(github.event.head_commit.message, 'release: ') && 14 || 1 }}"
publish:
# A release commit, once every check above has passed for it: the installers made and
# tried for this commit, with their checksums, as the version it names.
name: Publish the release
needs: [release, checks, e2e, installers]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
# To tag the release commit and make the release. Nothing else in CI can write.
contents: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: installer-*
merge-multiple: true
path: release
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: release-notes
- name: Checksums
working-directory: release
run: |
sha256sum Adle-* > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Publish
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
VERSION: ${{ needs.release.outputs.version }}
run: |
tag="v$VERSION"
# An alpha is a pre-release; any other version is the latest release.
kind=(--latest)
case "$VERSION" in *-alpha.*) kind=(--prerelease) ;; esac
if gh release view "$tag" > /dev/null 2>&1; then
# Run again for the same commit (the notes job saw to that): its files are replaced.
gh release upload "$tag" release/* --clobber
gh release edit "$tag" --notes-file release-notes.md "${kind[@]}"
else
gh release create "$tag" release/* \
--target "$GITHUB_SHA" \
--title "Adle $VERSION" \
--notes-file release-notes.md \
"${kind[@]}"
fi