aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: e720a5246d01e4c2b88feb28fc855f6c25d1cf9c (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
55
56
57
58
59
60
61
62
63
64
65
name: build
on:
  pull_request:
  push:
jobs:
  build:
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-11
        nix:
          - name: 2.5.1
            url: https://releases.nixos.org/nix/nix-2.5.1/install
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/[email protected]
      - uses: cachix/install-nix-action@v15
        with:
          install_url: ${{ matrix.nix.url }}
          extra_nix_config: |
            experimental-features = nix-command flakes

      - name: enable binary cache
        uses: cachix/cachix-action@v10
        with:
          name: statix
          authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

      - run: nix flake check

      - name: build statix
        run: nix build -L

      - name: build and install statix with flake-compat
        run: nix-env -if default.nix

  tests:
    strategy:
      matrix:
        os:
          - ubuntu-latest
        nix:
          - name: 2.5.1
            url: https://releases.nixos.org/nix/nix-2.5.1/install
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/[email protected]

      - uses: cachix/install-nix-action@v15
        with:
          install_url: ${{ matrix.nix.url }}
          extra_nix_config: |
            experimental-features = nix-command flakes

      - uses: cachix/cachix-action@v10
        with:
          name: statix
          authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

      - name: set up pinned nixpkgs
        run: echo "NIX_PATH=nixpkgs=$(nix-instantiate --eval flake-compat.nix -A defaultNix.inputs.nixpkgs.outPath | sed 's|\"||g')" >> $GITHUB_ENV

      - run: nix-shell --run "cargo test"