Skip to content

Commit 4d172e2

Browse files
committed
Generate GH Actions jobs from Nix flake checks
1 parent 9894162 commit 4d172e2

File tree

1 file changed

+37
-39
lines changed

1 file changed

+37
-39
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: CI
22

3+
# To run all of the below checks locally, run `nix flake check -L`
4+
35
on:
46
push:
57
branches:
@@ -15,60 +17,56 @@ concurrency:
1517
cancel-in-progress: true
1618

1719
jobs:
18-
run-checks:
19-
# To run all of the below checks locally, run `nix flake check -L`
20+
flake-check:
21+
name: nix flake check
22+
runs-on: ubuntu-latest
23+
outputs:
24+
checks: ${{ steps.list-checks.outputs.checks }}
25+
steps:
26+
- uses: actions/[email protected]
27+
with:
28+
fetch-depth: 0
29+
filter: "tree:0"
30+
- name: Install Nix
31+
run: |
32+
curl --proto '=https' --tlsv1.2 -sSf -L \
33+
https://install.lix.systems/lix | sh -s -- install --no-confirm
34+
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
35+
extra-substituters = https://d17qv3gttz4z4k.cloudfront.net
36+
extra-trusted-public-keys = gglite-nix-cache-1:Zdz1mEqn//xa8ORxHkc76auwxmX8/6C2K/zWRjmq8Co=
37+
log-lines = 0
38+
EOF
39+
- name: Check flake
40+
run:
41+
nix flake check --no-build --all-systems -L
42+
- name: List flake checks
43+
id: list-checks
44+
run:
45+
echo "checks=$(nix eval .#checks.x86_64-linux --apply
46+
builtins.attrNames --json)" >> $GITHUB_OUTPUT
47+
build-checks:
48+
needs: flake-check
2049
timeout-minutes: 60
2150
strategy:
2251
fail-fast: false
2352
matrix:
24-
include:
25-
- name: build with GCC
26-
check: packages-default
27-
- name: build static
28-
check: packages-ggl-sdk-static
29-
- name: cross-build armv7l static
30-
check: packages-ggl-sdk-static-armv7l
31-
- name: cross-build aarch64 static
32-
check: packages-ggl-sdk-static-aarch64
33-
- name: build with Clang
34-
check: build-clang
35-
- name: build shared lib
36-
check: build-shared
37-
- name: Rust crate
38-
check: build-rust-crate
39-
- name: formatting
40-
check: formatting
41-
- name: clang-tidy
42-
check: clang-tidy
43-
- name: namespacing
44-
check: namespacing
45-
- name: cbmc-contracts
46-
check: cbmc-contracts
47-
- name: header includes
48-
check: iwyu
49-
- name: editorconfig
50-
check: editorconfig
51-
- name: spelling
52-
check: spelling
53-
- name: cmake-lint
54-
check: cmake-lint
55-
name: Check ${{ matrix.name }}
53+
check: ${{ fromJson(needs.flake-check.outputs.checks) }}
54+
name: ${{ matrix.check }}
5655
runs-on: ubuntu-latest
5756
steps:
5857
- uses: actions/[email protected]
5958
with:
6059
fetch-depth: 0
6160
filter: "tree:0"
6261
- name: Install Nix
63-
run:
64-
curl --proto '=https' --tlsv1.2 -sSf -L
65-
https://install.lix.systems/lix | sh -s -- install --no-confirm
66-
67-
- name: Check ${{ matrix.name }}
6862
run: |
63+
curl --proto '=https' --tlsv1.2 -sSf -L \
64+
https://install.lix.systems/lix | sh -s -- install --no-confirm
6965
sudo tee -a /etc/nix/nix.conf > /dev/null <<EOF
7066
extra-substituters = https://d17qv3gttz4z4k.cloudfront.net
7167
extra-trusted-public-keys = gglite-nix-cache-1:Zdz1mEqn//xa8ORxHkc76auwxmX8/6C2K/zWRjmq8Co=
7268
log-lines = 0
7369
EOF
70+
- name: ${{ matrix.check }}
71+
run: |
7472
nix build -L .#checks.x86_64-linux.${{ matrix.check }}

0 commit comments

Comments
 (0)