Skip to content

Commit 3602c57

Browse files
authored
Improve CI (#93)
1 parent ddbfcd2 commit 3602c57

File tree

8 files changed

+144
-81
lines changed

8 files changed

+144
-81
lines changed

.github/workflows/audit.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
name: Audit
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
616
audit:
@@ -9,17 +19,10 @@ jobs:
919
runs-on: ubuntu-latest
1020

1121
steps:
12-
- name: Cache cargo-audit
13-
uses: actions/cache@v3
14-
with:
15-
path: |
16-
~/.cargo/.crates.toml
17-
~/.cargo/.crates2.json
18-
~/.cargo/bin/cargo-audit
19-
key: cargo-audit
20-
- name: Install cargo-audit
21-
run: cargo install cargo-audit
2222
- name: Checkout
2323
uses: actions/checkout@v4
24+
- uses: taiki-e/install-action@v2
25+
with:
26+
tool: cargo-audit
2427
- name: Run Audit
2528
run: cargo audit -D warnings

.github/workflows/format.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
name: Format
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
616
rustfmt:
@@ -9,33 +19,25 @@ jobs:
919
runs-on: ubuntu-latest
1020

1121
steps:
12-
- name: Update Rust
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
- name: Install Rust nightly
1325
run: |
1426
rustup toolchain install nightly --profile minimal --component rustfmt --allow-downgrade
1527
rustup default nightly
16-
- name: Checkout
17-
uses: actions/checkout@v4
1828
- name: Run Rustfmt
19-
run:
20-
cargo fmt --check
29+
run: cargo fmt --check
2130

2231
taplo:
2332
name: Taplo
2433

2534
runs-on: ubuntu-latest
2635

2736
steps:
28-
- name: Cache Taplo
29-
uses: actions/cache@v3
30-
with:
31-
path: |
32-
~/.cargo/.crates.toml
33-
~/.cargo/.crates2.json
34-
~/.cargo/bin/taplo
35-
key: taplo
36-
- name: Install Taplo
37-
run: cargo install taplo-cli
3837
- name: Checkout
3938
uses: actions/checkout@v4
39+
- uses: taiki-e/install-action@v2
40+
with:
41+
tool: taplo-cli
4042
- name: Run Taplo
4143
run: taplo fmt --check

.github/workflows/lint.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
name: Lint
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
616
clippy-rustdoc:
7-
name: Clippy + Rustdoc
17+
name: Clippy & Rustdoc
18+
19+
runs-on: ubuntu-latest
820

921
strategy:
1022
fail-fast: false
@@ -33,15 +45,13 @@ jobs:
3345
- channel: nightly
3446
features: --all-features
3547

36-
runs-on: ubuntu-latest
37-
3848
steps:
39-
- name: Update Rust
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
- name: Install Rust
4052
run: |
4153
rustup toolchain install ${{ matrix.channel }} --profile minimal --component clippy --allow-downgrade
4254
rustup default ${{ matrix.channel }}
43-
- name: Checkout
44-
uses: actions/checkout@v4
4555
- name: Run Clippy
4656
run:
4757
cargo clippy --all-targets --workspace ${{ matrix.features }} -- -D warnings

.github/workflows/publish.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
name: Publish
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
616
publish:
@@ -12,5 +22,4 @@ jobs:
1222
- name: Checkout
1323
uses: actions/checkout@v4
1424
- name: Test Publish
15-
run:
16-
cargo publish --dry-run
25+
run: cargo publish --dry-run

.github/workflows/spellcheck.yml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,44 @@
11
name: Spellcheck
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
6-
rustfmt:
16+
spellcheck:
717
name: Spellcheck
818

919
runs-on: ubuntu-latest
1020

1121
steps:
12-
- name: Cache cargo-spellcheck
13-
uses: actions/cache@v3
14-
with:
15-
path: |
16-
~/.cargo/.crates.toml
17-
~/.cargo/.crates2.json
18-
~/.cargo/bin/cargo-spellcheck
19-
key: cargo-spellcheck
20-
- name: Install libclang-dev
21-
run: sudo apt-get install libclang-dev
22-
- name: Install cargo-spellcheck
23-
run: cargo install cargo-spellcheck --locked
2422
- name: Checkout
2523
uses: actions/checkout@v4
24+
- uses: taiki-e/install-action@v2
25+
with:
26+
tool: cargo-spellcheck
2627
- name: Run Spellcheck
27-
run: cargo spellcheck check -m 1 2>/dev/null
28-
- name: Run Spellcheck on CHANGELOG.md
29-
run: cargo spellcheck check -m 1 CHANGELOG.md 2>/dev/null
28+
run: |
29+
cargo spellcheck check -m 1
30+
cargo spellcheck check -m 1 CHANGELOG.md
31+
32+
typos:
33+
name: Typos
34+
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
- uses: taiki-e/install-action@v2
41+
with:
42+
tool: typos-cli
43+
- name: Run Typos
44+
run: typos

.github/workflows/test.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
name: Test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
616
build-test:
7-
name: Build + Test
17+
name: Build & Test
18+
19+
runs-on: ubuntu-latest
820

921
strategy:
1022
fail-fast: false
@@ -21,6 +33,8 @@ jobs:
2133
- --features safe,zeroize
2234
- --features safe,zeroize-on-drop
2335
include:
36+
- rust: 1.57.0
37+
msrv: true
2438
- rust: nightly
2539
features: --features nightly
2640
- rust: nightly
@@ -32,17 +46,15 @@ jobs:
3246
- rust: nightly
3347
features: --all-features
3448

35-
runs-on: ubuntu-latest
36-
3749
steps:
38-
- name: Update Rust
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
- name: Install Rust
3953
run: |
4054
rustup toolchain install ${{ matrix.rust }} --profile minimal --allow-downgrade
4155
rustup default ${{ matrix.rust }}
42-
- name: Checkout
43-
uses: actions/checkout@v4
4456
- name: Pin `zeroize` for MSRV
45-
if: matrix.rust == '1.57.0'
57+
if: matrix.msrv
4658
run:
4759
cargo update -p zeroize --precise 1.6.0
4860
- name: Build
@@ -58,6 +70,8 @@ jobs:
5870
no-std-build:
5971
name: no_std Build
6072

73+
runs-on: ubuntu-latest
74+
6175
strategy:
6276
fail-fast: false
6377
matrix:
@@ -73,6 +87,8 @@ jobs:
7387
- --features safe,zeroize
7488
- --features safe,zeroize-on-drop
7589
include:
90+
- rust: 1.57.0
91+
msrv: true
7692
- rust: nightly
7793
features: --features nightly
7894
- rust: nightly
@@ -84,17 +100,15 @@ jobs:
84100
- rust: nightly
85101
features: --all-features
86102

87-
runs-on: ubuntu-latest
88-
89103
steps:
90-
- name: Update Rust
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
- name: Install Rust
91107
run: |
92108
rustup toolchain install ${{ matrix.rust }} --target thumbv6m-none-eabi --profile minimal --allow-downgrade
93109
rustup default ${{ matrix.rust }}
94-
- name: Checkout
95-
uses: actions/checkout@v4
96110
- name: Pin `zeroize` for MSRV
97-
if: matrix.rust == '1.57.0'
111+
if: matrix.msrv
98112
run:
99113
cargo update -p zeroize --precise 1.6.0
100114
- name: Build
@@ -104,6 +118,8 @@ jobs:
104118
minimal-versions:
105119
name: Minimal Versions
106120

121+
runs-on: ubuntu-latest
122+
107123
strategy:
108124
fail-fast: false
109125
matrix:
@@ -113,18 +129,16 @@ jobs:
113129
- version: stable
114130
features: safe,zeroize-on-drop
115131

116-
runs-on: ubuntu-latest
117-
118132
steps:
119-
- name: Update Rust
133+
- name: Checkout
134+
uses: actions/checkout@v4
135+
- name: Install Rust
120136
run: |
121137
rustup toolchain install ${{ matrix.rust.version }} --profile minimal --allow-downgrade
122138
rustup default ${{ matrix.rust.version }}
123139
- name: Install nightly Rust
124140
run:
125141
rustup toolchain install nightly --profile minimal --allow-downgrade
126-
- name: Checkout
127-
uses: actions/checkout@v4
128142
- name: Build
129143
working-directory: test-crates/minimal-versions
130144
run: |

.github/workflows/validate.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
11
name: Validate
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref_name }}
10+
cancel-in-progress: true
11+
12+
env:
13+
CARGO_TERM_COLOR: always
414

515
jobs:
616
miri:
717
name: Miri
818

19+
runs-on: ubuntu-latest
20+
921
strategy:
1022
fail-fast: false
1123
matrix:
1224
features:
1325
- ""
1426
- --features nightly
1527

16-
runs-on: ubuntu-latest
17-
1828
steps:
19-
- name: Update Rust
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
- name: Install Rust
2032
run: |
2133
rustup toolchain install nightly --profile minimal --component miri,rust-src --allow-downgrade
2234
rustup default nightly
23-
- name: Checkout
24-
uses: actions/checkout@v4
2535
- name: Test
2636
run:
2737
cargo miri test --workspace ${{ matrix.features }} --all-targets --no-fail-fast

0 commit comments

Comments
 (0)