.github/workflows/ci.yml
71 lines · 1965 bytes
1on:
2 push:
3 branches:
4 - main
5 pull_request:
6 branches:
7 - main
8
9name: CI
10
11jobs:
12 test:
13 strategy:
14 matrix:
15 platform: [ubuntu-latest, windows-latest, macos-latest]
16 runs-on: ${{ matrix.platform }}
17 env:
18 SCCACHE_GHA_ENABLED: "true"
19 RUSTC_WRAPPER: "sccache"
20 steps:
21 - name: Checkout code
22 uses: actions/checkout@v3
23 with:
24 submodules: true
25 - name: Install Rust (1.93 w/ clippy)
26 uses: dtolnay/rust-toolchain@1.93
27 with:
28 components: clippy
29 - name: Install Rust (nightly w/ rustfmt)
30 run: rustup toolchain install nightly --component rustfmt
31 - name: Cache cargo registry
32 uses: actions/cache@v3
33 with:
34 path: ~/.cargo/registry
35 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
36 - name: Run sccache-cache
37 uses: mozilla-actions/sccache-action@v0.0.9
38 - name: Check formatting
39 run: cargo +nightly fmt --all -- --check
40 - name: Check imports formatting
41 run: find src -name '*.rs' | xargs ./.github/workflows/check-imports-format.sh
42 - name: Check Clippy
43 if: matrix.platform == 'ubuntu-latest'
44 uses: giraffate/clippy-action@v1
45 with:
46 github_token: ${{ secrets.GITHUB_TOKEN }}
47 reporter: 'github-check'
48 - name: Run tests
49 run: cargo test --locked
50
51 nix-flake-test:
52 name: Flake checks ❄️
53 strategy:
54 matrix:
55 platform: [ubuntu-latest, macos-latest]
56 runs-on: ${{ matrix.platform }}
57 steps:
58 - name: Checkout Code
59 uses: actions/checkout@v4
60 - uses: cachix/install-nix-action@v31
61 with:
62 github_access_token: ${{ secrets.GITHUB_TOKEN }}
63 - uses: cachix/cachix-action@v15
64 with:
65 name: iamb-prs
66 authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
67 - name: Flake check
68 run: |
69 nix flake show
70 nix flake check --print-build-logs
71