Garnix -> Github Actions
It's much easier for forks to use GHA than it is to sign up for another proprietary service. I was annoyed by this myself when I forked nix-eval-jobs to nix-unit.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
name: Nix actions
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
- release-*
|
||||
|
||||
jobs:
|
||||
nix-matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v23
|
||||
- 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@v23
|
||||
- run: nix build -L ".#${{ matrix.attr }}"
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Nix Flakes doesn't work on shallow clones
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v23
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
extra_nix_config: |
|
||||
accept-flake-config = true
|
||||
- name: Build
|
||||
run: nix develop -c bash -c 'meson build && cd build && ninja'
|
||||
- name: Run tests
|
||||
run: nix develop -c pytest ./tests
|
||||
|
||||
collect:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- nix-build
|
||||
- tests
|
||||
steps:
|
||||
- run: true
|
||||
@@ -1,28 +0,0 @@
|
||||
name: "Tests"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
- release-*
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# Nix Flakes doesn't work on shallow clones
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v23
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
extra_nix_config: |
|
||||
accept-flake-config = true
|
||||
- name: Build
|
||||
run: nix develop -c bash -c 'meson build && cd build && ninja'
|
||||
- name: Run tests
|
||||
run: nix develop -c pytest ./tests
|
||||
Reference in New Issue
Block a user