-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (88 loc) · 3.2 KB
/
nix-github-actions.yml
File metadata and controls
88 lines (88 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build systems and artifacts
on:
push:
branches:
- master
pull_request:
branches:
- master
# paths-ignore: []
jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
cachix: ${{ steps.set-matrix.outputs.cachix }}
artifacts: ${{ steps.set-matrix.outputs.artifacts }}
cachix_has_jobs: ${{ steps.set-matrix.outputs.cachix_has_jobs }}
artifacts_has_jobs: ${{ steps.set-matrix.outputs.artifacts_has_jobs }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: DeterminateSystems/nix-installer-action@v20
with:
extra-conf: accept-flake-config = true
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
cachix="$(nix eval --json '.#cachixActions.matrix')"
echo "cachix=$cachix" >> "$GITHUB_OUTPUT"
# Whether the cachix matrix has any jobs
cachix_has_jobs="$(jq -r '.include | length > 0' <<<"$cachix")"
echo "cachix_has_jobs=$cachix_has_jobs" >> "$GITHUB_OUTPUT"
artifacts="$(nix eval --json '.#artifactActions.matrix')"
echo "artifacts=$artifacts" >> "$GITHUB_OUTPUT"
# Whether the artifacts matrix has any jobs
artifacts_has_jobs="$(jq -r '.include | length > 0' <<<"$artifacts")"
echo "artifacts_has_jobs=$artifacts_has_jobs" >> "$GITHUB_OUTPUT"
nix-build-cachix:
name: ${{ matrix.name }} (${{ matrix.system }})
needs: nix-matrix
if: ${{ fromJSON(needs.nix-matrix.outputs.cachix_has_jobs) }}
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.cachix)}}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Nothing But Nix
uses: wimpysworld/nothing-but-nix@v10
with:
hatchet-protocol: 'cleave' # Options: holster, carve, cleave (default), rampage
- uses: DeterminateSystems/nix-installer-action@v20
with:
extra-conf: accept-flake-config = true
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: cachix/cachix-action@v16
with:
name: gigamonster256
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L '.#${{ matrix.attr }}'
nix-build-artifacts:
name: ${{ matrix.name }} (${{ matrix.system }})
needs: nix-matrix
if: ${{ fromJSON(needs.nix-matrix.outputs.artifacts_has_jobs) }}
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.artifacts)}}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Nothing But Nix
uses: wimpysworld/nothing-but-nix@v10
with:
hatchet-protocol: 'cleave' # Options: holster, carve, cleave (default), rampage
- uses: DeterminateSystems/nix-installer-action@v20
with:
extra-conf: accept-flake-config = true
- uses: DeterminateSystems/magic-nix-cache-action@v13
- run: nix build -L '.#${{ matrix.attr }}'
- uses: actions/upload-artifact@v7.0.0
with:
retention-days: 7
if-no-files-found: ignore
path: ./result
name: artifacts-${{ matrix.name }}