Skip to content

Commit e3bb2fd

Browse files
committed
Move more jobs into reusable workflow
1 parent 1f3a7f9 commit e3bb2fd

File tree

2 files changed

+41
-24
lines changed

2 files changed

+41
-24
lines changed

.github/workflows/base.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,29 @@ name: Rust CI
33
on:
44
workflow_call:
55
inputs:
6+
# What MSRV to use for the tests.
67
msrv:
78
required: true
89
type: string
10+
11+
# The list of feature combinations to test, as a JSON array.
912
features:
1013
required: false
1114
type: string
1215
default: '["default"]'
1316

17+
# Whether to build cargo-fuzz targets.
18+
cargo-fuzz:
19+
required: false
20+
type: boolean
21+
default: false
22+
23+
# An optional extra feature to enable for benchmarks.
24+
benchmark-feature:
25+
required: false
26+
type: string
27+
default: ""
28+
1429
jobs:
1530
test_features:
1631
runs-on: ubuntu-latest
@@ -152,3 +167,27 @@ jobs:
152167
with:
153168
feature-group: default-features
154169
release-type: minor
170+
171+
build_benchmarks:
172+
runs-on: ubuntu-latest
173+
steps:
174+
- uses: actions/checkout@v4
175+
- uses: dtolnay/rust-toolchain@nightly
176+
- name: build
177+
run: cargo build -v --benches --features="${{ inputs.benchmarks-feature }}"
178+
179+
build_fuzz_cargo-fuzz:
180+
name: "Fuzz targets (cargo-fuzz)"
181+
runs-on: ubuntu-latest
182+
if: ${{ inputs.cargo-fuzz == 'true' }}
183+
steps:
184+
- uses: actions/checkout@v4
185+
- uses: dtolnay/rust-toolchain@nightly
186+
- name: Install cargo-fuzz
187+
uses: baptiste0928/cargo-install@v3
188+
with:
189+
crate: cargo-fuzz
190+
- name: check
191+
run: cargo fuzz check
192+
env:
193+
CARGO_INCREMENTAL: 0

.github/workflows/rust.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
with:
1515
msrv: '1.70.0'
1616
features: '["", "default", "rayon", "avif", "bmp", "dds", "exr", "ff", "gif", "hdr", "ico", "jpeg", "png", "pnm", "qoi", "tga", "tiff", "webp"]'
17+
cargo-fuzz: true
18+
benchmark-feature: 'benchmarks'
1719

1820
test_avif_decoding:
1921
runs-on: ubuntu-latest
@@ -53,21 +55,6 @@ jobs:
5355
env:
5456
RUSTFLAGS: ""
5557

56-
build_fuzz_cargo-fuzz:
57-
name: "Fuzz targets (cargo-fuzz)"
58-
runs-on: ubuntu-latest
59-
steps:
60-
- uses: actions/checkout@v4
61-
- uses: dtolnay/rust-toolchain@nightly
62-
- name: Install cargo-fuzz
63-
uses: baptiste0928/cargo-install@v3
64-
with:
65-
crate: cargo-fuzz
66-
- name: check
67-
run: cargo fuzz check
68-
env:
69-
CARGO_INCREMENTAL: 0
70-
7158
public_private_dependencies:
7259
runs-on: ubuntu-latest
7360
steps:
@@ -85,12 +72,3 @@ jobs:
8572
sed -i 's/num-traits = { ver/num-traits = { public = true, ver/' Cargo.toml
8673
# cargo +nightly check
8774
cargo check
88-
89-
build_benchmarks:
90-
runs-on: ubuntu-latest
91-
steps:
92-
- uses: actions/checkout@v4
93-
- uses: dtolnay/rust-toolchain@nightly
94-
- name: build
95-
run: cargo build -v --benches --features=benchmarks
96-

0 commit comments

Comments
 (0)