-
Notifications
You must be signed in to change notification settings - Fork 13
292 lines (252 loc) · 10.2 KB
/
ci.yml
File metadata and controls
292 lines (252 loc) · 10.2 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
FIXTURE_COMPILER_IMAGE: ghcr.io/swananan/ghostscope-fixture-compiler@sha256:b1e716ec17610673dcaf69497bd93ef0c700a2ad7fe8265d6764d15a8c1edc89
FIXTURE_COMPILER_CACHE_REV: b1e716ec17610673dcaf69497bd93ef0c700a2ad7fe8265d6764d15a8c1edc89
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.88.0
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
env:
LLVM_SYS_181_PREFIX: /usr/lib/llvm-18
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install LLVM 18 and Polly
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y llvm-18-dev libpolly-18-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.88.0
with:
components: clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ github.job }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-target-
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
test:
name: Test Suite
runs-on: ubuntu-latest
timeout-minutes: 30
env:
LLVM_SYS_181_PREFIX: /usr/lib/llvm-18
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install LLVM 18 and Polly
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y llvm-18-dev libpolly-18-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.88.0
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ github.job }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-target-
- name: Build test binaries
run: cargo test --no-run --all-features
- name: Build dwarf-tool (required by tests)
run: cargo build -p dwarf-tool
- name: Run workspace tests
run: cargo test --all-features
env:
RUST_BACKTRACE: 1
e2e:
name: Standard E2E
runs-on: ubuntu-latest
timeout-minutes: 90
env:
LLVM_SYS_181_PREFIX: /usr/lib/llvm-18
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install LLVM 18 and Polly
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y llvm-18-dev libpolly-18-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.88.0
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ github.job }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-target-
- name: Cache fixture binaries
id: fixture-cache
uses: actions/cache@v4
with:
path: |
e2e-tests/tests/fixtures/sample_program/sample_program
e2e-tests/tests/fixtures/sample_program/sample_program_o1
e2e-tests/tests/fixtures/sample_program/sample_program_o2
e2e-tests/tests/fixtures/sample_program/sample_program_o3
e2e-tests/tests/fixtures/sample_program/sample_program_stripped
e2e-tests/tests/fixtures/sample_program/sample_program_stripped.debug
e2e-tests/tests/fixtures/complex_types_program/complex_types_program
e2e-tests/tests/fixtures/complex_types_program/complex_types_program_o1
e2e-tests/tests/fixtures/complex_types_program/complex_types_program_o2
e2e-tests/tests/fixtures/complex_types_program/complex_types_program_o3
e2e-tests/tests/fixtures/complex_types_program/complex_types_program_nopie
e2e-tests/tests/fixtures/member_pointer_program/member_pointer_program
e2e-tests/tests/fixtures/member_pointer_program/member_pointer_program_o1
e2e-tests/tests/fixtures/member_pointer_program/member_pointer_program_o2
e2e-tests/tests/fixtures/member_pointer_program/member_pointer_program_o3
e2e-tests/tests/fixtures/globals_program/globals_program
e2e-tests/tests/fixtures/globals_program/libgvars.so
e2e-tests/tests/fixtures/late_globals_program/late_globals_program
e2e-tests/tests/fixtures/rust_global_program/target/debug/rust_global_program
e2e-tests/tests/fixtures/inline_callsite_program/inline_callsite_program
e2e-tests/tests/fixtures/inline_callsite_program/inline_callsite_program_clang_dwarf5
e2e-tests/tests/fixtures/inline_call_value_program/inline_call_value_program
e2e-tests/tests/fixtures/partitioned_ranges_program/partitioned_ranges_program
e2e-tests/tests/fixtures/cpp_complex_program/cpp_complex_program
e2e-tests/tests/fixtures/static_scope_program/static_scope_program
e2e-tests/tests/fixtures/static_scope_program/static_scope_program_clang_dwarf5
e2e-tests/tests/fixtures/entry_value_recovery_program/entry_value_recovery_program
e2e-tests/tests/fixtures/entry_value_recovery_program/entry_value_recovery_program_clang_dwarf5
key: ${{ runner.os }}-${{ github.job }}-fixtures-${{ env.FIXTURE_COMPILER_CACHE_REV }}-${{ hashFiles('e2e-tests/compile-fixtures.sh', 'e2e-tests/tests/fixtures/**/*.c', 'e2e-tests/tests/fixtures/**/*.h', 'e2e-tests/tests/fixtures/**/*.cpp', 'e2e-tests/tests/fixtures/**/*.rs', 'e2e-tests/tests/fixtures/**/Makefile', 'e2e-tests/tests/fixtures/**/Cargo.toml', 'e2e-tests/tests/fixtures/**/Cargo.lock') }}
- name: Compile fixtures with fixture compiler image
if: steps.fixture-cache.outputs.cache-hit != 'true'
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}/e2e-tests:/workspace/e2e-tests" \
-w /workspace/e2e-tests \
"$FIXTURE_COMPILER_IMAGE" \
bash ./compile-fixtures.sh
sudo chown -R "$(id -u):$(id -g)" "${GITHUB_WORKSPACE}/e2e-tests/tests/fixtures"
- name: Build GhostScope CLI and dwarf-tool
run: cargo build -p ghostscope -p dwarf-tool --all-features
- name: Run e2e
env:
GHOSTSCOPE_PRESERVE_PRECOMPILED_FIXTURES: 1
RUST_BACKTRACE: 1
run: sudo -E "$(which cargo)" test -p ghostscope-e2e-tests --tests --all-features -- --nocapture
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 30
env:
LLVM_SYS_181_PREFIX: /usr/lib/llvm-18
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install LLVM 18 and Polly
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y llvm-18-dev libpolly-18-dev
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.88.0
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-${{ github.job }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-target-
- name: Build debug
run: cargo build --all-features
- name: Verify embedded script help matches docs
run: |
tmpfile="$(mktemp)"
target/debug/ghostscope --script-help > "$tmpfile"
diff -u docs/scripting.md "$tmpfile"
- name: Build release
run: cargo build --release --all-features