Skip to content

Commit 77645ea

Browse files
committed
[workflow] stop using tests-matrix and veristat-matrix
At this stage, we are already not using `test-matrix` anymore, so let's remove it and move the logic of adding the tests within the first loop over the matrix. For where to run veristat, as eluded to in a comment I am removing, we can control that from within matrix.py directly. Finally, we probably don't care on what/where veristat runs on. Let's default to wherever we are currently running builds and tests. Unless specified on the matrix, we will not run veristat. Finally, here is what the output of matrix looks like ``` GITHUB_REPOSITORY_OWNER=kernel-patches GITHUB_REPOSITORY=vmtest GITHUB_OUTPUT=/dev/stdout python3 .github/scripts/matrix.py | cut -d= -f2- | jq . { "include": [ { "kernel": "LATEST", "runs_on": [ "ubuntu-20.04" ], "arch": "x86_64", "toolchain": "gcc", "llvm-version": "16", "run_veristat": true, "toolchain_full": "gcc", "tests": { "include": [ { "test": "test_progs", "continue_on_error": false, "timeout_minutes": 360 }, { "test": "test_progs_parallel", "continue_on_error": true, "timeout_minutes": 30 }, { "test": "test_progs_no_alu32", "continue_on_error": false, "timeout_minutes": 360 }, { "test": "test_progs_no_alu32_parallel", "continue_on_error": true, "timeout_minutes": 30 }, { "test": "test_maps", "continue_on_error": false, "timeout_minutes": 360 }, { "test": "test_verifier", "continue_on_error": false, "timeout_minutes": 360 } ] } }, { "kernel": "LATEST", "runs_on": [ "ubuntu-20.04" ], "arch": "x86_64", "toolchain": "llvm", "llvm-version": "16", "toolchain_full": "llvm-16", "run_veristat": false, "tests": { "include": [ { "test": "test_progs", "continue_on_error": false, "timeout_minutes": 360 }, { "test": "test_progs_parallel", "continue_on_error": true, "timeout_minutes": 30 }, { "test": "test_progs_no_alu32", "continue_on_error": false, "timeout_minutes": 360 }, { "test": "test_progs_no_alu32_parallel", "continue_on_error": true, "timeout_minutes": 30 }, { "test": "test_maps", "continue_on_error": false, "timeout_minutes": 360 }, { "test": "test_verifier", "continue_on_error": false, "timeout_minutes": 360 } ] } } ] } ``` Signed-off-by: Manu Bretelle <chantr4@gmail.com>
1 parent 83a74e7 commit 77645ea

File tree

3 files changed

+19
-41
lines changed

3 files changed

+19
-41
lines changed

.github/scripts/matrix.py

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def get_tests(config):
6363
"arch": Arch.X86_64.value,
6464
"toolchain": "gcc",
6565
"llvm-version": "16",
66+
"run_veristat": True,
6667
},
6768
{
6869
"kernel": "LATEST",
@@ -105,6 +106,15 @@ def get_tests(config):
105106
else:
106107
matrix[idx]["toolchain_full"] = "llvm-" + matrix[idx]["llvm-version"]
107108

109+
# Set run_veristat to false by default.
110+
matrix[idx]["run_veristat"] = matrix[idx].get("run_veristat", False)
111+
# Feel in the tests
112+
matrix[idx]["tests"] = {"include": [
113+
generate_test_config(test)
114+
for test in get_tests(matrix[idx])
115+
]
116+
}
117+
108118
# Only a few repository within "kernel-patches" use self-hosted runners.
109119
if (
110120
os.environ["GITHUB_REPOSITORY_OWNER"] != "kernel-patches"
@@ -124,29 +134,6 @@ def get_tests(config):
124134
for idx in range(len(matrix) - 1, -1, -1):
125135
matrix[idx]["runs_on"].extend(["self-hosted", matrix[idx]["arch"]])
126136

127-
build_matrix = {"include": deepcopy(matrix)}
128-
# include test configs directly with the build config
129-
for config in build_matrix["include"]:
130-
config["tests"] = {"include": [
131-
generate_test_config(test)
132-
for test in get_tests(config)
133-
]}
134-
135-
set_output("build_matrix", dumps(build_matrix))
136-
137-
test_matrix = {
138-
"include": [
139-
{**config, **generate_test_config(test)}
140-
for config in matrix
141-
for test in get_tests(config)
142-
]
143-
}
144-
set_output("test_matrix", dumps(test_matrix))
145-
146-
veristat_runs_on = next(
147-
x["runs_on"]
148-
for x in matrix
149-
if x["arch"] == os.environ["veristat_arch"]
150-
and x["toolchain"] == os.environ["veristat_toolchain"]
151-
)
152-
set_output("veristat_runs_on", veristat_runs_on)
137+
build_matrix = {"include": matrix}
138+
139+
set_output("build_matrix", dumps(build_matrix))

.github/workflows/kernel-build-test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ on:
3131
required: true
3232
type: string
3333
description: A serialized json array with the tests to be running, it must follow the json-matrix format, https://www.jitsejan.com/use-github-actions-with-json-file-as-matrix
34-
veristat_runs_on:
34+
run_veristat:
3535
required: true
36-
type: string
37-
description: Runners to run veristat on.
36+
type: boolean
37+
description: Whether or not to run veristat
3838
secrets:
3939
AWS_ROLE_ARN:
4040
required: true
@@ -70,7 +70,7 @@ jobs:
7070
timeout_minutes: ${{ matrix.timeout_minutes }}
7171

7272
veristat:
73-
if: ${{ inputs.arch == 'x86_64' && inputs.toolchain == 'gcc' }}
73+
if: ${{ inputs.run_veristat }}
7474
uses: ./.github/workflows/kernel-veristat.yml
7575
needs: [build]
7676
permissions:
@@ -80,6 +80,6 @@ jobs:
8080
arch: ${{ inputs.arch }}
8181
toolchain: ${{ inputs.toolchain }}
8282
aws_region: ${{ vars.AWS_REGION }}
83-
runs_on: ${{ inputs.veristat_runs_on }}
83+
runs_on: ${{ inputs.runs_on }}
8484
secrets:
8585
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}

.github/workflows/test.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ on:
77
- bpf_base
88
- bpf-next_base
99

10-
# FIXME: We are using env variable here for set-matrix, and later in veristat job, hardcoded values
11-
# We should probably let the python script deal with it and generate a matrix that we pass onto
12-
# the reusable workflow.
13-
env:
14-
veristat_arch: x86_64
15-
veristat_toolchain: gcc
16-
1710
concurrency:
1811
group: ci-test-${{ github.ref_name }}
1912
cancel-in-progress: true
@@ -28,8 +21,6 @@ jobs:
2821
runs-on: ${{ github.repository_owner == 'kernel-patches' && 'x86_64' || 'ubuntu-latest' }}
2922
outputs:
3023
build-matrix: ${{ steps.set-matrix-impl.outputs.build_matrix }}
31-
test-matrix: ${{ steps.set-matrix-impl.outputs.test_matrix }}
32-
veristat-runs-on: ${{ steps.set-matrix-impl.outputs.veristat_runs_on }}
3324
steps:
3425
- uses: actions/checkout@v3
3526
- id: set-matrix-impl
@@ -56,6 +47,6 @@ jobs:
5647
llvm-version: ${{ matrix.llvm-version }}
5748
kernel: ${{ matrix.kernel }}
5849
tests: ${{ toJSON(matrix.tests) }}
59-
veristat_runs_on: ${{ needs.set-matrix.outputs.veristat-runs-on }}
50+
run_veristat: ${{ matrix.run_veristat }}
6051
secrets:
6152
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}

0 commit comments

Comments
 (0)