Commit baac8fa 1 parent 76d4ec6 commit baac8fa Copy full SHA for baac8fa
File tree 6 files changed +93
-9
lines changed
6 files changed +93
-9
lines changed Original file line number Diff line number Diff line change 27
27
matrix :
28
28
os :
29
29
- ubuntu-24.04
30
- - macos-13 # Intel. Do not use macos-14 to prefer architecture - https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
30
+ - macos-14 # M1. Doesn't match for my Intel Mac, but preferring with the speed.
31
31
- windows-latest
32
32
runs-on : ${{ matrix.os }}
33
33
steps :
Original file line number Diff line number Diff line change 22
22
workflow_dispatch :
23
23
24
24
jobs :
25
+ generate_matrix :
26
+ timeout-minutes : 5
27
+ runs-on : ubuntu-24.04
28
+ outputs :
29
+ matrix : ${{ steps.generator.outputs.matrix }}
30
+ steps :
31
+ - uses : actions/checkout@v4
32
+ - name : Set up Go
33
+ uses : actions/setup-go@v5
34
+ with :
35
+ go-version-file : ' go.mod'
36
+ cache-dependency-path : ' go.sum'
37
+ - name : Install gh-action-escape
38
+ run : curl -fsSL https://raw.githubusercontent.com/kachick/gh-action-escape/main/scripts/install-in-github-action.sh | sh -s v0.2.0
39
+ - name : Generate Matrix
40
+ id : generator
41
+ run : |
42
+ go run ./cmd/gen_matrix -event_name '${{ github.event_name }}' | gh-action-escape -name=matrix | tee -a "$GITHUB_OUTPUT"
25
43
home-manager :
44
+ needs : [generate_matrix]
26
45
if : (github.event_name != 'pull_request') || (!github.event.pull_request.draft)
27
46
timeout-minutes : 30
28
47
strategy :
29
48
fail-fast : false
30
- matrix :
31
- os :
32
- - ubuntu-24.04
33
- - macos-13 # Intel. Do not use macos-14 to prefer architecture - https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
34
-
49
+ matrix : ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
35
50
runs-on : ${{ matrix.os }}
36
51
steps :
37
52
# Do not use DeterminateSystems/magic-nix-cache-action for home workflow, it always faced to GitHub rate limit because of home depends on many packages
Original file line number Diff line number Diff line change 28
28
matrix :
29
29
os :
30
30
- ubuntu-24.04
31
- - macos-13 # Intel. Do not use macos-14 to prefer architecture - https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
31
+ - macos-14 # M1. Doesn't match for my Intel Mac, but preferring with the speed.
32
32
runs-on : ${{ matrix.os }}
33
33
timeout-minutes : 30
34
34
steps :
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "encoding/json"
5
+ "flag"
6
+ "fmt"
7
+ "log"
8
+ )
9
+
10
+ type Matrix struct {
11
+ Os []string `json:"os"`
12
+ }
13
+
14
+ func main () {
15
+ eventNameFlag := flag .String ("event_name" , "" , "github.event_name" )
16
+
17
+ flag .Parse ()
18
+
19
+ eventName := * eventNameFlag
20
+
21
+ if eventName == "" {
22
+ flag .Usage ()
23
+ log .Fatalln ("empty event_name is given" )
24
+ }
25
+
26
+ matrix := Matrix {
27
+ // https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811
28
+ Os : []string {
29
+ "ubuntu-24.04" ,
30
+ // M1. Doesn't match for my Intel Mac, but preferring with the speed.
31
+ "macos-14" ,
32
+ },
33
+ }
34
+
35
+ if eventName != "pull_request" {
36
+ matrix .Os = append (matrix .Os ,
37
+ // Intel. Correct with the architecture. But basically skipping because of it is much slow to complete.
38
+ "macos-13" ,
39
+ )
40
+ }
41
+
42
+ bytes , err := json .MarshalIndent (matrix , "" , " " )
43
+ if err != nil {
44
+ log .Fatalln ("can't marshal generated JSON matrix" )
45
+ }
46
+
47
+ fmt .Println (string (bytes ))
48
+ }
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ So you should manually install followings.
12
12
13
13
## Limitations
14
14
15
- - I only have x86-64 macbook pro, it is much slow in GitHub action macos-13 runner.
15
+ - I only have x86-64 macbook pro, it is much slow in GitHub action macos-13 runner.\
16
+ So preferring macos-14 runner in several place...
Original file line number Diff line number Diff line change 196
196
edge-pkgs = edge-nixpkgs . legacyPackages . x86_64-darwin ;
197
197
} ;
198
198
} ;
199
+
200
+ aarch64-macOS = {
201
+ pkgs = nixpkgs . legacyPackages . aarch64-darwin ;
202
+ extraSpecialArgs = {
203
+ homemade-pkgs = homemade-packages . aarch64-darwin ;
204
+ edge-pkgs = edge-nixpkgs . legacyPackages . aarch64-darwin ;
205
+ } ;
206
+ } ;
199
207
in
200
208
{
201
209
"kachick@linux-gui" = home-manager . lib . homeManagerConfiguration (
237
245
) ;
238
246
239
247
"github-actions@macos-13" = home-manager . lib . homeManagerConfiguration (
240
- x86-macOS
248
+ aarch64-macOS
249
+ // {
250
+ # Prefer "kachick" over "common" only here.
251
+ # Using values as much as possible as actual values to create a robust CI
252
+ modules = [
253
+ ./home-manager/kachick.nix
254
+ { home . username = "runner" ; }
255
+ ] ;
256
+ }
257
+ ) ;
258
+
259
+ "github-actions@macos-14" = home-manager . lib . homeManagerConfiguration (
260
+ aarch64-macOS
241
261
// {
242
262
# Prefer "kachick" over "common" only here.
243
263
# Using values as much as possible as actual values to create a robust CI
You can’t perform that action at this time.
0 commit comments