.github/workflows/ci.yml

69 lines · 1843 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 Clippy
41      if: matrix.platform == 'ubuntu-latest'
42      uses: giraffate/clippy-action@v1
43      with:
44        github_token: ${{ secrets.GITHUB_TOKEN }}
45        reporter: 'github-check'
46    - name: Run tests
47      run: cargo test --locked
48
49  nix-flake-test:
50    name: Flake checks ❄️
51    strategy:
52      matrix:
53        platform: [ubuntu-latest, macos-latest]
54    runs-on: ${{ matrix.platform }}
55    steps:
56      - name: Checkout Code
57        uses: actions/checkout@v4
58      - uses: cachix/install-nix-action@v31
59        with:
60          github_access_token: ${{ secrets.GITHUB_TOKEN }}
61      - uses: cachix/cachix-action@v15
62        with:
63          name: iamb-prs
64          authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
65      - name: Flake check
66        run: |
67          nix flake show
68          nix flake check --print-build-logs
69