Skip to content

flake template checks: Reimplement as top-level flake checks #156

flake template checks: Reimplement as top-level flake checks

flake template checks: Reimplement as top-level flake checks #156

name: Nix Flake actions
on:
pull_request:
push:
branches:
- master
- main
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
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v15
with:
name: adisbladis
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
nix-build:
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
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v15
with:
name: adisbladis
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: nix build -L ".#${{ matrix.attr }}"
nix-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v15
with:
name: adisbladis
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build shell
run: nix develop -c true
- name: Run tests
run: nix develop -c nix-unit --flake .#libTests
nix-flake-show-templates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v15
with:
name: adisbladis
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Flake show hello-world
run: nix flake show --no-update-lock-file --override-input uv2nix . --reference-lock-file ./flake.lock ./templates/hello-world
- name: Show testing template
run: nix flake show --no-update-lock-file --override-input uv2nix . --reference-lock-file ./flake.lock ./templates/testing
collect:
runs-on: ubuntu-latest
needs:
- nix-unit
- nix-build
- nix-flake-show-templates
steps:
- run: true
deploy-pages:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: collect
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v15
with:
name: adisbladis
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Run build
run: nix build -L .#doc
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./result
force_orphan: true