2022-01-08 08:42:19 +00:00
|
|
|
name: "Flake checks"
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
flake-checks:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
|
|
steps:
|
2022-03-07 23:12:51 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-08 08:42:19 +00:00
|
|
|
with:
|
|
|
|
# Nix Flakes doesn't work on shallow clones
|
|
|
|
fetch-depth: 0
|
2022-10-17 23:09:30 +00:00
|
|
|
- uses: cachix/install-nix-action@v18
|
2022-01-08 08:42:19 +00:00
|
|
|
with:
|
|
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
|
|
- id: set-matrix
|
|
|
|
run: |
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
matrix="$(nix flake show --json | jq '.checks."x86_64-linux" | keys' | jq -rcM '{attr: ., os: ["ubuntu-latest", "macos-latest"]}')"
|
|
|
|
echo "::set-output name=matrix::$matrix"
|
|
|
|
|
|
|
|
builds:
|
|
|
|
needs: flake-checks
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix: ${{fromJSON(needs.flake-checks.outputs.matrix)}}
|
|
|
|
steps:
|
2022-03-07 23:12:51 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-08 08:42:19 +00:00
|
|
|
with:
|
|
|
|
# Nix Flakes doesn't work on shallow clones
|
|
|
|
fetch-depth: 0
|
2022-10-17 23:09:30 +00:00
|
|
|
- uses: cachix/install-nix-action@v18
|
2022-01-08 08:42:19 +00:00
|
|
|
with:
|
|
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
|
|
- run: |
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
system=$(nix-instantiate --eval --expr builtins.currentSystem | jq -r)
|
|
|
|
nix build -L .#checks.$system.${{ matrix.attr }}
|