Skip to content

Commit efda905

Browse files
committed
chore: Set and verify MSRV
Fixes #961
1 parent 9d7195c commit efda905

2 files changed

Lines changed: 66 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@ name: build
33
permissions:
44
contents: read
55

6-
on: [push, pull_request]
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- master
711

812
env:
913
RUST_BACKTRACE: 1
1014
CARGO_TERM_COLOR: always
1115
CLICOLOR: 1
1216

17+
concurrency:
18+
group: "${{ github.workflow }}-${{ github.ref }}"
19+
cancel-in-progress: true
20+
1321
jobs:
1422
build:
1523
permissions:
1624
contents: none
1725
name: CI
18-
needs: [test, lockfile, rustfmt, clippy]
26+
needs: [test, msrv, lockfile, rustfmt, clippy]
1927
runs-on: ubuntu-latest
2028
if: "always()"
2129
steps:
@@ -30,58 +38,100 @@ jobs:
3038
rust: ["stable"]
3139
continue-on-error: ${{ matrix.rust != 'stable' }}
3240
runs-on: ${{ matrix.os }}
41+
env:
42+
# Reduce amount of data cached
43+
CARGO_PROFILE_DEV_DEBUG: line-tables-only
3344
steps:
3445
- name: Checkout repository
35-
uses: actions/checkout@v4
46+
uses: actions/checkout@v6.0.2
47+
with:
48+
persist-credentials: false
3649
- name: Install Rust
3750
uses: dtolnay/rust-toolchain@stable
3851
with:
3952
toolchain: ${{ matrix.rust }}
40-
- uses: Swatinem/rust-cache@v2
53+
- name: Initialize cache
54+
uses: Swatinem/rust-cache@v2.9.1
55+
- name: Install cargo-hack
56+
uses: taiki-e/install-action@v2.75.4
57+
with:
58+
tool: cargo-hack
4159
- name: Build
42-
run: cargo test --no-run
60+
run: cargo test --workspace --no-run
4361
- name: Test
44-
run: cargo test
62+
run: cargo hack test --each-feature --workspace
63+
msrv:
64+
name: "Check MSRV"
65+
strategy:
66+
matrix:
67+
os: ["ubuntu-latest"]
68+
runs-on: ${{ matrix.os }}
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v6.0.2
72+
with:
73+
persist-credentials: false
74+
- name: Install Rust
75+
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
76+
with:
77+
toolchain: stable
78+
- name: Initialize cache
79+
uses: Swatinem/rust-cache@v2.9.1
80+
- name: Install cargo-hack
81+
uses: taiki-e/install-action@v2.75.4
82+
with:
83+
tool: cargo-hack
84+
- name: Default features
85+
run: cargo hack check --each-feature --locked --rust-version --ignore-private --workspace --all-targets --keep-going
4586
lockfile:
4687
runs-on: ubuntu-latest
4788
steps:
4889
- name: Checkout repository
49-
uses: actions/checkout@v4
90+
uses: actions/checkout@v6.0.2
91+
with:
92+
persist-credentials: false
5093
- name: Install Rust
5194
uses: dtolnay/rust-toolchain@stable
5295
with:
5396
toolchain: stable
54-
- uses: Swatinem/rust-cache@v2
97+
- name: Initialize cache
98+
uses: Swatinem/rust-cache@v2.9.1
5599
- name: "Is lockfile updated?"
56100
run: cargo update --workspace --locked
57101
rustfmt:
58102
name: rustfmt
59103
runs-on: ubuntu-latest
60104
steps:
61105
- name: Checkout repository
62-
uses: actions/checkout@v4
106+
uses: actions/checkout@v6.0.2
107+
with:
108+
persist-credentials: false
63109
- name: Install Rust
64110
uses: dtolnay/rust-toolchain@stable
65111
with:
66112
toolchain: stable
67113
components: rustfmt
68-
- uses: Swatinem/rust-cache@v2
114+
- name: Initialize cache
115+
uses: Swatinem/rust-cache@v2.9.1
69116
- name: Check formatting
70-
run: cargo fmt --all -- --check
117+
run: cargo fmt --check
71118
clippy:
72119
name: clippy
73120
runs-on: ubuntu-latest
74121
permissions:
75122
security-events: write # to upload sarif results
76123
steps:
77124
- name: Checkout repository
78-
uses: actions/checkout@v4
125+
uses: actions/checkout@v6.0.2
126+
with:
127+
persist-credentials: false
79128
- name: Install Rust
80129
uses: dtolnay/rust-toolchain@stable
81130
with:
82131
toolchain: stable
83132
components: clippy
84-
- uses: Swatinem/rust-cache@v2
133+
- name: Initialize cache
134+
uses: Swatinem/rust-cache@v2.9.1
85135
- name: Install SARIF tools
86136
run: cargo install clippy-sarif --locked
87137
- name: Install SARIF tools
@@ -94,9 +144,9 @@ jobs:
94144
| sarif-fmt
95145
continue-on-error: true
96146
- name: Upload
97-
uses: github/codeql-action/upload-sarif@v3
147+
uses: github/codeql-action/upload-sarif@v4.35.1
98148
with:
99149
sarif_file: clippy-results.sarif
100150
wait-for-processing: true
101151
- name: Report status
102-
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
152+
run: cargo clippy --workspace --all-features --all-targets --keep-going -- -D warnings --allow deprecated

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ readme = "README.md"
2727
repository = "https://github.com/killercup/cargo-edit"
2828
version = "0.13.10"
2929
edition = "2024"
30+
rust-version = "1.92"
3031

3132
[package.metadata.release]
3233
pre-release-replacements = [

0 commit comments

Comments
 (0)