🏡 index : ~doyle/rgit.git

on: [push, pull_request]

name: CI

jobs:
  nix-matrix:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - uses: actions/checkout@v4
      - uses: cachix/install-nix-action@v30
      - id: set-matrix
        name: Generate Nix Matrix
        run: |
          set -Eeu
          matrix="$(nix eval --json '.#githubActions.matrix')"
          echo "matrix=$matrix" >> "$GITHUB_OUTPUT"

  check:
    name: ${{ matrix.name }} (${{ matrix.system }})
    needs: nix-matrix
    runs-on: ${{ matrix.os }}
    strategy:
      matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
    steps:
      - uses: actions/checkout@v4
      - uses: cachix/install-nix-action@v30
      - name: Authenticate with Cachix
        uses: cachix/cachix-action@v15
        with:
          name: rgit
          authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
      - run: nix build -L '.#${{ matrix.attr }}'