Repository navigation
180 lines (152 loc) · 5.93 KB
/
Copy pathci.yml
File metadata and controls
180 lines (152 loc) · 5.93 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
name: CI
on:
push:
branches: [master, main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Format
run: cargo fmt --all --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- name: Clippy
env:
CARGO_BUILD_WARNINGS: deny
run: cargo clippy --locked --workspace --all-targets --all-features
# The Plugin ships as a dynamic library for each platform, so the tests,
# the structural checks among them, and its release build run on all
# three.
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
# The tests start servers and wait on timeouts, so one that hangs
# fails the job in minutes.
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install cargo-nextest
uses: taiki-e/install-action@4dc1969decfa71b34f25aa7f3dd4656654d9ad1e # nextest
- name: Cache cargo
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- name: Test
run: cargo nextest run --locked --workspace --all-features
- name: Build the library Plugin
run: cargo build --locked -p plugin-web --release
# A Host finds the Plugin by this one symbol, and a build without
# the `dll` feature would still write a library, with no export.
- name: The library exports runvil_plugin
if: runner.os == 'Linux'
run: nm -D --defined-only target/release/libplugin_web.so | grep -qw runvil_plugin
# The example loads the built library and fetches a page with it.
# It needs the network, so it is run by hand and only built here.
- name: Build the example
run: cargo build --locked -p plugin-web --release --example load-dll
# No build or test step may write into the repository; catch a
# regression here rather than in a diff.
- name: Clean tree
shell: bash
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "the build dirtied the repository:"
git status --porcelain
exit 1
fi
docs:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
# Almost every item is private, so rustdoc checks their docs only
# with `--document-private-items`.
- name: Docs
run: cargo doc --locked --workspace --no-deps --all-features --document-private-items
supply-chain:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2
with:
tool: cargo-deny, cargo-audit
- name: cargo deny
run: cargo deny check
- name: cargo audit
run: cargo audit
# The library Plugin links exactly one rustls crypto backend,
# aws-lc-rs. This fails when `ring` enters the workspace's
# normal-edge graph (through a reqwest bump) and when `cargo tree`
# itself cannot run. It passes when `ring` is outside that graph,
# and when the lockfile does not hold it at all.
- name: One rustls crypto backend
shell: bash
run: |
set -euo pipefail
if ! out="$(cargo tree --locked --workspace -e normal -i ring --depth 0 2>&1)"; then
if printf '%s\n' "$out" | grep -q 'did not match any packages'; then
echo "ring is not in the lockfile"
exit 0
fi
echo "cargo tree failed:"
printf '%s\n' "$out"
exit 1
fi
if printf '%s\n' "$out" | grep -v '^warning: nothing to print' | grep -q '^ring v'; then
echo "ring is in the workspace's normal dependency graph; aws-lc-rs is the only permitted rustls backend"
printf '%s\n' "$out"
exit 1
fi
# The custom lints, the dylint library in cppalliance/dylints at the
# rev the root Cargo.toml's [workspace.metadata.dylint] pins. `cargo
# dylint` fetches it and builds it on the nightly in its
# rust-toolchain.toml, which rustup installs with that file's components;
# the date is never repeated here. Its UI tests run in its own CI.
# It runs on 24.04: the prebuilt cargo-dylint and dylint-link binaries
# need glibc 2.38 or later.
dylint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# The same release as the `dylint_linting` the library depends on.
- name: Install cargo-dylint and dylint-link
uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2
with:
tool: cargo-dylint@6.3.2, dylint-link@6.3.2
- name: Cache cargo
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- name: Dylint
run: cargo dylint --all -- --locked --workspace --all-targets --all-features
# Single required status check for branch protection: it fails when any
# job fails or is cancelled, so a cancelled job cannot read as green.
# needs: is a static list, so every newly added job must be added to it
# or that job bypasses this gate.
ci-green:
runs-on: ubuntu-latest
needs: [fmt, clippy, test, docs, supply-chain, dylint]
if: always()
steps:
- name: Verify every job succeeded
shell: bash
run: |
status=0
for result in ${{ join(needs.*.result, ' ') }}; do
if [ "$result" != "success" ]; then
echo "a required job did not succeed: $result"
status=1
fi
done
exit $status