1+ name : checks
2+
3+ permissions :
4+ contents : read
5+
6+ on :
7+ push :
8+ branches :
9+ - ' release/**'
10+ pull_request :
11+ branches-ignore :
12+ - ' release/**'
13+ schedule :
14+ - cron : ' 0 4 * * *'
15+ merge_group :
16+ types : [checks_requested]
17+ workflow_call : {}
18+
19+ jobs :
20+ build :
21+ name : Build and test
22+ runs-on : " ${{ matrix.os }}"
23+ strategy :
24+ matrix :
25+ include :
26+ - rust : stable
27+ os : ubuntu-latest
28+ target : " x86_64-unknown-linux-gnu"
29+ - rust : beta
30+ os : ubuntu-latest
31+ target : " x86_64-unknown-linux-gnu"
32+ - rust : " msrv"
33+ os : ubuntu-latest
34+ target : " x86_64-unknown-linux-gnu"
35+ - rust : " stable"
36+ os : ubuntu-latest
37+ target : " x86_64-unknown-linux-musl"
38+ - rust : " stable"
39+ os : macos-latest
40+ target : " aarch64-apple-darwin"
41+ steps :
42+ - name : Checkout sources
43+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
44+ with :
45+ persist-credentials : false
46+ - name : Set target rust version
47+ 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
48+ - name : Install nightly toolchain for direct-minimal-versions
49+ uses : dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0
50+ with :
51+ toolchain : nightly
52+ targets : " ${{ matrix.target }}"
53+ if : ${{ matrix.rust == 'msrv' }}
54+ - name : Install toolchain
55+ uses : dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0
56+ with :
57+ toolchain : " ${TARGET_RUST_VERSION}"
58+ targets : " ${{ matrix.target }}"
59+ - name : Downgrade direct dependencies to minimal versions
60+ run : cargo +nightly update -Z direct-minimal-versions
61+ if : ${{ matrix.rust == 'msrv' }}
62+ - name : Install cross-compilation tools
63+ uses : taiki-e/setup-cross-toolchain-action@0123528f956f923e7a476f4cc04882bc005e7c89
64+ with :
65+ target : ${{ matrix.target }}
66+ - name : Install cargo-llvm-cov
67+ uses : taiki-e/install-action@ab3728c7ba6948b9b429627f4d55a68842b27f18
68+ with :
69+ tool : cargo-llvm-cov
70+ - name : Rust cache
71+ uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
72+ with :
73+ shared-key : " ${{matrix.rust}}-${{matrix.target}}"
74+ - name : cargo build
75+ run : cargo build
76+ - name : cargo test
77+ run : cargo llvm-cov --target ${{matrix.target}} --lcov --output-path lcov.info
78+ env :
79+ RUST_BACKTRACE : 1
80+ - name : Upload coverage to Codecov
81+ uses : codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d
82+ with :
83+ files : lcov.info
84+ token : ${{ secrets.CODECOV_TOKEN }}
85+ fail_ci_if_error : false
86+
87+ unused :
88+ name : Check unused dependencies
89+ runs-on : ubuntu-latest
90+ steps :
91+ - name : Checkout sources
92+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
93+ with :
94+ persist-credentials : false
95+ - name : Install nightly toolchain
96+ uses : dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0
97+ with :
98+ toolchain : nightly
99+ - name : Install udeps
100+ uses : taiki-e/install-action@ab3728c7ba6948b9b429627f4d55a68842b27f18
101+ with :
102+ tool : cargo-udeps
103+ - name : cargo udeps
104+ run : cargo udeps --workspace --all-targets
105+
106+ format :
107+ name : Format
108+ runs-on : ubuntu-latest
109+ steps :
110+ - name : Checkout sources
111+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
112+ with :
113+ persist-credentials : false
114+ - name : Install rust toolchain
115+ uses : dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0
116+ with :
117+ toolchain : stable
118+ components : rustfmt
119+ - name : Check formatting
120+ run : cargo fmt --all --check
121+
122+ clippy :
123+ name : Clippy
124+ strategy :
125+ matrix :
126+ include :
127+ - target : x86_64-unknown-linux-gnu
128+ runs_on : ubuntu-latest
129+ - target : armv7-unknown-linux-gnueabihf
130+ runs_on : ubuntu-latest
131+ - target : x86_64-unknown-linux-musl
132+ runs_on : ubuntu-latest
133+ - target : aarch64-apple-darwin
134+ runs_on : macos-latest
135+ runs-on : ${{matrix.runs_on}}
136+ steps :
137+ - name : Checkout sources
138+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
139+ with :
140+ persist-credentials : false
141+ - name : Install rust toolchain
142+ uses : dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0
143+ with :
144+ toolchain : stable
145+ components : clippy
146+ targets : ${{matrix.target}}
147+
148+ - name : Setup tools for cross compilation
149+ uses : awalsh128/cache-apt-pkgs-action@7ca5f46d061ad9aa95863cd9b214dd48edef361d # v1.5.0
150+ with :
151+ packages : musl-tools qemu-user-static crossbuild-essential-armhf crossbuild-essential-arm64 crossbuild-essential-i386
152+ version : 1
153+ if : ${{matrix.runs_on == 'ubuntu-latest'}}
154+
155+ - name : Install bindgen-cli
156+ uses : taiki-e/install-action@ab3728c7ba6948b9b429627f4d55a68842b27f18
157+ with :
158+ tool : bindgen-cli
159+ if : ${{matrix.runs_on == 'ubuntu-latest'}}
160+
161+ - name : Rust cache
162+ uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
163+ with :
164+ shared-key : " stable-${{matrix.target}}"
165+
166+ - name : Run clippy
167+ run : cargo clippy --target ${{matrix.target}} --all-targets
168+
169+ audit-dependencies :
170+ name : Audit dependencies
171+ runs-on : ubuntu-latest
172+ steps :
173+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
174+ - uses : EmbarkStudios/cargo-deny-action@34899fc7ba81ca6268d5947a7a16b4649013fea1
175+ with :
176+ arguments : --workspace --all-features
0 commit comments