-
-
Notifications
You must be signed in to change notification settings - Fork 251
79 lines (69 loc) · 2.67 KB
/
ci.yml
File metadata and controls
79 lines (69 loc) · 2.67 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
name: Nix CI
on:
push:
branches:
- main
pull_request:
# Trigger manually to optionally include heavier/unstable targets
workflow_dispatch:
inputs:
include_optional:
description: 'Include optional targets (SDL2, Intel Mac)'
type: boolean
default: false
jobs:
# 1. Job to generate the matrix dynamically based on inputs
setup:
runs-on: ubuntu-latest
outputs:
os: ${{ steps.set-matrix.outputs.os }}
backend: ${{ steps.set-matrix.outputs.backend }}
steps:
- name: Generate Matrix JSON
id: set-matrix
uses: actions/github-script@v7
with:
script: |
// Default configuration (Stable & Lightweight targets)
let osList = ["ubuntu-24.04", "ubuntu-24.04-arm", "macos-15"];
let backendList = ["lem-ncurses", "lem-webview"];
// Check if optional targets should be included
// (Only strictly when triggered via workflow_dispatch with the flag set to true)
if (context.payload.inputs && context.payload.inputs.include_optional === 'true') {
console.log("Adding optional targets (SDL2, Intel Mac)...");
osList.push("macos-15-intel");
backendList.push("lem-sdl2");
}
// Set outputs for the next job to consume
core.setOutput('os', JSON.stringify(osList));
core.setOutput('backend', JSON.stringify(backendList));
# 2. Build job using the dynamically generated matrix
build:
needs: setup
name: builds ${{ matrix.backend }} on ${{ matrix.os }}
# The 'runs-on' key also uses the dynamic matrix
runs-on: ${{ matrix.os }}
# FlakeHub Cache authenticates via GitHub OIDC, which needs id-token: write.
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
# Parse JSON strings from the setup job outputs
os: ${{ fromJson(needs.setup.outputs.os) }}
backend: ${{ fromJson(needs.setup.outputs.backend) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
# magic-nix-cache-action was sunset 2025-02-01 and now rate-limits /
# 418s, causing intermittent "no substituter" failures. FlakeHub Cache
# is its supported successor (auth via the OIDC token above).
- name: Setup FlakeHub Cache
uses: DeterminateSystems/flakehub-cache-action@main
- name: Check flake
run: nix flake check --all-systems --no-build
- name: Build ${{ matrix.backend }}
run: nix build .#${{ matrix.backend }} --print-build-logs