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
name: CI
on:
push:
branches:
pull_request:
branches:
schedule:
# Weekly run so toolchain releases and new RustSec advisories surface
# even when nobody pushes.
- cron: "17 6 * * 1"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
check:
name: Check (${{ matrix.os }}, ${{ matrix.rust }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
rust:
env:
# rust-toolchain.toml pins the development toolchain, and rustup gives
# that file precedence over `rustup default`. RUSTUP_TOOLCHAIN outranks
# the file, so each leg really builds with matrix.rust.
RUSTUP_TOOLCHAIN: ${{ matrix.rust }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy, rustfmt
- name: Verify toolchain
shell: bash
run: |
rustc --version
cargo --version
if [ "${{ matrix.rust }}" != "stable" ]; then
rustc --version | grep -F "rustc ${{ matrix.rust }}"
fi
- name: Cache
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Format
if: matrix.rust == 'stable'
run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo clippy --all-targets --no-default-features -- -D warnings
- run: cargo test --all-features
- run: cargo test
- run: cargo test --no-default-features
- name: Docs
if: matrix.rust == 'stable'
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: "-D warnings"
features:
name: Feature combinations
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- "--no-default-features --features bytes"
- "--no-default-features --features memchr"
- "--features memchr"
- "--features bytes"
- "--features tokio-util"
- "--features asynchronous-codec"
env:
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-targets ${{ matrix.features }} -- -D warnings
- run: cargo test ${{ matrix.features }}
no-std:
name: no_std and wasm builds
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv7em-none-eabihf, wasm32-unknown-unknown
- run: cargo build --no-default-features --target thumbv7em-none-eabihf
- run: cargo build --no-default-features --features memchr,bytes --target thumbv7em-none-eabihf
- run: cargo build --no-default-features --target wasm32-unknown-unknown
- name: MSRV no_std build
run: |
rustup toolchain install 1.85.0 --profile minimal --target thumbv7em-none-eabihf
cargo +1.85.0 build --no-default-features --target thumbv7em-none-eabihf
thirty-two-bit:
name: 32-bit (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: i686-pc-windows-msvc
- os: ubuntu-latest
target: i686-unknown-linux-gnu
runs-on: ${{ matrix.os }}
env:
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install 32-bit C runtime
if: matrix.target == 'i686-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-multilib
- run: cargo test --target ${{ matrix.target }} --all-features
- run: cargo test --target ${{ matrix.target }} --release
docs-rs:
name: docs.rs build
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: nightly
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@nightly
- run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: "--cfg docsrs -D warnings"
fuzz:
name: Fuzz smoke test
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: nightly
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@v2
with:
tool: cargo-fuzz
- name: Run every target for 30 seconds
# The prebuilt cargo-fuzz binary is a musl build and would default to
# its own target triple; fuzz against the runner's glibc target.
run: |
for target in $(cargo fuzz list); do
cargo fuzz run --target x86_64-unknown-linux-gnu "$target" -- -max_total_time=30
done
semver:
name: Semver check
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: obi1kenobi/cargo-semver-checks-action@v2
supply-chain:
name: Supply chain
runs-on: ubuntu-latest
env:
# The audit action installs cargo-audit from source; build it with the
# latest stable rather than the pinned development toolchain.
RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- name: cargo audit
uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: cargo deny
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
arguments: --all-features