From 1da585038c8fadde556b8d153b610ac058dc7573 Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Mon, 20 Jul 2026 21:25:22 -0500 Subject: [PATCH 1/3] build: Pin Rust version to 1.97.1 --- .github/workflows/main.yml | 2 +- CONTRIBUTING.md | 11 +++-------- rust-toolchain.toml | 3 +++ 3 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 84bb6844..a1e3f3a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,8 +19,8 @@ jobs: steps: - uses: actions/checkout@v2 + - run: rustup install - run: rustup show active-toolchain - - run: rustup component add rustfmt clippy - name: Configure Rust cache uses: Swatinem/rust-cache@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22a26ffd..f52030b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -111,17 +111,12 @@ spec. For Rust code, we use [rustfmt][] to ensure consistent formatting code and [clippy][] to catch common mistakes not caught by the compiler. -```sh -# if you don't have them installed, install or update the stable toolchain -rustup install stable -# … and install prebuilt rustfmt and clippy executables (available for most platforms) -rustup component add rustfmt clippy -``` +You can run `rustup install` in the repo directory to install the pinned version of +the Rust toolchain and linting tools. Before committing your changes, run `cargo fmt` to format the code (if your editor / IDE isn't set up to run it automatically) and `cargo clippy` to run -lints. You'll need to run this from each Cargo project (`credentialsd/`, -`credentialsd-ui/`, `credentialsd-common/`). +lints. For Python code, we use [ruff][]. diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..59277fee --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.97.1" +components = ["clippy", "rustfmt"] From e756afaa5da50247b9095ffd1d873c7ef37954ec Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Mon, 20 Jul 2026 21:45:15 -0500 Subject: [PATCH 2/3] ci: Bump actions/checkout to v7.0.1 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a1e3f3a6..c5b60293 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: name: Build runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - run: rustup install - run: rustup show active-toolchain From e42c8f2b283d2a7479307c5d166927ac91d8fd78 Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Mon, 20 Jul 2026 21:45:15 -0500 Subject: [PATCH 3/3] ci: Move build directory to temp directory for caching --- .github/workflows/main.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5b60293..ed835dd0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,18 +5,20 @@ on: - main pull_request: -env: - CARGO_TERM_COLOR: always - CARGO_HOME: build/cargo-home - CARGO_TARGET_DIR: ${{ github.workspace }}/build/target - jobs: build: env: RUST_LOG: debug + CARGO_TERM_COLOR: always name: Build runs-on: ubuntu-24.04 steps: + - name: Set up environment variables + run: | + echo "BUILD_DIR=${{ runner.temp }}/build" >> $GITHUB_ENV + echo "CARGO_HOME=${{ runner.temp }}/build/cargo-home" >> $GITHUB_ENV + echo "CARGO_TARGET_DIR=${{ runner.temp }}/build/target" >> $GITHUB_ENV + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - run: rustup install @@ -25,8 +27,7 @@ jobs: - name: Configure Rust cache uses: Swatinem/rust-cache@v2 with: - workspaces: ". -> build/target" - cache-workspace-crates: true + workspaces: ". -> ${{ env.CARGO_TARGET_DIR }}" - name: Update apt cache run: sudo apt update @@ -72,20 +73,19 @@ jobs: echo ~/.local/bin >> $GITHUB_PATH - name: Setup meson project - run: meson setup -Dprofile=development -Dcargo_locked=true build + run: meson setup -Dprofile=development -Dcargo_locked=true $BUILD_DIR - name: Build - run: ninja -C build + run: ninja -C $BUILD_DIR - name: Test # We have to use the --interactive flag because of some # weird issue with meson hanging after cargo exits due to the TestDBus. # Probably has to do with forking the test processes. - run: meson test --interactive - working-directory: build/ + run: meson test -C $BUILD_DIR --interactive - name: Check clippy recommendations - run: cargo clippy --locked --workspace --all-features --target-dir build/target -- -Dwarnings + run: cargo clippy --locked --workspace --all-features -- -Dwarnings - name: Check formatting run: cargo fmt --all --check