diff options
author | Franck Cuny <franck@fcuny.net> | 2022-11-01 18:42:04 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-11-01 18:42:04 -0700 |
commit | 8d16cde45c5cb281b46aa64864aae8be6324385f (patch) | |
tree | e853ee1feac82cb8f5fe278d88073b8310909def /templates/rust/.github/workflows | |
parent | feat(home/packages): install gha-billing CLI (diff) | |
download | world-8d16cde45c5cb281b46aa64864aae8be6324385f.tar.gz |
ref: update the template for rust projects
Update the workflow to use `nix develop` commands instead of multiple steps (see https://determinate.systems/posts/nix-github-actions). Add a configuration for `cargo deny` to manage the dependencies I take on.
Diffstat (limited to 'templates/rust/.github/workflows')
-rw-r--r-- | templates/rust/.github/workflows/build.yml | 86 |
1 files changed, 25 insertions, 61 deletions
diff --git a/templates/rust/.github/workflows/build.yml b/templates/rust/.github/workflows/build.yml index f449190..202cfec 100644 --- a/templates/rust/.github/workflows/build.yml +++ b/templates/rust/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: gh-ssh-keys CI +name: XXX CI on: push: @@ -8,66 +8,30 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: check - - uses: actions-rs/cargo@v1 - with: - command: check - args: --no-default-features + - name: git checkout + uses: actions/checkout@v3 + - name: install nix + uses: cachix/install-nix-action@v17 + # This is a workaround for https://github.com/oxalica/rust-overlay/issues/54, + # avoiding link errors when running cargo commands with `nix develop`. + - name: Remove existing binaries from ~/.cargo/bin + run: rm --recursive --force --verbose ~/.cargo/bin + - name: check rust formatting + run: nix develop --command cargo fmt --check + - name: audit rust code + run: nix develop --command cargo-deny check + - name: clippy + run: nix develop --command cargo clippy -- -D warnings - test: - name: Test + test_and_build: + name: Test and build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: actions-rs/cargo@v1 - with: - command: test - - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-default-features - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + - name: git checkout + uses: actions/checkout@v3 + - name: install nix + uses: cachix/install-nix-action@v17 + - name: test + run: nix develop --command cargo test + - name: build + run: nix build . |