Skip to content

Commit e25c37a

Browse files
committed
chore(ci): Align closer to epage/_rust template
1 parent b1575a9 commit e25c37a

File tree

2 files changed

+88
-43
lines changed

2 files changed

+88
-43
lines changed

.github/workflows/build.yml

+87-42
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,102 @@
11
name: build
22

3+
permissions:
4+
contents: read
5+
36
on: [push, pull_request]
47

8+
env:
9+
RUST_BACKTRACE: 1
10+
CARGO_TERM_COLOR: always
11+
CLICOLOR: 1
12+
513
jobs:
614
build:
7-
runs-on: ${{ matrix.os }}
15+
permissions:
16+
contents: none
17+
name: CI
18+
needs: [test, msrv, lockfile, docs, rustfmt, clippy, minimal-versions]
19+
runs-on: ubuntu-latest
20+
if: "always()"
21+
steps:
22+
- name: Failed
23+
run: exit 1
24+
if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')"
25+
test:
26+
name: Test
827
strategy:
9-
fail-fast: false
1028
matrix:
11-
os: [ubuntu-latest, windows-latest, macos-latest]
12-
toolchain: [stable]
29+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
30+
rust: ["stable"]
31+
continue-on-error: ${{ matrix.rust != 'stable' }}
32+
runs-on: ${{ matrix.os }}
1333
steps:
14-
- name: Install latest nightly
15-
uses: actions-rs/toolchain@v1
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
- name: Install Rust
37+
uses: dtolnay/rust-toolchain@stable
1638
with:
17-
toolchain: ${{ matrix.toolchain }}
18-
override: true
19-
- uses: actions/checkout@v2
20-
- uses: Swatinem/rust-cache@v1
39+
toolchain: ${{ matrix.rust }}
40+
- uses: Swatinem/rust-cache@v2
2141
- name: Build
22-
run: cargo build --verbose
23-
continue-on-error: ${{ matrix.toolchain != 'stable' }}
24-
- name: Run tests
25-
run: cargo test --verbose
26-
continue-on-error: ${{ matrix.toolchain != 'stable' }}
27-
28-
clippy:
29-
name: clippy (ubuntu-latest, stable)
42+
run: cargo test --no-run
43+
- name: Test
44+
run: cargo test
45+
lockfile:
3046
runs-on: ubuntu-latest
3147
steps:
32-
- name: Install latest stable
33-
uses: actions-rs/toolchain@v1
34-
with:
35-
toolchain: stable
36-
override: true
37-
components: clippy
38-
- name: Checkout sources
39-
uses: actions/checkout@v2
40-
- uses: Swatinem/rust-cache@v1
41-
- name: Cargo Clippy
42-
run: cargo clippy -- -D warnings -A deprecated
43-
44-
fmt:
45-
name: fmt (ubuntu-latest, stable)
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
- name: Install Rust
51+
uses: dtolnay/rust-toolchain@stable
52+
with:
53+
toolchain: stable
54+
- uses: Swatinem/rust-cache@v2
55+
- name: "Is lockfile updated?"
56+
run: cargo update --workspace --locked
57+
rustfmt:
58+
name: rustfmt
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Checkout repository
62+
uses: actions/checkout@v4
63+
- name: Install Rust
64+
uses: dtolnay/rust-toolchain@stable
65+
with:
66+
toolchain: stable
67+
components: rustfmt
68+
- uses: Swatinem/rust-cache@v2
69+
- name: Check formatting
70+
run: cargo fmt --all -- --check
71+
clippy:
72+
name: clippy
4673
runs-on: ubuntu-latest
74+
permissions:
75+
security-events: write # to upload sarif results
4776
steps:
48-
- name: Install latest stable
49-
uses: actions-rs/toolchain@v1
50-
with:
51-
toolchain: stable
52-
override: true
53-
components: rustfmt
54-
- name: Checkout sources
55-
uses: actions/checkout@v2
56-
- name: Check Formatting
57-
run: cargo fmt --all -- --check
77+
- name: Checkout repository
78+
uses: actions/checkout@v4
79+
- name: Install Rust
80+
uses: dtolnay/rust-toolchain@stable
81+
with:
82+
toolchain: stable
83+
components: clippy
84+
- uses: Swatinem/rust-cache@v2
85+
- name: Install SARIF tools
86+
run: cargo install clippy-sarif --locked
87+
- name: Install SARIF tools
88+
run: cargo install sarif-fmt --locked
89+
- name: Check
90+
run: >
91+
cargo clippy --workspace --all-features --all-targets --message-format=json
92+
| clippy-sarif
93+
| tee clippy-results.sarif
94+
| sarif-fmt
95+
continue-on-error: true
96+
- name: Upload
97+
uses: github/codeql-action/upload-sarif@v3
98+
with:
99+
sarif_file: clippy-results.sarif
100+
wait-for-processing: true
101+
- name: Report status
102+
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated

.github/workflows/post-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
2525
echo "version is: ${{ env.RELEASE_VERSION }}"
2626
- name: Checkout repository
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 1
3030
- name: Generate Release Notes

0 commit comments

Comments
 (0)