Skip to content

Commit 019dcfd

Browse files
committed
Use lint on MSRV only & update workflow with gptman
1 parent d6b5248 commit 019dcfd

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

.github/workflows/rust.yml

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ name: Rust
33
on:
44
push:
55
branches: [ main ]
6-
schedule:
7-
- cron: 0 0 1 * *
86
pull_request:
97
branches: [ main ]
108

119
env:
10+
CARGO_INCREMENTAL: 0
1211
CARGO_TERM_COLOR: always
1312

1413
jobs:
@@ -21,40 +20,42 @@ jobs:
2120
- macos-latest
2221
rust:
2322
- stable
24-
- 1.56.0 # MSRV
23+
- msrv
2524
include:
2625
- os: ubuntu-latest
27-
rust: stable
26+
rust: msrv
2827
lint: 1
28+
- rust: stable
29+
rust-args: --all-features
2930
runs-on: ${{ matrix.os }}
3031
steps:
3132
- name: Checkout source
32-
uses: actions/checkout@v2
33-
34-
- uses: actions-rs/toolchain@v1
35-
with:
36-
toolchain: ${{ matrix.rust }}
37-
default: true
38-
override: true
39-
40-
- uses: Swatinem/rust-cache@v1
33+
uses: actions/checkout@v3
34+
35+
- name: Install toolchain
36+
shell: bash
37+
run: |
38+
ver="${{ matrix.rust }}"
39+
if [ "$ver" = msrv ]; then
40+
ver=$(cargo metadata --format-version 1 --no-deps | \
41+
jq -r '.packages[0].rust_version')
42+
extra=(-c rustfmt -c clippy)
43+
fi
44+
rustup toolchain install "$ver" --profile minimal --no-self-update "${extra[@]}"
45+
rustup default "$ver"
46+
echo "Installed:"
47+
cargo --version
48+
rustc --version --verbose
49+
50+
- uses: Swatinem/rust-cache@v2
4151

4252
- name: cargo test
43-
uses: actions-rs/cargo@v1
44-
with:
45-
command: test
46-
args: --workspace --all-features
53+
run: cargo test --workspace ${{ matrix.rust-args }}
4754

4855
- name: rustfmt
4956
if: github.event_name == 'pull_request' && matrix.lint
50-
uses: actions-rs/cargo@v1
51-
with:
52-
command: fmt
53-
args: --all -- --check
57+
run: cargo fmt --all -- --check
5458

5559
- name: clippy
5660
if: github.event_name == 'pull_request' && matrix.lint
57-
uses: actions-rs/clippy-check@v1
58-
with:
59-
token: ${{ secrets.GITHUB_TOKEN }}
60-
args: --all --tests --all-features -- -D warnings
61+
run: cargo clippy --all --tests --all-features -- -D warnings

0 commit comments

Comments
 (0)