Skip to content

Commit c9b05fd

Browse files
committed
Break the CI matrix into separate CMake and SPM paths
1 parent 906f231 commit c9b05fd

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

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

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ jobs:
6464
6565
devcontainer:
6666
needs: determine-version
67-
name: Ubuntu dev container/${{ matrix.cmake_build_type }}
67+
name: Ubuntu dev container/${{ matrix.cmake_build_type }}/${{ matrix.build_system }}
6868
strategy:
6969
fail-fast: false
7070
matrix:
71+
build_system: [cmake, spm]
7172
spm_configuration: [debug, release]
7273
include:
7374
- spm_configuration: debug
@@ -96,6 +97,7 @@ jobs:
9697
push: never
9798

9899
- name: Build and Test via CMake
100+
if: ${{ matrix.build_system == 'cmake' }}
99101
uses: devcontainers/[email protected]
100102
env:
101103
HYLO_LLVM_BUILD_TYPE: ${{ matrix.HYLO_LLVM_BUILD_TYPE }}
@@ -115,10 +117,8 @@ jobs:
115117
ctest --output-on-failure --parallel --test-dir .ninja-build
116118
push: never
117119

118-
- name: Reclaim disk space
119-
run: rm -rf .ninja-build
120-
121120
- name: Restore Cache for SPM
121+
if: ${{ matrix.build_system == 'spm' }}
122122
uses: actions/cache@v4
123123
with:
124124
path: .build
@@ -127,6 +127,7 @@ jobs:
127127
${{ runner.os }}-spm-
128128
129129
- name: Build and Test via SPM
130+
if: ${{ matrix.build_system == 'spm' }}
130131
uses: devcontainers/[email protected]
131132
with:
132133
runCmd: |
@@ -136,7 +137,7 @@ jobs:
136137

137138
- name: Export Coverage
138139
uses: devcontainers/[email protected]
139-
if: ${{ contains(matrix.more-spm-test-options, '--enable-code-coverage') }}
140+
if: ${{ matrix.build_system == 'spm' && contains(matrix.more-spm-test-options, '--enable-code-coverage') }}
140141
with:
141142
runCmd: |
142143
shopt -s nullglob
@@ -150,7 +151,7 @@ jobs:
150151
push: never
151152

152153
- name: Upload coverage reports to Codecov
153-
if: ${{ contains(matrix.more-spm-test-options, '--enable-code-coverage') }}
154+
if: ${{ matrix.build_system == 'spm' && contains(matrix.more-spm-test-options, '--enable-code-coverage') }}
154155
uses: codecov/[email protected]
155156
with:
156157
token: ${{ secrets.CODECOV_TOKEN }}
@@ -164,20 +165,23 @@ jobs:
164165

165166
native:
166167
needs: determine-version
167-
name: "Native: ${{ matrix.os }}/${{ matrix.spm_configuration }}/${{ matrix.cmake_generator }}"
168+
name: "Native: ${{ matrix.os }}/${{ matrix.spm_configuration }}/${{ matrix.build_system }}/${{ matrix.cmake_generator }}"
168169
strategy:
169170
fail-fast: false
170171
matrix:
171172
# macos-latest is apparently not the latest.
172173
os: [macos-13, ubuntu-latest, windows-latest]
173174
spm_configuration: [debug, release]
174175
cmake_generator: [Ninja, Xcode]
176+
build_system: [cmake, spm]
175177

176178
exclude:
177179
- os: ubuntu-latest
178180
cmake_generator: Xcode
179181
- os: windows-latest
180182
cmake_generator: Xcode
183+
- build_system: spm
184+
cmake_generator: Ninja
181185

182186
include:
183187
- HYLO_LLVM_BUILD_RELEASE: 20240303-215025
@@ -272,6 +276,7 @@ jobs:
272276
${{ matrix.unpackage_command }} ${{ env.llvm_package_basename }}${{ matrix.llvm_package_suffix }}
273277
274278
- name: Configure (CMake)
279+
if: ${{ matrix.build_system == 'cmake' }}
275280
# We explicitly point to swiftc in the PATH because otherwise CMake picks up the one in XCode.
276281
run: >-
277282
cmake -G '${{ matrix.cmake_generator }}' -S . -B .ninja-build
@@ -282,12 +287,14 @@ jobs:
282287
working-directory: hylo
283288

284289
- name: Build (CMake)
290+
if: ${{ matrix.build_system == 'cmake' }}
285291
run: cmake --build hylo/.ninja-build ${{ matrix.cmake_generator == 'Xcode' && format('--config {0}', matrix.cmake_build_type) || '' }}
286292

287293
- name: Test (CMake)
294+
if: ${{ matrix.build_system == 'cmake' }}
288295
run: ctest --output-on-failure --parallel --test-dir hylo/.ninja-build ${{ matrix.cmake_generator == 'Xcode' && format('-C {0}', matrix.cmake_build_type) || '' }}
289296

290-
- if: ${{ matrix.use_spm }}
297+
- if: ${{ matrix.build_system == 'spm' && matrix.use_spm }}
291298
name: Create LLVM pkgconfig file and make it findable
292299
run: >-
293300
set -ex -o pipefail
@@ -300,7 +307,7 @@ jobs:
300307
echo 'PKG_CONFIG_PATH=${{ github.workspace }}/pkg-config' >> "$GITHUB_ENV"
301308
shell: bash
302309

303-
- if: ${{ matrix.use_spm }}
310+
- if: ${{ matrix.build_system == 'spm' && matrix.use_spm }}
304311
uses: actions/cache@v4
305312
name: SPM cache setup
306313
with:
@@ -314,7 +321,7 @@ jobs:
314321
run: clang -c ./StandardLibrary/Sources/LibC.c -o HyloLibC.lib
315322
working-directory: hylo
316323

317-
- if: ${{ matrix.on_windows_and_spm_works }}
324+
- if: ${{ matrix.on_windows_and_spm_works && matrix.build_system == 'spm' }}
318325
name: Build the dependencies of build tools
319326
run: |
320327
echo 'SPM_BUILD_TOOL_SUPPORT_NO_REENTRANT_BUILD=1' >> $env:GITHUB_ENV
@@ -325,15 +332,15 @@ jobs:
325332
}
326333
working-directory: hylo
327334

328-
- if: ${{ matrix.use_spm }}
335+
- if: ${{ matrix.build_system == 'spm' && matrix.use_spm }}
329336
name: Build
330337
run: |
331338
swift build -c ${{ matrix.spm_configuration }} ${{ env.spm-build-options }} --build-tests
332339
${{ matrix.windows_only }} if (-not $?) { swift build ${{ env.spm-build-options }} --target BuildToolDependencies }
333340
334341
working-directory: hylo
335342

336-
- if: ${{ matrix.use_spm }}
343+
- if: ${{ matrix.build_system == 'spm' && matrix.use_spm }}
337344
name: Test
338345
run: |
339346
swift test --skip-build -c ${{ matrix.spm_configuration }} ${{ env.spm-build-options }} ${{ env.spm-test-options }}

0 commit comments

Comments
 (0)