Skip to content

Commit e470e2b

Browse files
committed
Overhaul CI and pin MSRV dependencies
1 parent 4986ed1 commit e470e2b

File tree

5 files changed

+158
-68
lines changed

5 files changed

+158
-68
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,97 +3,91 @@ name: CI checks
33
on: [push, pull_request]
44

55
jobs:
6-
lint:
7-
name: Lint
8-
runs-on: ubuntu-latest
9-
6+
test-msrv:
7+
name: Test MSRV on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macos-12]
1012
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions-rs/toolchain@v1
13-
with:
14-
toolchain: 1.51.0
15-
override: true
16-
17-
# Ensure all code has been formatted with rustfmt
18-
- run: rustup component add rustfmt
19-
- name: Check formatting
20-
uses: actions-rs/cargo@v1
21-
with:
22-
command: fmt
23-
args: -- --check --color always
13+
- uses: actions/checkout@v4
14+
- name: Run tests
15+
run: cargo test --verbose
16+
- name: Verify working directory is clean
17+
run: git diff --exit-code
2418

25-
test:
26-
name: Test on ${{ matrix.os }}
19+
test-latest:
20+
name: Test latest on ${{ matrix.os }}
2721
runs-on: ${{ matrix.os }}
2822
strategy:
2923
matrix:
30-
os: [ubuntu-latest, windows-latest, macOS-latest]
31-
24+
os: [ubuntu-latest, windows-latest, macos-latest]
3225
steps:
33-
- uses: actions/checkout@v1
34-
- uses: actions-rs/toolchain@v1
35-
with:
36-
toolchain: 1.51.0
37-
override: true
38-
- name: cargo fetch
39-
uses: actions-rs/cargo@v1
40-
with:
41-
command: fetch
42-
- name: Build tests
43-
uses: actions-rs/cargo@v1
44-
with:
45-
command: build
46-
args: --verbose --tests
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@stable
28+
id: toolchain
29+
- run: rustup override set ${{steps.toolchain.outputs.name}}
30+
- name: Remove lockfile to build with latest dependencies
31+
run: rm Cargo.lock
4732
- name: Run tests
48-
uses: actions-rs/cargo@v1
33+
run: cargo test --verbose
34+
- name: Verify working directory is clean (excluding lockfile)
35+
run: git diff --exit-code ':!Cargo.lock'
36+
37+
clippy:
38+
name: Clippy (MSRV)
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Clippy check
43+
uses: actions-rs/clippy-check@v1
4944
with:
50-
command: test
51-
args: --verbose
45+
name: Clippy (MSRV)
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
args: --all-features --all-targets -- -D warnings
5248

5349
codecov:
5450
name: Code coverage
5551
runs-on: ubuntu-latest
52+
container:
53+
image: xd009642/tarpaulin:develop-nightly
54+
options: --security-opt seccomp=unconfined
5655

5756
steps:
58-
- uses: actions/checkout@v1
59-
- uses: actions-rs/toolchain@v1
60-
with:
61-
toolchain: stable
62-
override: true
63-
- name: Install cargo-tarpaulin
64-
uses: actions-rs/cargo@v1
65-
with:
66-
command: install
67-
args: cargo-tarpaulin
57+
- uses: actions/checkout@v4
58+
- uses: dtolnay/rust-toolchain@stable
59+
id: toolchain
60+
- run: rustup override set ${{steps.toolchain.outputs.name}}
6861
- name: Generate coverage report
69-
uses: actions-rs/cargo@v1
70-
with:
71-
command: tarpaulin
72-
args: --release --timeout 180 --out Xml
62+
run: >
63+
cargo tarpaulin
64+
--engine llvm
65+
--release
66+
--timeout 180
67+
--out xml
7368
- name: Upload coverage to Codecov
74-
uses: codecov/codecov-action@v1.0.3
69+
uses: codecov/codecov-action@v4.5.0
7570
with:
76-
token: ${{secrets.CODECOV_TOKEN}}
71+
token: ${{ secrets.CODECOV_TOKEN }}
7772

7873
doc-links:
79-
name: Nightly lint
74+
name: Intra-doc links
8075
runs-on: ubuntu-latest
81-
8276
steps:
83-
- uses: actions/checkout@v1
77+
- uses: actions/checkout@v4
8478
- uses: actions-rs/toolchain@v1
8579
with:
8680
toolchain: nightly
8781
override: true
88-
- name: cargo fetch
89-
uses: actions-rs/cargo@v1
90-
with:
91-
command: fetch
92-
93-
# Ensure intra-documentation links all resolve correctly
82+
- run: cargo fetch
9483
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
9584
- name: Check intra-doc links
96-
uses: actions-rs/cargo@v1
97-
with:
98-
command: doc
99-
args: --document-private-items
85+
run: cargo doc --document-private-items
86+
87+
fmt:
88+
name: Rustfmt
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v4
92+
- name: Check formatting
93+
run: cargo fmt -- --check

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/target
22
**/*.rs.bk
3-
Cargo.lock

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"rust-analyzer.server.extraEnv": { "RUSTUP_TOOLCHAIN": "stable" }
3+
}

Cargo.lock

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "1.51.0"
3+
components = ["clippy", "rustfmt"]

0 commit comments

Comments
 (0)