Skip to content

Commit fe1d718

Browse files
committed
ci: switch to sccache + dtolnay/rust-toolchain
Signed-off-by: David Bernard <[email protected]>
1 parent ece3941 commit fe1d718

File tree

7 files changed

+41
-51
lines changed

7 files changed

+41
-51
lines changed

Diff for: .github/workflows/ci.yml

+9-16
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
permissions:
88
contents: read
99

10+
env:
11+
# configure sccache to cache the build artifacts (on github caches)
12+
SCCACHE_GHA_ENABLED: "true"
13+
RUSTC_WRAPPER: "sccache"
14+
1015
jobs:
1116
tests:
1217
runs-on: ${{ matrix.os }}
@@ -22,22 +27,10 @@ jobs:
2227
with:
2328
fetch-depth: 0
2429
submodules: "true"
25-
# - uses: jdx/mise-action@v2
26-
- name: install mise until mise-action is allowed
27-
uses: taiki-e/install-action@v2
28-
with:
29-
tool: mise, cargo-nextest, cargo-hack
30-
- name: Rust Cache
31-
uses: actions/cache@v4
32-
continue-on-error: false
33-
with:
34-
path: |
35-
~/.cargo/bin
36-
~/.cargo/registry
37-
~/.cargo/git/db/
38-
key: ${{ runner.os }}-sdk-rust-${{ hashFiles('**/Cargo.toml') }} # no Cargo.lock in this repo
39-
restore-keys: |
40-
${{ runner.os }}-sdk-rust-
30+
- uses: mozilla-actions/[email protected]
31+
- uses: jdx/mise-action@v2
32+
- run: mise install
33+
shell: bash
4134
- run: make generate
4235
- run: make check_no_uncommitted_changes_on_sdk
4336
- run: make check

Diff for: .github/workflows/linter.yml

+11-20
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
2020
cancel-in-progress: true
2121

22+
env:
23+
# configure sccache to cache the build artifacts (on github caches)
24+
SCCACHE_GHA_ENABLED: "true"
25+
RUSTC_WRAPPER: "sccache"
26+
2227
jobs:
2328
lint_commits:
2429
name: Lint Commit Messages
@@ -48,27 +53,13 @@ jobs:
4853
with:
4954
fetch-depth: 0
5055
submodules: "true"
51-
- name: Install rust toolchain
52-
uses: actions-rust-lang/setup-rust-toolchain@v1
53-
with:
54-
toolchain: stable
55-
components: clippy, rustfmt
56-
- name: Install development tools
57-
uses: taiki-e/install-action@v2
58-
with:
59-
tool: cargo-deny, dprint
60-
- name: Rust Cache
61-
uses: actions/cache@v4
62-
continue-on-error: false
63-
with:
64-
path: |
65-
~/.cargo/bin
66-
~/.cargo/registry
67-
~/.cargo/git/db/
68-
key: ${{ runner.os }}-sdk-rust-${{ hashFiles('**/Cargo.lock') }}
69-
restore-keys: |
70-
${{ runner.os }}-sdk-rust-
56+
- uses: mozilla-actions/[email protected]
57+
- uses: jdx/mise-action@v2
58+
- run: mise install
59+
shell: bash
7160
- name: Check cargo version
7261
run: cargo --version
7362
- name: Run ${{ matrix.lint_projects }}
7463
run: make -f Makefile lint_${{ matrix.lint_projects }}
64+
- run: ${SCCACHE_PATH} --show-stats
65+
shell: bash

Diff for: .github/workflows/release-plz.yml

+15-8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
- main
1111
workflow_dispatch:
1212

13+
env:
14+
# configure sccache to cache the build artifacts (on github caches)
15+
SCCACHE_GHA_ENABLED: "true"
16+
RUSTC_WRAPPER: "sccache"
17+
1318
jobs:
1419
# Release unpublished packages.
1520
release-plz-release:
@@ -22,15 +27,16 @@ jobs:
2227
uses: actions/checkout@v4
2328
with:
2429
fetch-depth: 0
25-
- name: Install Rust toolchain
26-
uses: dtolnay/rust-toolchain@stable
27-
- name: Run release-plz
28-
uses: release-plz/[email protected]
30+
- uses: mozilla-actions/[email protected]
31+
- uses: dtolnay/rust-toolchain@stable
32+
- uses: release-plz/[email protected]
2933
with:
3034
command: release
3135
env:
3236
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3337
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
38+
- run: ${SCCACHE_PATH} --show-stats
39+
shell: bash
3440

3541
# Create a PR with the new versions and changelog, preparing the next release.
3642
release-plz-pr:
@@ -47,12 +53,13 @@ jobs:
4753
uses: actions/checkout@v4
4854
with:
4955
fetch-depth: 0
50-
- name: Install Rust toolchain
51-
uses: dtolnay/rust-toolchain@stable
52-
- name: Run release-plz
53-
uses: release-plz/[email protected]
56+
- uses: mozilla-actions/[email protected]
57+
- uses: dtolnay/rust-toolchain@stable
58+
- uses: release-plz/[email protected]
5459
with:
5560
command: release-pr
5661
env:
5762
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5863
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
64+
- run: ${SCCACHE_PATH} --show-stats
65+
shell: bash

Diff for: .mise.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ MISE_CARGO_BINSTALL = "true"
66

77
[tools]
88
"aqua:cargo-bins/cargo-binstall" = "1"
9-
rust = "1.85"
9+
rust = { version = "1.85", profile = "default" }
1010
make = "latest"
1111
# # experimental
1212
"cargo:cargo-nextest" = "0.9"
13-
# "cargo:cargo-hack" = "latest"
13+
"cargo:cargo-hack" = "0.6"
1414
"cargo:cargo-deny" = "0.16"
1515
# "cargo:git-cliff" = "latest"
1616
"cargo:dprint" = "0.45"

Diff for: cdevents-sdk/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ authors.workspace = true
55
edition.workspace = true
66
license.workspace = true
77
publish = true
8+
readme = "README.md"
89
repository.workspace = true
910
rust-version.workspace = true
1011
description = "A Rust SDK for CDEvents"
11-
readme = "README.md"
1212

1313
[dependencies]
1414
cloudevents-sdk = { version = "0.8", optional = true, default-features = false }

Diff for: generator/Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ clap = { version = "4", features = ["derive"] }
1515
cruet = "0.15"
1616
glob = "0.3"
1717
handlebars = { version = "6", features = ["dir_source"] }
18-
handlebars_misc_helpers = { version = "0.17", default-features = false, features = [
19-
"string",
20-
"json",
21-
] }
18+
handlebars_misc_helpers = { version = "0.17", default-features = false, features = ["string", "json"] }
2219
indexmap = "2.2"
2320
serde = { version = "1.0", features = ["derive"] }
2421
serde_json = "1.0"

Diff for: rust-toolchain.toml

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[toolchain]
22
channel = "1.85.0"
3+
components = ["rustc", "cargo", "rust-std", "clippy", "rustfmt"]
4+
profile = "minimal"

0 commit comments

Comments
 (0)