Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit 152469e

Browse files
committed
improve GitHub workflows to only run when necessary
There is no reason to run clippy or `cargo test` when we do not change Rust code (as in some PRs that improve documentation or example scripts). There is no reason to run `cargo deny` if our dependencies did not change (which we can track by just looking at `Cargo.lock`). Finally, we added an `cargo_update` action, that will run monthly, and a `doc-build` action that will run everytime a documentation file changes, to ensure the docs can always be built.
1 parent 95fe9e5 commit 152469e

File tree

6 files changed

+115
-28
lines changed

6 files changed

+115
-28
lines changed

.github/workflows/clippy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Clippy
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.rs'
7+
- '**Cargo.toml'
8+
merge_group:
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- '**.rs'
14+
- '**Cargo.toml'
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
SCCACHE_GHA_ENABLED: "true"
19+
RUSTC_WRAPPER: "sccache"
20+
21+
jobs:
22+
clippy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v5
26+
- uses: mozilla-actions/[email protected]
27+
- uses: dtolnay/rust-toolchain@stable
28+
with:
29+
components: clippy
30+
- run: sudo apt install -y libwayland-dev wayland-protocols
31+
- run: cargo clippy --version
32+
- run: cargo clippy --workspace --locked --tests
33+
34+
fmt:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v5
38+
- uses: mozilla-actions/[email protected]
39+
- uses: dtolnay/rust-toolchain@stable
40+
with:
41+
components: rustfmt
42+
- run: cargo fmt --version
43+
- run: cargo fmt --all --check

.github/workflows/dependencies.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
name: Dependencies
22

33
on:
4-
workflow_call:
4+
pull_request:
5+
paths:
6+
- '**Cargo.lock'
7+
merge_group:
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- '**Cargo.lock'
513

614
env:
715
CARGO_TERM_COLOR: always
@@ -12,7 +20,7 @@ jobs:
1220
advisories:
1321
runs-on: ubuntu-latest
1422
steps:
15-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
1624
- uses: mozilla-actions/[email protected]
1725
- uses: dtolnay/rust-toolchain@stable
1826
- uses: taiki-e/install-action@cargo-deny
@@ -21,7 +29,7 @@ jobs:
2129
bans:
2230
runs-on: ubuntu-latest
2331
steps:
24-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@v5
2533
- uses: mozilla-actions/[email protected]
2634
- uses: dtolnay/rust-toolchain@stable
2735
- uses: taiki-e/install-action@cargo-deny
@@ -30,7 +38,7 @@ jobs:
3038
licences:
3139
runs-on: ubuntu-latest
3240
steps:
33-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@v5
3442
- uses: mozilla-actions/[email protected]
3543
- uses: dtolnay/rust-toolchain@stable
3644
- uses: taiki-e/install-action@cargo-deny
@@ -39,7 +47,7 @@ jobs:
3947
sources:
4048
runs-on: ubuntu-latest
4149
steps:
42-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v5
4351
- uses: mozilla-actions/[email protected]
4452
- uses: dtolnay/rust-toolchain@stable
4553
- uses: taiki-e/install-action@cargo-deny

.github/workflows/doc.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Doc
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.scd'
7+
merge_group:
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- '**.scd'
13+
14+
jobs:
15+
doc-build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
- run: sudo apt install -y scdoc
20+
- run: ./doc/gen.sh

.github/workflows/test.yml

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

33
on:
4-
workflow_call:
4+
pull_request:
5+
paths:
6+
- '**.rs'
7+
- '**Cargo.toml'
8+
merge_group:
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- '**.rs'
14+
- '**Cargo.toml'
515

616
env:
717
CARGO_TERM_COLOR: always
818
SCCACHE_GHA_ENABLED: "true"
919
RUSTC_WRAPPER: "sccache"
1020

1121
jobs:
12-
nightly:
22+
test:
1323
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
toolchain: [stable, nightly]
1427
steps:
15-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
1629
- uses: mozilla-actions/[email protected]
17-
- uses: dtolnay/rust-toolchain@nightly
18-
- uses: taiki-e/install-action@cargo-nextest
19-
- run: sudo apt install -y libwayland-dev wayland-protocols
20-
- run: cargo build --workspace --locked --verbose
21-
- run: cargo nextest run --workspace --locked
22-
23-
stable:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: mozilla-actions/[email protected]
28-
- uses: dtolnay/rust-toolchain@stable
30+
- uses: dtolnay/rust-toolchain@${{ strategy.toolchain }}
2931
- uses: taiki-e/install-action@cargo-nextest
3032
- run: sudo apt install -y libwayland-dev wayland-protocols
3133
- run: cargo build --workspace --locked --verbose
@@ -34,7 +36,7 @@ jobs:
3436
msrv:
3537
runs-on: ubuntu-latest
3638
steps:
37-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v5
3840
- uses: mozilla-actions/[email protected]
3941
- uses: SebRollen/[email protected]
4042
id: msrv
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: update-dependencies
2+
on:
3+
schedule:
4+
- cron: '0 0 1 * *' # Run monthly
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
SCCACHE_GHA_ENABLED: "true"
9+
RUSTC_WRAPPER: "sccache"
10+
11+
jobs:
12+
cargo_update:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
- uses: moonrepo/setup-rust@v1
17+
- run: cargo update
18+
- uses: peter-evans/create-pull-request@v7
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: update-flake-lock
22
on:
3-
workflow_dispatch: # allows manual triggering
43
schedule:
54
- cron: '0 0 1 * *' # Run monthly
65
push:
@@ -12,12 +11,9 @@ jobs:
1211
lockfile:
1312
runs-on: ubuntu-latest
1413
steps:
15-
- name: Checkout repository
16-
uses: actions/checkout@v4
17-
- name: Install Nix
18-
uses: cachix/install-nix-action@v27
14+
- uses: actions/checkout@v5
15+
- uses: cachix/install-nix-action@v27
1916
with:
2017
extra_nix_config: |
2118
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
22-
- name: Update flake.lock
23-
uses: DeterminateSystems/update-flake-lock@v21
19+
- uses: DeterminateSystems/update-flake-lock@v21

0 commit comments

Comments
 (0)