Skip to content

Make job matrix reusable#115

Merged
danielocfb merged 1 commit into
kernel-patches:masterfrom
danielocfb:topic/reuse-job-matrix
Aug 16, 2022
Merged

Make job matrix reusable#115
danielocfb merged 1 commit into
kernel-patches:masterfrom
danielocfb:topic/reuse-job-matrix

Conversation

@danielocfb
Copy link
Copy Markdown
Contributor

We run tests in various configurations: on x86_64 and s390x, with gcc
and clang toolchains. To define the setups to use we rely on the job
matrix feature of GitHub Actions [0].
In the future we would like to run the selftests in parallel in an
attempt to minimize overall CI runtime. As a first step towards getting
there, we want the running of selftests to be a separate job after the
building step.
Both running and building need to honor the job matrix, but GitHub
Actions does not allow us to simple configure the same matrix for
multiple jobs.
In order to make that possible, this change uses the job output feature
to "generate" the matrix, which can subsequently be used from various
locations (including different jobs). To make that work in the job
context, we now have to define the matrix in JSON and then decode it
when setting. The approach is inspired by the corresponding community
discussion [1].
As a side note, having the matrix "generated" like this is also the only
way I am aware of with which we can address the feedback received [2]
about potential conditional usage of self-hosted runners, depending on
which repository a GitHub Actions run is initiated from.

[0] https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
[1] https://github.com/orgs/community/discussions/26284
[2] #103

Signed-off-by: Daniel Müller deso@posteo.net

We run tests in various configurations: on x86_64 and s390x, with gcc
and clang toolchains. To define the setups to use we rely on the job
matrix feature of GitHub Actions [0].
In the future we would like to run the selftests in parallel in an
attempt to minimize overall CI runtime. As a first step towards getting
there, we want the running of selftests to be a separate job after the
building step.
Both running and building need to honor the job matrix, but GitHub
Actions does not allow us to simple configure the same matrix for
multiple jobs.
In order to make that possible, this change uses the job output feature
to "generate" the matrix, which can subsequently be used from various
locations (including different jobs). To make that work in the job
context, we now have to define the matrix in JSON and then decode it
when setting. The approach is inspired by the corresponding community
discussion [1].
As a side note, having the matrix "generated" like this is also the only
way I am aware of with which we can address the feedback received [2]
about potential conditional usage of self-hosted runners, depending on
which repository a GitHub Actions run is initiated from.

[0] https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
[1] https://github.com/orgs/community/discussions/26284
[2] kernel-patches#103

Signed-off-by: Daniel Müller <deso@posteo.net>
@danielocfb danielocfb merged commit 11c5f27 into kernel-patches:master Aug 16, 2022
@danielocfb danielocfb deleted the topic/reuse-job-matrix branch August 16, 2022 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants