-
Notifications
You must be signed in to change notification settings - Fork 0
377 lines (367 loc) · 13.7 KB
/
checks.yaml
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
name: checks
permissions:
contents: read
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches-ignore:
- 'release/**'
schedule:
- cron: '0 4 * * *'
merge_group:
branches:
- main
jobs:
build:
name: Build and test
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- rust: stable
os: ubuntu-latest
features: ""
target: "x86_64-unknown-linux-gnu"
- rust: msrv
os: ubuntu-latest
features: ""
target: "x86_64-unknown-linux-gnu"
- rust: beta
os: ubuntu-latest
features: ""
target: "x86_64-unknown-linux-gnu"
# - rust: "stable"
# os: macos-latest
# features: ""
# target: "x86_64-apple-darwin"
# - rust: "stable"
# os: macos-14
# features: ""
# target: "aarch64-apple-darwin"
# - rust: stable-x86_64-gnu
# os: windows-2022
# features: ""
# target: "x86_64-pc-windows-gnu"
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
submodules: true
- name: Set target rust version
run: echo "TARGET_RUST_VERSION=$(if [ "${{matrix.rust}}" = "msrv" ]; then grep rust-version Cargo.toml | grep MSRV | cut -d'"' -f2; else echo "${{matrix.rust}}"; fi)" >> $GITHUB_ENV
if: matrix.os != 'windows-2022'
- name: Install toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: "${TARGET_RUST_VERSION}"
targets: "${{ matrix.target }}"
if: matrix.os != 'windows-2022'
- name: Install toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: "${{matrix.rust}}"
targets: "${{ matrix.target }}"
if: matrix.os == 'windows-2022'
- name: target
run: "rustc -vV | sed -n 's|host: ||p'"
if: matrix.os != 'windows-2022'
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
with:
tool: cargo-llvm-cov
- name: Install cargo-nextest
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
with:
tool: cargo-nextest
- name: cargo build
run: cargo build --target ${{matrix.target}} ${{ matrix.features }}
- name: cargo build (no_std)
run: cargo rustc --target ${{matrix.target}} -p libbzip2-rs-sys --lib --no-default-features --crate-type rlib
env:
RUSTFLAGS: -Aunused_variables -Aunused_assignments
- name: cargo nextest # reports segfaults in a helpful way
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }} --no-fail-fast --workspace
env:
RUST_BACKTRACE: 1
- name: cargo test with llvm-cov
run: cargo llvm-cov --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info --ignore-filename-regex "test-libbzip2" --workspace
env:
RUST_BACKTRACE: 1
if: matrix.os != 'windows-2022'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
if: matrix.os != 'windows-2022'
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
slug: codecov/codecov-demo
build-qemu:
name: QEMU build & test
runs-on: "${{ matrix.os }}"
strategy:
matrix:
include:
- rust: stable
os: ubuntu-latest
features: ""
target: "s390x-unknown-linux-gnu"
gcc: "s390x-linux-gnu-gcc"
runner: "qemu-s390x -L /usr/s390x-linux-gnu"
- rust: stable
os: ubuntu-latest
features: ""
target: "i686-unknown-linux-gnu"
gcc: "i686-linux-gnu-gcc"
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
submodules: true
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: qemu-user qemu-user-static qemu-system-s390x gcc-s390x-linux-gnu gcc-i686-linux-gnu g++-s390x-linux-gnu
version: 1.0
- name: Copy QEMU Cargo Config
run: |
mkdir -p .cargo
cp qemu-cargo-config.toml .cargo/config.toml
- name: Install toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: "stable"
targets: "${{ matrix.target }}"
- name: target
run: "rustc -vV | sed -n 's|host: ||p'"
- name: Install cargo-nextest
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
with:
tool: cargo-nextest
- name: cargo build
run: cargo build --target ${{matrix.target}} ${{ matrix.features }}
- name: cargo nextest # reports segfaults in a helpful way
run: RUNNER="${{ matrix.runner }}" cargo nextest run --target ${{matrix.target}} ${{ matrix.features }}
env:
RUST_BACKTRACE: 1
CC: ${{matrix.gcc}}
clippy:
name: Clippy
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
features:
- ""
- '--no-default-features --features="c-allocator"'
- '--no-default-features --features="rust-allocator"'
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
submodules: true
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: stable
components: clippy
targets: ${{matrix.target}}
- name: Rust cache
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8
with:
shared-key: "stable-${{matrix.target}}"
- name: Run clippy
run: cargo clippy --target ${{matrix.target}} --workspace --all-targets -- -D warnings
- name: Run clippy (fuzzers)
run: cargo clippy --target ${{matrix.target}} --manifest-path ./fuzz/Cargo.toml --all-targets -- -D warnings
if: ${{matrix.fuzzer}}
# fuzz:
# name: Smoke-test fuzzing targets
# runs-on: ubuntu-20.04
# strategy:
# matrix:
# features:
# - 'default'
# - 'c-allocator'
# - 'rust-allocator'
# steps:
# - name: Checkout sources
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
# with:
# persist-credentials: false
# submodules: true
# - name: Install nightly toolchain
# uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
# with:
# toolchain: nightly
# - name: Install cargo fuzz
# uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
# with:
# tool: cargo-fuzz
# - name: Smoke-test fuzz targets
# run: |
# cargo fuzz build --no-default-features --features="${{ matrix.features }}"
# for target in $(cargo fuzz list); do
# if [ "$target" = "uncompress2" ]; then
# features="${{ matrix.features }} disable-checksum"
# else
# features="${{ matrix.features }}"
# fi
# RUST_BACKTRACE=1 cargo fuzz run --no-default-features --features="$features" $target -- -max_total_time=10
# done
# fuzz-aarch64:
# name: Smoke-test fuzzing targets
# runs-on: macos-14
# strategy:
# matrix:
# include:
# - rust: "stable"
# os: macos-14
# features: ""
# target: "aarch64-apple-darwin"
# steps:
# - name: Checkout sources
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
# with:
# persist-credentials: false
# submodules: true
# - name: Install nightly toolchain
# uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
# with:
# toolchain: nightly
# - name: Install cargo fuzz
# uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
# with:
# tool: cargo-fuzz
# - name: Smoke-test fuzz targets
# run: |
# cargo fuzz build --no-default-features --features="${{ matrix.features }}"
# for target in $(cargo fuzz list); do
# if [ "$target" = "uncompress2" ]; then
# features="${{ matrix.features }} disable-checksum"
# else
# features="${{ matrix.features }}"
# fi
# RUST_BACKTRACE=1 cargo fuzz run --no-default-features --features="$features" $target -- -max_total_time=10
# done
#
# link-c-dynamic-library:
# name: dynamic library
# strategy:
# matrix:
# include:
# - target: x86_64-unknown-linux-gnu
# features:
# - ''
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
# with:
# persist-credentials: false
# submodules: true
# - name: Install rust toolchain
# uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
# with:
# toolchain: stable
# targets: ${{matrix.target}}
# - name: "cdylib: default settings"
# working-directory: libz-rs-sys-cdylib
# env:
# LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps"
# run: |
# cargo build --release --target ${{matrix.target}}
# cc -o zpipe zpipe.c target/${{matrix.target}}/release/deps/libz_rs.so
# ./zpipe < Cargo.toml | ./zpipe -d > out.txt
# cmp -s Cargo.toml out.txt
# - name: "cdylib: rust-allocator"
# env:
# LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps"
# working-directory: libz-rs-sys-cdylib
# run: |
# cargo build --release --target ${{matrix.target}} --no-default-features --features="rust-allocator"
# cc -o zpipe zpipe.c target/${{matrix.target}}/release/deps/libz_rs.so
# ./zpipe < Cargo.toml | ./zpipe -d > out.txt
# cmp -s Cargo.toml out.txt
# - name: "cdylib: no_std"
# env:
# LD_LIBRARY_PATH: "target/${{matrix.target}}/release/deps"
# working-directory: libz-rs-sys-cdylib
# run: |
# cargo build --release --target ${{matrix.target}} --no-default-features
# cc -o zpipe_no_std zpipe_no_std.c target/${{matrix.target}}/release/deps/libz_rs.so
# ./zpipe_no_std < Cargo.toml | ./zpipe_no_std -d > out.txt
# cmp -s Cargo.toml out.txt
# - name: "cdylib: custom-prefix"
# working-directory: libz-rs-sys-cdylib
# env:
# LIBZ_RS_SYS_PREFIX: "MY_CUSTOM_PREFIX_"
# run: |
# cargo build --release --target ${{matrix.target}} --features=custom-prefix
# objdump -tT target/${{matrix.target}}/release/deps/libz_rs.so | grep -q "MY_CUSTOM_PREFIX_uncompress" || (echo "symbol not found!" && exit 1)
wasm32:
name: "wasm32"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
submodules: true
- name: Install wasmtime
run: curl https://wasmtime.dev/install.sh -sSf | bash
- name: Copy .cargo/config.toml
run: |
mkdir -p .cargo
cp qemu-cargo-config.toml .cargo/config.toml
- name: Install toolchain
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: "stable"
targets: "wasm32-wasip1"
- name: target
run: "rustc -vV | sed -n 's|host: ||p'"
- name: Install cargo-nextest
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
with:
tool: cargo-nextest
- name: Download wasi-sdk
run: |
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.tar.gz | tar xz
- name: cargo nextest (without SIMD)
run: |
export CC="$(pwd)/wasi-sdk-24.0-x86_64-linux/bin/clang"
export CFLAGS="-target wasm32-wasip1"
cargo nextest run -p libbzip2-rs-sys -p test-libbzip2-rs-sys --target wasm32-wasip1 \
-- --skip high_level_write --skip open_and_close # These tests use temp_dir
env:
RUST_BACKTRACE: 1
RUSTFLAGS: ""
miri:
name: "Miri"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
persist-credentials: false
submodules: true
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
cargo +nightly miri setup
- name: Install cargo-nextest
uses: taiki-e/install-action@56ab7930c591507f833cbaed864d201386d518a8
with:
tool: cargo-nextest
- name: Test public C api with miri
run: |
cargo +nightly miri nextest run -j4 -p test-libbzip2-rs-sys miri_
- name: Run unit tests with miri
run: "cargo +nightly miri nextest run -j4 -p libbzip2-rs-sys"