-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (91 loc) · 3.01 KB
/
ci.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: CI
on:
workflow_dispatch:
merge_group:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
generate-matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Post initial package status comment
uses: marocchino/[email protected]
with:
recreate: true
message: |
Thanks for your Pull Request!
This comment will be updated automatically with the status of each package.
- name: Generate CI Matrix
id: generate-matrix
uses: ./.github/generate-matrix
with:
is-initial: 'true'
cachix-cache: ${{ vars.CACHIX_CACHE }}
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
comment: ${{ steps.generate-matrix.outputs.comment }}
build:
needs: generate-matrix
if: needs.generate-matrix.outputs.matrix != '{}' && needs.generate-matrix.outputs.matrix != '{"include":[]}'
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.generate-matrix.outputs.matrix)}}
name: ${{ matrix.package }} | ${{ matrix.system }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allowedToFail }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
with:
extra-conf:
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: ${{ vars.CACHIX_CACHE }}
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build ${{ matrix.package }}
run: nix build -L --json --no-link '.#packages.${{ matrix.attrPath }}'
results:
runs-on: ubuntu-latest
name: Final Results
needs: [build, generate-matrix]
steps:
- uses: actions/checkout@v4
- name: Generate Matrix
uses: ./.github/generate-matrix
with:
is-initial: 'false'
cachix-cache: ${{ vars.CACHIX_CACHE }}
- run: exit 1
if: >-
${{ fromJSON(needs.generate-matrix.outputs.matrix).include.length > 0 &&
(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
- run: exit 0
if: ${{fromJSON(needs.generate-matrix.outputs.matrix).include.length == 0}}
check-style:
name: Check style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
with:
extra-conf:
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: ${{ vars.CACHIX_CACHE }}
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build dev shell
run: nix develop .#ci -c echo 'Devshell built successfully.'
- name: Check style
run: nix develop .#ci -c pre-commit run --all-files