forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: extract test.yaml into a resusable workflow
github's matrix machinery does not allow us to attach extra elements to an existing matrix, for instance, we cannot add the combination of `{compiler: clang-18, standard: 23, mode: release, enables: dpdk}` to a matrix of `{compiler: [clang-18, gcc-13], mode: [debug, release], standard: [20, 23]}`, without overwriting the combination of `{compiler: clang-18, standard: 23, mode: release}` generated by the matrix above. as the combination with "enables: dpdk" matches with it. to address this issue, we use the approach that we were using when defining the circleci workflow: to define a parameterized workflow, so that we can customize the behavior of the caller workflow using either a matrix or a hardwired combination. this change just extract the reuseable workflow out, and call it in the parent workflow. we will replace the unrolled `inputs` list with 3 different jobs, with which we will have - 12 combinations generated with the matrix - 1 combination for dpdk build - 1 combination for C++20 build instead of: - 10 combinations - 1 combination for dpdk build - 1 combination for C++20 build Signed-off-by: Kefu Chai <[email protected]>
- Loading branch information
Showing
2 changed files
with
96 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Test | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
compiler: | ||
required: true | ||
# only the compilers supported by setup-cpp can be used | ||
description: 'the C++ compiler to use' | ||
type: string | ||
standard: | ||
required: true | ||
description: 'the C++ standard to use' | ||
type: number | ||
mode: | ||
required: true | ||
type: choice | ||
description: 'build mode' | ||
options: | ||
- debug | ||
- dev | ||
- release | ||
enables: | ||
required: false | ||
type: string | ||
description: 'the --enable-* option passed to configure.py' | ||
default: '' | ||
options: | ||
required: false | ||
type: string | ||
description: 'additional options passed to configure.py' | ||
default: '' | ||
|
||
jobs: | ||
test: | ||
name: "Tests (${{ matrix.compiler }}, C++${{ matrix.standard}}, ${{ matrix.mode }}, ${{ matrix.enables }})" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "${{ contains(matrix.enables, 'dpdk') }}" | ||
|
||
- name: Install build dependencies | ||
run: | | ||
sudo ./install-dependencies.sh | ||
- name: Install ${{ matrix.compiler }} | ||
uses: aminya/setup-cpp@master | ||
with: | ||
compiler: ${{ matrix.compiler }} | ||
ccache: true | ||
# ubuntu:latest comes with CMake 3.29, so we just need to install | ||
# ninja. see | ||
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#tools | ||
ninja: "${{ contains(matrix.enables, 'cxx-modules') }}" | ||
|
||
- name: Setup ccache | ||
uses: hendrikmuhs/ccache-action@v1 | ||
with: | ||
key: ${{ matrix.compiler }}-${{ matrix.standard }}-${{ matrix.mode }}-${{ matrix.enables }} | ||
|
||
- name: Configure | ||
run: > | ||
./configure.py | ||
--ccache | ||
--c++-standard ${{ matrix.standard }} | ||
--compiler $CXX | ||
--c-compiler $CC | ||
--mode ${{ matrix.mode }} | ||
${{ matrix.options }} | ||
${{ matrix.enables }} ; | ||
- name: Build | ||
run: cmake --build build/${{matrix.mode}} | ||
|
||
- name: Check Header | ||
if: ${{ matrix.mode == 'dev' && matrix.compiler == 'clang++-18' }} | ||
run: cmake --build build/${{ matrix.mode }} --target checkheaders | ||
|
||
- name: Build with C++20 modules | ||
if: ${{ contains(matrix.enables, 'cxx-modules') }} | ||
run: cmake --build build/${{ matrix.mode }} --target hello_cxx_module | ||
|
||
- name: Test | ||
if: ${{ ! contains(matrix.enables, 'cxx-modules') }} | ||
run: ./test.py --mode=${{ matrix.mode }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters