dotfiles/.github/workflows/test.yml

56 lines
1.4 KiB
YAML
Raw Normal View History

2022-09-18 20:14:35 +00:00
name: "Test"
on:
pull_request:
push:
jobs:
2022-09-19 04:07:03 +00:00
calculate-matrix:
name: Calculate build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
- name: Calculate build matrix
id: set-matrix
run: |
matrix=$(nix flake show --json | jq -c '.nixosConfigurations | keys')
echo "::set-output name=matrix::$matrix"
2022-09-18 20:14:35 +00:00
tests:
2022-09-19 04:07:03 +00:00
name: Build NixOS configurations
2022-09-18 20:14:35 +00:00
runs-on: ubuntu-latest
2022-09-19 04:07:03 +00:00
needs:
- calculate-matrix
strategy:
fail-fast: false
matrix:
target: "${{ fromJson(needs.calculate-matrix.outputs.matrix) }}"
2022-09-18 20:14:35 +00:00
steps:
- uses: actions/checkout@v2.4.0
2022-09-19 04:07:03 +00:00
2022-09-18 20:14:35 +00:00
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
2022-09-19 04:07:03 +00:00
2022-09-18 20:14:35 +00:00
- uses: cachix/cachix-action@v10
with:
name: alejandro-dotfiles
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
2022-09-19 04:07:03 +00:00
2022-09-18 20:14:35 +00:00
- run: nix-env -i nixos-rebuild -f '<nixpkgs>'
2022-09-19 04:07:03 +00:00
- run: nixos-rebuild build --flake ".#${{ matrix.target }}"
2022-09-18 20:14:35 +00:00
- run: echo OK