ci: Use Nix to control the actions #503
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
pull_request_target: | |
name: "Continuous Integration" | |
concurrency: | |
group: ${{ github.repository }}-${{ github.workflow }} | |
cancel-in-progress: false | |
jobs: | |
nix-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v12 | |
- uses: DeterminateSystems/magic-nix-cache-action@v7 | |
- id: set-matrix | |
name: Generate Nix Matrix | |
run: | | |
set -euo pipefail | |
matrix="$(nix eval --json '.#githubActions.matrix')" | |
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" | |
nix-build: | |
needs: nix-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 10 | |
matrix: ${{ fromJSON(needs.nix-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v12 | |
- uses: DeterminateSystems/magic-nix-cache-action@v7 | |
- run: nix build -L ".#${{ matrix.attr }}" --keep-going | |
- run: nix develop -c cargo test |