Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@ 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:
- uses: actions/checkout@v2
- 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
- run: rustup show active-toolchain
- run: rustup component add rustfmt clippy

- 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
Expand Down Expand Up @@ -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
11 changes: 3 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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][].

Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.97.1"
components = ["clippy", "rustfmt"]