summaryrefslogtreecommitdiffstats
path: root/.github/workflows/checks.yml
blob: b6eb5075f87ba3645f6ea79fdaf7fde137bb497f (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Checks
on:
  workflow_dispatch:
  pull_request:
    paths:
      - '**.nix'
      - 'cli/**'
      - '.github/workflows/checks.yml'
  push:
    branches: ["main"]
    paths:
      - '**.nix'
      - 'cli/**'
      - '.github/workflows/checks.yml'

jobs:
  check-formatting:
    name: "check nix formatting"
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout"
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
        with:
          persist-credentials: false

      - name: "Install Nix"
        uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24

      - name: "Evaluate formatting checks"
        run: |
          system=$(nix eval --raw --impure --expr builtins.currentSystem)

          # Evaluate formatting check to verify tree-wide formatting.
          nix build -L .#checks."${system}".formatting

  check-rust:
    name: check Rust
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
        with:
          persist-credentials: false

      - name: Install Nix
        uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24

      - name: Check Rust CLI
        run: |
          eval "$(nix print-dev-env .#rust)"
          cargo fmt --manifest-path cli/Cargo.toml --all -- --check
          cargo check --manifest-path cli/Cargo.toml --workspace
          cargo test --manifest-path cli/Cargo.toml --workspace
          cargo clippy --manifest-path cli/Cargo.toml --workspace --all-targets -- -D warnings