Skip to content

Commit 39602cf

Browse files
committed
adopt zlib/zstd ci improvements
1 parent d27cbb2 commit 39602cf

File tree

3 files changed

+83
-142
lines changed

3 files changed

+83
-142
lines changed

.github/workflows/checks.yaml

Lines changed: 82 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -21,67 +21,109 @@ jobs:
2121
build:
2222
name: Build and test
2323
runs-on: "${{ matrix.os }}"
24+
env:
25+
RUST_BACKTRACE: 1
26+
# i686-unknown-linux-gnu
27+
CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER: i686-linux-gnu-gcc
28+
# s390x-unknown-linux-gnu
29+
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER: s390x-linux-gnu-gcc
30+
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER: qemu-s390x -L /usr/s390x-linux-gnu
31+
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUSTFLAGS: "-C target-feature=+crt-static"
32+
# wasm32-wasip1 (std for wasip2 is unstable)
33+
WASI_SDK_PATH: /tmp/wasi-sdk-24.0-x86_64-linux
34+
CC_wasm32_wasip1: /tmp/wasi-sdk-24.0-x86_64-linux/bin/clang
35+
AR_wasm32_wasip1: /tmp/wasi-sdk-24.0-x86_64-linux/bin/llvm-ar
36+
CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime --dir ../tests"
37+
CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS: "-Ctarget-feature=+simd128"
2438
strategy:
2539
matrix:
2640
include:
2741
- rust: stable
28-
os: ubuntu-latest
29-
features: ""
3042
target: "x86_64-unknown-linux-gnu"
31-
- rust: msrv
3243
os: ubuntu-latest
33-
features: ""
44+
codecov: true
45+
46+
- rust: msrv
3447
target: "x86_64-unknown-linux-gnu"
35-
- rust: beta
3648
os: ubuntu-latest
37-
features: ""
49+
codecov: false
50+
51+
- rust: beta
3852
target: "x86_64-unknown-linux-gnu"
39-
- rust: "stable"
53+
os: ubuntu-latest
54+
codecov: false
55+
56+
- target: "aarch64-unknown-linux-gnu"
57+
os: ubuntu-24.04-arm
58+
codecov: true
59+
60+
- target: "i686-unknown-linux-gnu"
61+
os: ubuntu-latest
62+
codecov: true
63+
packages: gcc-i686-linux-gnu
64+
65+
- target: "s390x-unknown-linux-gnu"
66+
os: ubuntu-latest
67+
codecov: false
68+
packages: gcc-s390x-linux-gnu qemu-user qemu-user-static libc6-dev-s390x-cross
69+
70+
- target: "wasm32-wasip1"
71+
os: ubuntu-latest
72+
flags: "-p libbz2-rs-sys -p test-libbz2-rs-sys"
73+
codecov: false
74+
75+
- target: "x86_64-apple-darwin"
4076
os: macos-latest
41-
features: ""
42-
target: "x86_64-apple-darwin"
43-
- rust: "stable"
77+
codecov: true
78+
79+
- target: "aarch64-apple-darwin"
4480
os: macos-14
45-
features: ""
46-
target: "aarch64-apple-darwin"
47-
- rust: stable-x86_64-gnu
48-
os: windows-2022
49-
features: ""
50-
target: "x86_64-pc-windows-gnu"
51-
- rust: stable-x86_64-msvc
81+
codecov: true
82+
83+
- target: "x86_64-pc-windows-gnu"
5284
os: windows-2022
53-
features: ""
54-
target: "x86_64-pc-windows-msvc"
85+
codecov: false
86+
87+
- target: "aarch64-pc-windows-msvc"
88+
os: windows-11-arm
89+
codecov: false
5590
steps:
5691
- name: Checkout sources
5792
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
5893
with:
5994
persist-credentials: false
6095
submodules: true
96+
97+
# Install the correct rust toolchain/version
6198
- name: Set target rust version
62-
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
63-
if: matrix.os != 'windows-2022'
99+
run: echo "MSRV=$(grep rust-version Cargo.toml | grep MSRV | awk -F '\"' '{print $2}')" >> $GITHUB_ENV
100+
if: ${{ matrix.rust == 'msrv' }}
64101
- name: Install toolchain
65102
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
66103
with:
67-
toolchain: "${TARGET_RUST_VERSION}"
104+
toolchain: ${{ env.MSRV || matrix.rust || 'stable' }}
68105
targets: "${{ matrix.target }}"
69-
if: matrix.os != 'windows-2022'
70-
- name: Install toolchain
71-
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
72-
with:
73-
toolchain: "${{matrix.rust}}"
74-
targets: "${{ matrix.target }}"
75-
if: matrix.os == 'windows-2022'
76-
- name: target
77-
run: "rustc -vV | sed -n 's|host: ||p'"
78-
if: matrix.os != 'windows-2022'
106+
107+
# Install dependencies
79108
- name: Install cargo-llvm-cov & cargo-nextest
80109
uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2
81110
with:
82111
tool: cargo-llvm-cov,cargo-nextest
112+
- name: Cache apt packages
113+
if: matrix.packages != ''
114+
uses: awalsh128/cache-apt-pkgs-action@v1
115+
with:
116+
packages: "${{ matrix.packages }}"
117+
version: 2
118+
- name: Download wasmtime & wasi-sdk
119+
if: ${{ contains(matrix.target, 'wasm') }}
120+
run: |
121+
curl https://wasmtime.dev/install.sh -sSf | bash
122+
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
123+
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.tar.gz | tar xz --directory /tmp
124+
83125
- name: cargo build
84-
run: cargo build --target ${{matrix.target}} ${{ matrix.features }}
126+
run: cargo build --target ${{matrix.target}} ${{ matrix.flags }}
85127
- name: cargo build (no_std)
86128
run: cargo rustc --target ${{matrix.target}} -p libbz2-rs-sys --lib --no-default-features --crate-type rlib
87129
env:
@@ -90,19 +132,17 @@ jobs:
90132
run: cargo rustc --target ${{matrix.target}} -p libbz2-rs-sys --lib --no-default-features --features rust-allocator --crate-type rlib
91133
env:
92134
RUSTFLAGS: -Aunused_variables -Aunused_assignments
135+
93136
- name: cargo llvm-cov nextest
94-
if: matrix.os != 'windows-2022'
95-
run: cargo llvm-cov nextest --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info --ignore-filename-regex "test-libbz2" --workspace
96-
env:
97-
RUST_BACKTRACE: 1
137+
if: matrix.codecov
138+
run: cargo llvm-cov nextest --lcov --output-path lcov.info --ignore-filename-regex "test-libz|dynamic-libz" --target ${{matrix.target}} ${{ matrix.flags }} --no-fail-fast
98139
- name: cargo nextest
99-
if: matrix.os == 'windows-2022'
100-
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.features }} --no-fail-fast
101-
env:
102-
RUST_BACKTRACE: 1
140+
if: matrix.codecov == false
141+
run: cargo nextest run --target ${{matrix.target}} ${{ matrix.flags }} --no-fail-fast
142+
103143
- name: Upload coverage to Codecov
104144
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
105-
if: matrix.os != 'windows-2022' && matrix.rust == 'stable'
145+
if: matrix.codecov
106146
with:
107147
files: ./lcov.info
108148
fail_ci_if_error: false
@@ -111,56 +151,6 @@ jobs:
111151
name: test
112152
verbose: true
113153

114-
build-qemu:
115-
name: QEMU build & test
116-
runs-on: "${{ matrix.os }}"
117-
strategy:
118-
matrix:
119-
include:
120-
- rust: stable
121-
os: ubuntu-latest
122-
features: ""
123-
target: "s390x-unknown-linux-gnu"
124-
gcc: "s390x-linux-gnu-gcc"
125-
runner: "qemu-s390x -L /usr/s390x-linux-gnu"
126-
- rust: stable
127-
os: ubuntu-latest
128-
features: ""
129-
target: "i686-unknown-linux-gnu"
130-
gcc: "i686-linux-gnu-gcc"
131-
steps:
132-
- name: Checkout sources
133-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
134-
with:
135-
persist-credentials: false
136-
submodules: true
137-
- uses: awalsh128/cache-apt-pkgs-action@latest
138-
with:
139-
packages: qemu-user qemu-user-static qemu-system-s390x gcc-s390x-linux-gnu gcc-i686-linux-gnu g++-s390x-linux-gnu
140-
version: 1.0
141-
- name: Copy QEMU Cargo Config
142-
run: |
143-
mkdir -p .cargo
144-
cp qemu-cargo-config.toml .cargo/config.toml
145-
- name: Install toolchain
146-
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
147-
with:
148-
toolchain: "stable"
149-
targets: "${{ matrix.target }}"
150-
- name: target
151-
run: "rustc -vV | sed -n 's|host: ||p'"
152-
- name: Install cargo-nextest
153-
uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2
154-
with:
155-
tool: cargo-nextest
156-
- name: cargo build
157-
run: cargo build --target ${{matrix.target}} ${{ matrix.features }}
158-
- name: cargo nextest # reports segfaults in a helpful way
159-
run: RUNNER="${{ matrix.runner }}" cargo nextest run --target ${{matrix.target}} ${{ matrix.features }}
160-
env:
161-
RUST_BACKTRACE: 1
162-
CC: ${{matrix.gcc}}
163-
164154
clippy:
165155
name: Clippy
166156
strategy:
@@ -291,45 +281,6 @@ jobs:
291281
token: ${{ secrets.CODECOV_TOKEN }}
292282
name: fuzz
293283

294-
wasm32:
295-
name: "wasm32"
296-
runs-on: ubuntu-latest
297-
steps:
298-
- name: Checkout sources
299-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
300-
with:
301-
persist-credentials: false
302-
submodules: true
303-
- name: Install wasmtime
304-
run: curl https://wasmtime.dev/install.sh -sSf | bash
305-
- name: Copy .cargo/config.toml
306-
run: |
307-
mkdir -p .cargo
308-
cp qemu-cargo-config.toml .cargo/config.toml
309-
- name: Install toolchain
310-
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
311-
with:
312-
toolchain: "stable"
313-
targets: "wasm32-wasip1"
314-
- name: target
315-
run: "rustc -vV | sed -n 's|host: ||p'"
316-
- name: Install cargo-nextest
317-
uses: taiki-e/install-action@d12e869b89167df346dd0ff65da342d1fb1202fb # v2.53.2
318-
with:
319-
tool: cargo-nextest
320-
- name: Download wasi-sdk
321-
run: |
322-
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.tar.gz | tar xz
323-
- name: cargo nextest (without SIMD)
324-
run: |
325-
export CC="$(pwd)/wasi-sdk-24.0-x86_64-linux/bin/clang"
326-
export CFLAGS="-target wasm32-wasip1"
327-
cargo nextest run -p libbz2-rs-sys -p test-libbz2-rs-sys --target wasm32-wasip1 \
328-
-- --skip high_level_write --skip open_and_close # These tests use temp_dir
329-
env:
330-
RUST_BACKTRACE: 1
331-
RUSTFLAGS: ""
332-
333284
miri:
334285
name: "Miri"
335286
runs-on: ubuntu-latest

qemu-cargo-config.toml

Lines changed: 0 additions & 11 deletions
This file was deleted.

test-libbz2-rs-sys/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,7 @@ mod high_level_interface {
13161316
}
13171317

13181318
#[test]
1319+
#[cfg_attr(target_family = "wasm", ignore = "no file system on wasm")]
13191320
fn high_level_write() {
13201321
use libbz2_rs_sys::*;
13211322

0 commit comments

Comments
 (0)