-
Notifications
You must be signed in to change notification settings - Fork 25
271 lines (257 loc) · 9.97 KB
/
ci.yml
File metadata and controls
271 lines (257 loc) · 9.97 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
name: CI
on:
pull_request:
merge_group:
push:
branches: [main]
permissions:
contents: read
env:
STABLE_TOOLCHAIN: "1.94.1"
jobs:
fmt:
name: Cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: nightly
components: rustfmt
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo fmt --all -- --check
clippy:
name: Cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
components: clippy
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run clippy check
run: cargo clippy --all-targets --all-features -- -D warnings
env:
RUSTFLAGS: "--cfg tokio_unstable"
build:
name: Build (${{ matrix.os }}, ${{ matrix.toolchain }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
toolchain: ["1.94.1", nightly]
# aarch64 Linux exercises arch-specific unwind asm, PAC stripping,
# and ucontext layout that x86_64 Linux doesn't cover.
include:
- os: ubuntu-24.04-arm
toolchain: "1.94.1"
env:
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: ./.github/actions/rust-build
with:
toolchain: ${{ matrix.toolchain }}
save-if: ${{ github.ref == 'refs/heads/main' }}
feature-check:
name: Feature combinations
runs-on: ubuntu-latest
env:
RUSTFLAGS: "--cfg tokio_unstable"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- uses: taiki-e/install-action@184183c2401be73c3bf42c2e61268aa5855379c1 # v2
with:
tool: cargo-hack
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check each feature compiles
run: >
cargo hack check
--each-feature --no-dev-deps
--workspace
--exclude metrics-service
--exclude simple-local
--exclude-features _shuttle
check-docs:
name: Check docs.rs
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: nightly
components: rust-docs
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: sudo apt-get update && sudo apt-get install -y jq
- run: cargo install cargo-docs-rs
- run: ./scripts/check-docsrs.sh
trace-integrity:
name: Trace Integrity & Analysis
runs-on: ubuntu-latest
services:
dynamodb-local:
image: amazon/dynamodb-local
ports:
- 8000:8000
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- name: Enable perf_event_open and kallsyms for tests
run: |
sudo sysctl kernel.perf_event_paranoid=1
sudo sysctl kernel.kptr_restrict=0
- run: scripts/e2e-trace-tests.sh
asan:
name: AddressSanitizer (perf-self-profile)
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "--cfg tokio_unstable -Zsanitizer=address"
RUSTDOCFLAGS: "-Zsanitizer=address"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: nightly
components: rust-src
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Enable perf_event_open and kallsyms
run: |
sudo sysctl kernel.perf_event_paranoid=1
sudo sysctl kernel.kptr_restrict=0
- name: Run perf-self-profile tests under ASAN (perf path)
run: |
sudo prlimit --pid $$ --memlock=unlimited:unlimited
cargo test -p dial9-perf-self-profile --lib --all-features \
-Z build-std --target x86_64-unknown-linux-gnu
- name: Restrict perf_event_open to force ctimer path
run: sudo sysctl kernel.perf_event_paranoid=3
- name: Run perf-self-profile tests under ASAN (ctimer path)
# paranoid=3 blocks perf_event_open
# With paranoid=3, /proc/kallsyms shows zero kernel addresses on this runner
run: |
sudo prlimit --pid $$ --memlock=unlimited:unlimited
cargo test -p dial9-perf-self-profile --lib --all-features \
-Z build-std --target x86_64-unknown-linux-gnu \
-- --skip sys::linux::symbolize::tests::resolve_kernel_symbol_returns_name
ecs-sim:
name: ECS simulation (ctimer fallback)
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "--cfg tokio_unstable"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Restrict perf_event_open (simulate ECS/Fargate)
# paranoid=3 blocks perf_event_open to trigger the ctimer fallback path
run: sudo sysctl kernel.perf_event_paranoid=3
- name: Run perf-self-profile tests (auto-fallback path)
# With paranoid=3, /proc/kallsyms also shows zero kernel addresses on this runner
# (exact mechanism is kernel/distro specific), so resolve_kernel_symbol_returns_name fails.
# Kernel symbolization is also irrelevant to this path: frame-pointer unwinding only captures
# userspace addresses.
run: |
cargo test -p dial9-perf-self-profile --lib --all-features \
-- --skip sys::linux::symbolize::tests::resolve_kernel_symbol_returns_name
shuttle:
name: Shuttle tests
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "--cfg tokio_unstable --cfg shuttle"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Run shuttle tests
run: scripts/test-shuttle.sh
semver-checks:
name: Semver checks
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install cargo-semver-checks
uses: taiki-e/install-action@184183c2401be73c3bf42c2e61268aa5855379c1 # v2
with:
tool: cargo-semver-checks
- name: Check semver compliance
env:
RUSTFLAGS: "--cfg tokio_unstable"
run: |
cargo semver-checks \
-p dial9-trace-format-derive \
-p dial9-trace-format \
-p dial9-perf-self-profile \
-p dial9-macro \
-p dial9-tokio-telemetry \
-p dial9-viewer
package:
name: Cargo package
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ env.STABLE_TOOLCHAIN }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Verify all publishable crates package cleanly
env:
RUSTFLAGS: "--cfg tokio_unstable"
run: |
cargo package \
-p dial9-trace-format-derive \
-p dial9-trace-format \
-p dial9-perf-self-profile \
-p dial9-macro \
-p dial9-tokio-telemetry \
-p dial9-viewer
ci-pass:
name: CI Pass
runs-on: ubuntu-latest
needs: [fmt, clippy, build, feature-check, check-docs, trace-integrity, asan, ecs-sim, shuttle, package]
if: always()
steps:
- run: |
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more required jobs failed or were cancelled"
exit 1
fi