Skip to content

Commit b6d3381

Browse files
authored
[CI] Introduce build type matrix workflows (#478)
- consolidate build and debug jobs using a `build_type` matrix - set `CMAKE_BUILD_TYPE` from the matrix variable - name uploaded artifacts based on the build type - fix macOS artifact naming
1 parent 67352f7 commit b6d3381

File tree

3 files changed

+21
-124
lines changed

3 files changed

+21
-124
lines changed

.github/workflows/mac.yml

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
jobs:
55
macos-clang-build:
66
runs-on: macOS-latest
7+
strategy:
8+
matrix:
9+
build_type: [Release, Debug]
710
steps:
811
- uses: actions/checkout@v4
912
with:
@@ -32,7 +35,7 @@ jobs:
3235
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
3336
-DCMAKE_C_FLAGS="-I$(brew --prefix)/opt/libomp/include"
3437
-DCMAKE_CXX_FLAGS="-I$(brew --prefix)/opt/libomp/include"
35-
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=install
38+
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=install
3639
- name: Build project
3740
run: |
3841
cmake --build build --parallel
@@ -43,49 +46,7 @@ jobs:
4346
uses: ./.github/actions/archive-install
4447
with:
4548
path: install
46-
name: macos-clang-sanitizer-install
47-
macos-clang-build-debug:
48-
runs-on: macOS-latest
49-
steps:
50-
- uses: actions/checkout@v4
51-
with:
52-
submodules: recursive
53-
- name: Install Xcode
54-
uses: maxim-lobanov/setup-xcode@v1
55-
with:
56-
xcode-version: 'latest-stable'
57-
- name: Setup environment
58-
run: |
59-
brew update-reset
60-
brew install ninja mpich llvm
61-
brew install libomp
62-
brew link libomp --overwrite --force
63-
brew install openssl
64-
brew link openssl --overwrite --force
65-
- name: ccache
66-
uses: hendrikmuhs/[email protected]
67-
with:
68-
key: ${{ runner.os }}-clang
69-
create-symlink: true
70-
max-size: 1G
71-
- name: CMake configure
72-
run: >
73-
cmake -S . -B build -G Ninja
74-
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
75-
-DCMAKE_C_FLAGS="-I$(brew --prefix)/opt/libomp/include"
76-
-DCMAKE_CXX_FLAGS="-I$(brew --prefix)/opt/libomp/include"
77-
-D CMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=install
78-
- name: Build project
79-
run: |
80-
cmake --build build --parallel
81-
- name: Install project
82-
run: |
83-
cmake --build build --target install
84-
- name: Archive installed package
85-
uses: ./.github/actions/archive-install
86-
with:
87-
path: install
88-
name: macos-clang-debug-install
49+
name: ${{ matrix.build_type == 'Debug' && 'macos-clang-debug-install' || 'macos-clang-install' }}
8950
macos-clang-test:
9051
needs:
9152
- macos-clang-build
@@ -107,11 +68,11 @@ jobs:
10768
- name: Download installed package
10869
uses: actions/download-artifact@v4
10970
with:
110-
name: macos-clang-sanitizer-install
71+
name: macos-clang-install
11172
- name: Extract installed package
11273
run: |
11374
mkdir -p install
114-
tar -xzvf macos-clang-sanitizer-install.tar.gz -C install
75+
tar -xzvf macos-clang-install.tar.gz -C install
11576
- name: Run func tests (MPI)
11677
run: python3 scripts/run_tests.py --running-type="processes" --counts 1 2 3 4
11778
env:
@@ -141,11 +102,11 @@ jobs:
141102
- name: Download installed package
142103
uses: actions/download-artifact@v4
143104
with:
144-
name: macos-clang-sanitizer-install
105+
name: macos-clang-install
145106
- name: Extract installed package
146107
run: |
147108
mkdir -p install
148-
tar -xzvf macos-clang-sanitizer-install.tar.gz -C install
109+
tar -xzvf macos-clang-install.tar.gz -C install
149110
- name: Run tests (threads extended)
150111
run: python3 scripts/run_tests.py --running-type="threads" --counts 5 7 11 13
151112
env:

.github/workflows/ubuntu.yml

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
os: ["ubuntu-24.04", "ubuntu-24.04-arm"]
10+
build_type: [Release, Debug]
1011
steps:
1112
- uses: actions/checkout@v4
1213
with:
@@ -26,13 +27,13 @@ jobs:
2627
run: >
2728
cmake -S . -B build -G Ninja
2829
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
29-
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=install
30+
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=install
3031
env:
3132
CC: gcc-14
3233
CXX: g++-14
3334
- name: Archive revert list
3435
uses: actions/upload-artifact@v4
35-
if: ${{ matrix.os == 'ubuntu-24.04' }}
36+
if: ${{ matrix.os == 'ubuntu-24.04' && matrix.build_type == 'Release' }}
3637
with:
3738
name: revert-list
3839
path: build/revert-list.txt
@@ -49,49 +50,9 @@ jobs:
4950
uses: ./.github/actions/archive-install
5051
with:
5152
path: install
52-
name: ubuntu-gcc-install-${{ matrix.os }}
53-
ubuntu-gcc-build-debug:
54-
runs-on: ${{ matrix.os }}
55-
strategy:
56-
matrix:
57-
os: ["ubuntu-24.04"]
58-
steps:
59-
- uses: actions/checkout@v4
60-
with:
61-
submodules: recursive
62-
- name: Setup environment
63-
run: |
64-
sudo apt-get update
65-
sudo apt-get install --no-install-recommends -y gcc-14 g++-14 ninja-build libmpich-dev libomp-dev valgrind
66-
python3 -m pip install -r requirements.txt
67-
- name: ccache
68-
uses: hendrikmuhs/[email protected]
69-
with:
70-
key: ${{ runner.os }}-gcc
71-
create-symlink: true
72-
max-size: 1G
73-
- name: CMake configure
74-
run: >
75-
cmake -S . -B build -G Ninja
76-
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
77-
-D CMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=install
78-
env:
79-
CC: gcc-14
80-
CXX: g++-14
81-
- name: Build project
82-
run: |
83-
cmake --build build --parallel
84-
env:
85-
CC: gcc-14
86-
CXX: g++-14
87-
- name: Install project
88-
run: |
89-
cmake --build build --target install
90-
- name: Archive installed package
91-
uses: ./.github/actions/archive-install
92-
with:
93-
path: install
94-
name: ubuntu-gcc-debug-install-${{ matrix.os }}
53+
name: ${{ matrix.build_type == 'Debug' &&
54+
format('ubuntu-gcc-debug-install-{0}', matrix.os) ||
55+
format('ubuntu-gcc-install-{0}', matrix.os) }}
9556
ubuntu-gcc-test:
9657
needs:
9758
- ubuntu-gcc-build

.github/workflows/windows.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
jobs:
55
windows-msvc-build:
66
runs-on: windows-latest
7+
strategy:
8+
matrix:
9+
build_type: [Release, Debug]
710
defaults:
811
run:
912
shell: bash
@@ -17,47 +20,19 @@ jobs:
1720
run: >
1821
cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
1922
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
20-
-D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=install
23+
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=install
2124
- name: Build project
2225
shell: bash
2326
run: |
24-
cmake --build build --config Release --parallel
25-
- name: Install project
26-
run: |
27-
cmake --build build --target install
28-
- name: Archive installed package
29-
uses: ./.github/actions/archive-install
30-
with:
31-
path: install
32-
name: windows-msvc-install
33-
windows-msvc-build-debug:
34-
runs-on: windows-latest
35-
defaults:
36-
run:
37-
shell: bash
38-
steps:
39-
- uses: actions/checkout@v4
40-
with:
41-
submodules: recursive
42-
- uses: ./.github/actions/setup-windows-toolchain
43-
- name: CMake configure
44-
shell: bash
45-
run: >
46-
cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
47-
-D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
48-
-D CMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=install
49-
- name: Build project
50-
shell: bash
51-
run: |
52-
cmake --build build --config Debug --parallel
27+
cmake --build build --config ${{ matrix.build_type }} --parallel
5328
- name: Install project
5429
run: |
5530
cmake --build build --target install
5631
- name: Archive installed package
5732
uses: ./.github/actions/archive-install
5833
with:
5934
path: install
60-
name: windows-msvc-debug-install
35+
name: ${{ matrix.build_type == 'Debug' && 'windows-msvc-debug-install' || 'windows-msvc-install' }}
6136
windows-msvc-test:
6237
needs:
6338
- windows-msvc-build

0 commit comments

Comments
 (0)