about summary refs log tree commit diff
path: root/templates/rust/.github/workflows/build.yml
blob: 202cfec9bb658ddeb114fc22595d7c21ce1bd20d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: XXX CI

on:
  push:

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - 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_and_build:
    name: Test and build
    runs-on: ubuntu-latest
    steps:
      - 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 .