produce dynamic checks for actions

This commit is contained in:
ibizaman 2024-10-24 15:36:00 +02:00
parent 0fdae72f02
commit 33028081af

View file

@ -15,8 +15,9 @@ on:
pull_request: pull_request:
push: push:
branches: [ "main" ] branches: [ "main" ]
jobs: jobs:
tests: build-matrix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
@ -32,10 +33,35 @@ jobs:
name: selfhostblocks name: selfhostblocks
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Run tests - name: Run tests
id: generate-checks
run: | run: |
nix flake show --allow-import-from-derivation --json \ nix flake show --allow-import-from-derivation --json \
| jq '.["checks"]["x86_64-linux"] | keys[]' \ | jq '.["checks"]["x86_64-linux"] | keys'
| xargs -n1 -IO nix build .#checks.x86_64-linux.O outputs:
matrix: ${{ steps.generate-matrix.outputs.dynamic_list }}
tests:
runs-on: ubuntu-latest
needs: [ "build-matrix" ]
strategy:
matrix:
test: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
- name: Setup Caching
uses: cachix/cachix-action@v14
with:
name: selfhostblocks
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build
run: |
nix build .#checks.x86_64-linux.${{ matrix.job }}
# nix run github:Mic92/nix-fast-build -- \ # nix run github:Mic92/nix-fast-build -- \
# --skip-cached --no-nom \ # --skip-cached --no-nom \