Repository navigation
269 lines (259 loc) · 12 KB
/
Copy pathci.yml
File metadata and controls
269 lines (259 loc) · 12 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
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
# A release needs a finished main run for its exact commit, so main runs
# are never cancelled by the next push.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
jobs:
workflows:
name: Workflows
needs: changes
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.workflows == 'true') }}
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Require pinned actions
run: ruby scripts/ci/check_action_pins.rb
- name: Test the macOS blocker seed probe policy
run: bash scripts/ci/test_macos_blocker_seed_probe.sh
- name: Test which changes need which jobs
run: bash scripts/ci/test_scope.sh
- name: Test release policy
run: python3 -m unittest discover -s scripts/release -p 'test_*.py' -v
- name: actionlint
run: |
set -euo pipefail
archive="${RUNNER_TEMP}/actionlint.tar.gz"
curl --fail --location --proto '=https' --tlsv1.2 --retry 3 --output "${archive}" \
https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz
echo "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 ${archive}" | sha256sum --check --strict
tar --extract --gzip --file "${archive}" --directory "${RUNNER_TEMP}" actionlint
"${RUNNER_TEMP}/actionlint" -color
# Decides which jobs a pull request needs: docs and repository metadata
# need none, frame changes skip Rust unless Rust reads the file, and a CI
# change runs everything. Main always runs everything: a release needs a
# full run for its exact commit. Skipped jobs satisfy required checks, so
# the classifier always comes from the base branch: a pull request cannot
# change the rule that decides which of its own checks run.
changes:
name: Changes
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
rust: ${{ steps.scope.outputs.rust }}
frontend: ${{ steps.scope.outputs.frontend }}
workflows: ${{ steps.scope.outputs.workflows }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.base.sha || github.sha }}
persist-credentials: false
- id: scope
env:
GH_TOKEN: ${{ github.token }}
EVENT: ${{ github.event_name }}
PR: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
scope="$(printf 'rust=true\nfrontend=true\nworkflows=true')"
if [[ "${EVENT}" == "pull_request" ]]; then
files="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${PR}/files" \
--jq '.[] | .filename, (.previous_filename // empty)')"
# The files API stops at 3000 entries; a list that long, or none,
# cannot prove any job is unaffected.
count="$(grep -c . <<< "${files}" || true)"
if (( count > 0 && count < 3000 )); then
classified="$(scripts/ci/scope.sh <<< "${files}" || true)"
# Anything but exactly one boolean per job runs everything.
valid=true
for key in rust frontend workflows; do
[[ "$(grep -cxE "${key}=(true|false)" <<< "${classified}")" == 1 ]] || valid=false
done
[[ "$(grep -c . <<< "${classified}")" == 3 ]] || valid=false
if [[ "${valid}" == true ]]; then
scope="${classified}"
fi
fi
fi
echo "${scope}" >> "${GITHUB_OUTPUT}"
{ echo "Jobs needed:"; echo "${scope}"; } >> "${GITHUB_STEP_SUMMARY}"
frontend:
name: Frontend
needs: changes
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.frontend == 'true') }}
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install --frozen-lockfile
# Build tools run while producing signed artifacts, so dev dependencies
# are in scope.
- run: node --test scripts/ci/audit-dependencies.test.mjs
- run: node scripts/ci/audit-dependencies.mjs
- name: Typecheck, lint and unit tests
run: pnpm --dir frame run check
- name: Windows semantic input guards
run: node scripts/test-semantic-cdp-action.mjs
- run: pnpm --dir frame run build
- run: pnpm --dir frame run check:styles
# Zephium ships on macOS and Windows only, so Linux builds no app code; it
# runs the platform-neutral policy gates.
policy:
name: Rust policy
needs: changes
# Runs when the scope check itself failed, so a broken check never skips a job.
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true') }}
runs-on: ubuntu-24.04
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
- run: rustup toolchain install --profile minimal
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3
with:
tool: cargo-deny@0.20.2
fallback: none
- run: cargo fmt --all -- --check
# The scriptlet library on synthetic payloads, outside any browser.
- run: node scripts/blocker-scriptlets/library.test.mjs
- name: Security review deadlines (warn only)
run: |
cargo xtask check-engine-floors
cargo xtask check-advisory-exceptions
# The fork-lock gate inspects the Windows graph offline, so every target's
# crates must be downloaded first.
- run: |
cargo fetch --locked
for fork in adblock tauri tauri-runtime-wry wry; do
cargo fetch --locked --manifest-path "vendor/${fork}/Cargo.toml"
done
- run: cargo xtask check-security-fork-locks
- run: cargo xtask check-agentic-probe-boundary
- run: cargo deny --locked check
macos:
name: Rust (macOS)
needs: changes
# Runs when the scope check itself failed, so a broken check never skips a job.
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true') }}
runs-on: macos-15
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: rustup toolchain install --profile minimal
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3
with:
tool: cargo-nextest@0.9.137
fallback: none
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
# `--all-targets` lets test-only uses hide dead production code.
- run: cargo clippy --workspace --lib --locked -- -D warnings
- name: Vendored updater tests
run: cargo test -p tauri-plugin-updater --lib --locked
- run: cargo nextest run --workspace --locked --profile ci --retries 2
- name: Report flaky tests
if: ${{ !cancelled() }}
run: python3 scripts/ci/flaky-summary.py target/nextest/ci/junit.xml
# The desktop export test regenerates all three IPC contracts.
- name: Bindings drift
run: |
drift="$(git status --porcelain --untracked-files=all -- \
frame/src/shared/ipc/bindings.ts \
frame/src/shared/ipc/work-constants.ts \
frame/src/shared/ipc/theme-presets.json)"
if [ -n "$drift" ]; then
printf '%s\n' "$drift"
exit 1
fi
# Proves the bundled seed lists compile in the real
# WKContentRuleListStore, which a seed refresh can break.
- name: Prove the exact bundled blocker seed compiles in native WKContentRuleListStore
timeout-minutes: 8
run: |
set -euo pipefail
probe_root="$(mktemp -d)"
trap 'rm -rf "${probe_root}"' EXIT
artifact="${probe_root}/webkit-content-rules.json"
probe="${probe_root}/probe-macos-blocker-seed"
cargo xtask materialize-blocker-seed-webkit --output "${artifact}"
xcrun swiftc -parse-as-library -O -warnings-as-errors \
-module-cache-path "${probe_root}/swift-module-cache" \
-framework WebKit scripts/ci/probe_macos_blocker_seed.swift -o "${probe}"
"${probe}" --self-test
"${probe}" "${artifact}"
# The scriptlet program rides in a built-in WebExtension (macOS 15.4+): it
# must run before page scripts in every frame, honour a paused host and
# swap programs without overlap.
- name: Check the built-in scriptlet extension in WebKit
timeout-minutes: 10
run: scripts/blocker-scriptlets/run.sh
# The page-corpus recorder against a loopback server: a redirect and a
# frame to a host off the reviewed list are refused, logged and never
# recorded.
- name: Check the page-corpus recorder refuses off-list hosts
timeout-minutes: 5
run: scripts/blocker-corpus/test-record.sh
windows:
name: Rust (Windows)
needs: changes
# Runs when the scope check itself failed, so a broken check never skips a job.
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true') }}
runs-on: windows-2025
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: rustup toolchain install --profile minimal
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- uses: taiki-e/install-action@cfdb7ed4ccc7c7dce37759eae89dc5674b469b39 # v2.90.3
with:
tool: cargo-nextest@0.9.137
fallback: none
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Vendored updater tests
run: cargo test -p tauri-plugin-updater --lib --locked
# The desktop test binary needs the WebView2 loader at run time, which
# hosted runners lack; the log-policy crate covers its Windows-only code.
# The native Work storage tests exercise real NTFS handles and process
# ownership; hosted runners' antivirus makes them flaky. The Work journal
# tests need a private namespace, which must be owned by the user, and the
# elevated runner creates directories owned by Administrators. Both run on
# the Windows QA machine instead.
- run: >-
cargo nextest run --workspace --exclude zephium-desktop --locked --profile ci --retries 2 --no-fail-fast
-E 'not (test(/^platform::windows::native_storage::work::tests::/)
or (package(zephium-store) and test(/^(hub::agent_work|actor::tests::work_journal_|hub::work_document::runtime_store::tests::approved_deadline_)/)))'
- name: Report flaky tests
if: ${{ !cancelled() }}
shell: bash
run: python scripts/ci/flaky-summary.py target/nextest/ci/junit.xml
- run: cargo test --locked --manifest-path desktop/windows-log-tests/Cargo.toml