File tree 4 files changed +98
-28
lines changed
4 files changed +98
-28
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,21 @@ concurrency:
36
36
group : " ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}"
37
37
cancel-in-progress : true
38
38
jobs :
39
+ calculate_matrix :
40
+ name : Calculate job matrix
41
+ runs-on : ubuntu-latest
42
+ outputs :
43
+ jobs : " ${{ steps.jobs.outputs.jobs }}"
44
+ steps :
45
+ - name : Checkout the source code
46
+ uses : actions/checkout@v4
47
+ - name : Calculate the CI job matrix
48
+ run : python3 src/ci/scripts/calculate-job-matrix.py >> $GITHUB_OUTPUT
49
+ id : jobs
39
50
pr :
40
51
name : " PR - ${{ matrix.name }}"
52
+ needs :
53
+ - calculate_matrix
41
54
env :
42
55
PR_CI_JOB : 1
43
56
CI_JOB_NAME : " ${{ matrix.name }}"
51
64
continue-on-error : " ${{ matrix.name == 'mingw-check-tidy' }}"
52
65
strategy :
53
66
matrix :
54
- include :
55
- - name : mingw-check
56
- os : ubuntu-20.04-4core-16gb
57
- env : {}
58
- - name : mingw-check-tidy
59
- os : ubuntu-20.04-4core-16gb
60
- env : {}
61
- - name : x86_64-gnu-llvm-17
62
- env :
63
- ENABLE_GCC_CODEGEN : " 1"
64
- os : ubuntu-20.04-16core-64gb
65
- - name : x86_64-gnu-tools
66
- os : ubuntu-20.04-16core-64gb
67
- env : {}
67
+ include : " ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}"
68
68
defaults :
69
69
run :
70
70
shell : " ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}"
Original file line number Diff line number Diff line change @@ -340,30 +340,29 @@ concurrency:
340
340
cancel-in-progress : true
341
341
342
342
jobs :
343
+ calculate_matrix :
344
+ name : Calculate job matrix
345
+ runs-on : ubuntu-latest
346
+ outputs :
347
+ jobs : ${{ steps.jobs.outputs.jobs }}
348
+ steps :
349
+ - name : Checkout the source code
350
+ uses : actions/checkout@v4
351
+ - name : Calculate the CI job matrix
352
+ run : python3 src/ci/scripts/calculate-job-matrix.py >> $GITHUB_OUTPUT
353
+ id : jobs
343
354
pr :
344
355
<< : *base-ci-job
345
356
name : PR - ${{ matrix.name }}
357
+ needs : [ calculate_matrix ]
346
358
env :
347
359
<< : [*shared-ci-variables, *public-variables]
348
360
PR_CI_JOB : 1
349
361
if : github.event_name == 'pull_request'
350
362
continue-on-error : ${{ matrix.name == 'mingw-check-tidy' }}
351
363
strategy :
352
364
matrix :
353
- include :
354
- - name : mingw-check
355
- << : *job-linux-4c
356
-
357
- - name : mingw-check-tidy
358
- << : *job-linux-4c
359
-
360
- - name : x86_64-gnu-llvm-17
361
- env :
362
- ENABLE_GCC_CODEGEN : " 1"
363
- << : *job-linux-16c
364
-
365
- - name : x86_64-gnu-tools
366
- << : *job-linux-16c
365
+ include : ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
367
366
368
367
auto :
369
368
<< : *base-ci-job
Original file line number Diff line number Diff line change
1
+ x--expand-yaml-anchors--remove :
2
+ - &base-job
3
+ env : { }
4
+
5
+ - &job-linux-4c
6
+ os : ubuntu-20.04-4core-16gb
7
+ << : *base-job
8
+
9
+ - &job-linux-8c
10
+ os : ubuntu-20.04-8core-32gb
11
+ << : *base-job
12
+
13
+ - &job-linux-16c
14
+ os : ubuntu-20.04-16core-64gb
15
+ << : *base-job
16
+
17
+ - &job-macos-xl
18
+ os : macos-13 # We use the standard runner for now
19
+ << : *base-job
20
+
21
+ - &job-macos-m1
22
+ os : macos-14
23
+ << : *base-job
24
+
25
+ - &job-windows-8c
26
+ os : windows-2019-8core-32gb
27
+ << : *base-job
28
+
29
+ - &job-windows-16c
30
+ os : windows-2019-16core-64gb
31
+ << : *base-job
32
+
33
+ - &job-aarch64-linux
34
+ os : [ self-hosted, ARM64, linux ]
35
+
36
+ pr :
37
+ - name : mingw-check
38
+ << : *job-linux-4c
39
+ - name : mingw-check-tidy
40
+ << : *job-linux-4c
41
+ - name : x86_64-gnu-llvm-17
42
+ env :
43
+ ENABLE_GCC_CODEGEN : " 1"
44
+ << : *job-linux-16c
45
+ - name : x86_64-gnu-tools
46
+ << : *job-linux-16c
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ """
4
+ This script serves for generating a matrix of jobs that should
5
+ be executed on CI.
6
+
7
+ It reads job definitions from `src/ci/github-actions/jobs.yml`
8
+ and filters them based on the event that happened on CI.
9
+
10
+ Currently, it only supports PR builds.
11
+ """
12
+
13
+ import json
14
+ from pathlib import Path
15
+
16
+ import yaml
17
+
18
+ JOBS_YAML_PATH = Path (__file__ ).absolute ().parent .parent / "github-actions" / "jobs.yml"
19
+
20
+
21
+ if __name__ == "__main__" :
22
+ with open (JOBS_YAML_PATH ) as f :
23
+ jobs = yaml .safe_load (f )
24
+ job_output = jobs ["pr" ]
25
+ print (f"jobs={ json .dumps (job_output )} " )
You can’t perform that action at this time.
0 commit comments