Skip to content

Commit 0d71859

Browse files
committed
testing the usage of a matrix to flesh out test variants.
1 parent b18c1e6 commit 0d71859

File tree

1 file changed

+49
-43
lines changed

1 file changed

+49
-43
lines changed

.github/workflows/ci-cmake.yml

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,35 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38+
# ← New dimension — multiplies every platform automatically
39+
godot-api:
40+
- { version: "master", api-flag: "", artifact-suffix: "", test-versions: "" }
41+
- { version: "4.6", api-flag: "4.6", artifact-suffix: "-godot46", test-versions: "4.6-stable" }
42+
- { version: "4.5", api-flag: "4.5", artifact-suffix: "-godot45", test-versions: "4.5-stable 4.6-stable" }
43+
- { version: "4.4", api-flag: "4.4", artifact-suffix: "-godot44", test-versions: "4.4-stable 4.5-stable 4.6-stable" }
44+
- { version: "4.3", api-flag: "4.3", artifact-suffix: "-godot43", test-versions: "4.3-stable 4.4-stable 4.5-stable 4.6-stable" }
45+
46+
# ← One entry per platform (no duplication!)
3847
include:
48+
# Tested platforms (will get all 5 API versions)
3949
- name: 🐧 Linux (GCC, Makefiles)
4050
os: ubuntu-22.04
4151
platform: linux
42-
config-flags: -DCMAKE_BUILD_TYPE=Release
43-
artifact-name: godot-cpp-linux-glibc2.27-x86_64-cmake-release
52+
base-config-flags: -DCMAKE_BUILD_TYPE=Release
53+
base-artifact-name: godot-cpp-linux-glibc2.27-x86_64-cmake-release
4454
artifact-path: cmake-build/bin/libgodot-cpp.linux.template_release.x86_64.a
4555
run-tests: true
4656
godot-test-arch: "linux.x86_64"
4757
godot-master-workflow: linux_builds.yml
4858
godot-master-artifact: linux-editor-mono
4959

50-
- name: 🐧 Linux (GCC, Makefiles) for Godot 4.6
51-
os: ubuntu-22.04
52-
platform: linux
53-
config-flags:
54-
-DCMAKE_BUILD_TYPE=Release
55-
-DGODOTCPP_API_VERSION=4.6
56-
artifact-name: godot-cpp-linux-glibc2.27-x86_64-cmake-release-godot46
57-
artifact-path: cmake-build/bin/libgodot-cpp.linux.template_release.x86_64.a
58-
run-tests: true
59-
godot-test-versions: "4.6-stable"
60-
godot-test-arch: "linux.x86_64"
61-
godot-master-workflow: linux_builds.yml
62-
godot-master-artifact: linux-editor-mono
63-
6460
- name: 🏁 Windows (x86_64, MSVC)
6561
os: windows-2022
6662
platform: windows
6763
compiler: msvc
6864
build-flags: --config Release
69-
artifact-name: godot-cpp-windows-msvc2022-x86_64-cmake-release
65+
base-config-flags: "" # no extra flags needed
66+
base-artifact-name: godot-cpp-windows-msvc2022-x86_64-cmake-release
7067
artifact-path: cmake-build/bin/libgodot-cpp.windows.template_release.x86_64.lib
7168
run-tests: true
7269
godot-test-arch: "win64.exe"
@@ -77,10 +74,8 @@ jobs:
7774
os: windows-2022
7875
platform: windows
7976
compiler: mingw
80-
config-flags:
81-
-GNinja -DCMAKE_BUILD_TYPE=Release
82-
-DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
83-
artifact-name: godot-cpp-windows-mingw-x86_64-cmake-release
77+
base-config-flags: "-GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++"
78+
base-artifact-name: godot-cpp-windows-mingw-x86_64-cmake-release
8479
artifact-path: cmake-build/bin/libgodot-cpp.windows.template_release.x86_64.a
8580
run-tests: true
8681
godot-test-arch: "win64.exe"
@@ -90,43 +85,35 @@ jobs:
9085
- name: 🍎 macOS (universal, Makefiles)
9186
os: macos-latest
9287
platform: macos
93-
config-flags: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
94-
artifact-name: godot-cpp-macos-universal-cmake-release
88+
base-config-flags: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
89+
base-artifact-name: godot-cpp-macos-universal-cmake-release
9590
artifact-path: cmake-build/bin/libgodot-cpp.macos.template_release.universal.a
9691
run-tests: true
9792
godot-test-arch: "macos.universal"
9893
godot-master-workflow: macos_builds.yml
9994
godot-master-artifact: macos-editor
10095

101-
# Non-test platforms
96+
# Non-tested platforms (still only built once — master)
10297
- name: 🤖 Android (arm64, Ninja)
10398
os: ubuntu-22.04
10499
platform: android
105-
config-flags:
106-
-G Ninja -DCMAKE_BUILD_TYPE=Release
107-
--toolchain ${ANDROID_HOME}/ndk/28.1.13356709/build/cmake/android.toolchain.cmake
108-
-DANDROID_PLATFORM=24 -DANDROID_ABI=arm64-v8a
109-
artifact-name: godot-cpp-android-arm64-cmake-release
100+
base-config-flags: "-G Ninja -DCMAKE_BUILD_TYPE=Release --toolchain ${ANDROID_HOME}/ndk/28.1.13356709/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=24 -DANDROID_ABI=arm64-v8a"
101+
base-artifact-name: godot-cpp-android-arm64-cmake-release
110102
artifact-path: cmake-build/bin/libgodot-cpp.android.template_release.arm64.a
111103

112104
- name: 🍏 iOS (arm64, XCode)
113105
os: macos-latest
114106
platform: ios
115-
config-flags:
116-
-G Xcode
117-
--toolchain cmake/ios.toolchain.cmake
118-
-DPLATFORM=OS64
107+
base-config-flags: "-G Xcode --toolchain cmake/ios.toolchain.cmake -DPLATFORM=OS64"
119108
build-flags: --config Release
120-
artifact-name: godot-cpp-ios-arm64-cmake-release
109+
base-artifact-name: godot-cpp-ios-arm64-cmake-release
121110
artifact-path: cmake-build/bin/libgodot-cpp.ios.template_release.arm64.a
122111

123112
- name: 🌐 Web (wasm32, Ninja)
124113
os: ubuntu-22.04
125114
platform: web
126-
config-flags:
127-
-G Ninja -DCMAKE_BUILD_TYPE=Release
128-
--toolchain ${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
129-
artifact-name: godot-cpp-web-wasm32-cmake-release
115+
base-config-flags: "-G Ninja -DCMAKE_BUILD_TYPE=Release --toolchain ${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
116+
base-artifact-name: godot-cpp-web-wasm32-cmake-release
130117
artifact-path: cmake-build/bin/libgodot-cpp.web.template_release.wasm32.a
131118

132119
steps:
@@ -159,7 +146,13 @@ jobs:
159146
id: configure-debug
160147
run: |
161148
echo "DEBUG_BUILD_START=$(date +%s)" >> $GITHUB_ENV
162-
cmake --log-level=VERBOSE -S . -B cmake-build ${{ env.config-flags }} ${{ matrix.config-flags }}
149+
150+
CONFIG_FLAGS="${{ env.config-flags }} ${{ matrix.base-config-flags }}"
151+
if [ -n "${{ matrix.godot-api.api-flag }}" ]; then
152+
CONFIG_FLAGS="$CONFIG_FLAGS -DGODOTCPP_API_VERSION=${{ matrix.godot-api.api-flag }}"
153+
fi
154+
155+
cmake --log-level=VERBOSE -S . -B cmake-build $CONFIG_FLAGS
163156
164157
- name: Build godot-cpp-test (template_debug)
165158
id: build-debug
@@ -172,17 +165,25 @@ jobs:
172165
id: configure-release
173166
run: |
174167
echo "RELEASE_BUILD_START=$(date +%s)" >> $GITHUB_ENV
175-
cmake --fresh --log-level=VERBOSE -S . -B cmake-build -DGODOTCPP_TARGET=template_release ${{ env.config-flags }} ${{ matrix.config-flags }}
168+
169+
CONFIG_FLAGS="${{ env.config-flags }} ${{ matrix.base-config-flags }}"
170+
if [ -n "${{ matrix.godot-api.api-flag }}" ]; then
171+
CONFIG_FLAGS="$CONFIG_FLAGS -DGODOTCPP_API_VERSION=${{ matrix.godot-api.api-flag }}"
172+
fi
173+
174+
cmake --fresh --log-level=VERBOSE -S . -B cmake-build -DGODOTCPP_TARGET=template_release $CONFIG_FLAGS
175+
176176
177177
- name: Build godot-cpp-test (template_release)
178178
id: build-release
179179
run: |
180180
cmake --build cmake-build --verbose --target godot-cpp-test ${{ matrix.build-flags }}
181181
echo "RELEASE_BUILD_END=$(date +%s)" >> $GITHUB_ENV
182182
183+
# === Download Godot (only for master — cleaner than before) ===
183184
- name: Download latest Godot artifacts
184185
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
185-
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
186+
if: matrix.run-tests && matrix.godot-api.version == 'master'
186187
with:
187188
repo: godotengine/godot
188189
branch: master
@@ -195,17 +196,22 @@ jobs:
195196
ensure_latest: true
196197
path: godot-artifacts
197198

199+
# === Run tests – uses the pre-computed test versions ===
198200
- name: Run tests
199201
if: matrix.run-tests
200-
run: python -X utf8 run-tests.py --verbose --godot-test-versions "${{ matrix.godot-test-versions }}" --godot-test-arch "${{ matrix.godot-test-arch }}"
202+
run: |
203+
python -X utf8 run-tests.py --verbose \
204+
--godot-test-versions "${{ matrix.godot-api.test-versions }}" \
205+
--godot-test-arch "${{ matrix.godot-test-arch }}"
201206
working-directory: test
202207
env:
203208
GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }}
204209

210+
# === Upload – uses the dynamic artifact name ===
205211
- name: Upload artifact
206212
uses: actions/upload-artifact@v7
207213
with:
208-
name: ${{ matrix.artifact-name }}
214+
name: ${{ matrix.base-artifact-name }}${{ matrix.godot-api.artifact-suffix }}
209215
path: ${{ matrix.artifact-path }}
210216
if-no-files-found: error
211217

0 commit comments

Comments
 (0)