Skip to content

Commit 42dd521

Browse files
committed
Proof of concept for a hot-reload test case
1 parent 5910c0e commit 42dd521

File tree

14 files changed

+556
-83
lines changed

14 files changed

+556
-83
lines changed

.github/workflows/ci-cmake.yml

Lines changed: 133 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,57 +32,106 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
include:
35+
# Linux: Standard tests with bash
3536
- name: 🐧 Linux (GCC, Makefiles)
3637
os: ubuntu-22.04
3738
platform: linux
39+
compiler: ''
3840
config-flags: -DCMAKE_BUILD_TYPE=Release
41+
build-flags: ''
3942
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release.cmake
4043
artifact-path: cmake-build/bin/libgodot-cpp.linux.template_release.x86_64.a
44+
flags: ''
4145
run-tests: true
46+
godot_workflow: linux_builds.yml
47+
godot_artifact_name: linux-editor-mono
48+
godot_binary_path: godot.linuxbsd.editor.x86_64.mono
49+
test_shell: bash
50+
stable_url: https://github.com/godotengine/godot-builds/releases/download/4.5.1-stable/Godot_v4.5.1-stable_linux.x86_64.zip
51+
stable_binary_path: Godot_v4.5.1-stable_linux.x86_64
4252

53+
# Windows MSVC: Tests with pwsh, .exe binary
4354
- name: 🏁 Windows (x86_64, MSVC)
4455
os: windows-2022
4556
platform: windows
4657
compiler: msvc
58+
config-flags: ''
4759
build-flags: --config Release
4860
artifact-name: godot-cpp-windows-msvc2019-x86_64-release.cmake
4961
artifact-path: cmake-build/bin/libgodot-cpp.windows.template_release.x86_64.lib
50-
run-tests: false
62+
flags: ''
63+
run-tests: true
64+
godot_workflow: windows_builds.yml
65+
godot_artifact_name: windows-editor-mono
66+
godot_binary_path: godot.windows.editor.x86_64.mono.exe
67+
test_shell: pwsh
68+
stable_url: https://github.com/godotengine/godot-builds/releases/download/4.5.1-stable/Godot_v4.5.1-stable_win64.zip
69+
stable_binary_path: Godot_v4.5.1-stable_win64.exe
5170

71+
# macOS: Tests with bash, .app path
72+
- name: 🍎 macOS (universal, Makefiles)
73+
os: macos-latest
74+
platform: macos
75+
compiler: ''
76+
config-flags: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
77+
build-flags: ''
78+
artifact-name: godot-cpp-macos-universal-release.cmake
79+
artifact-path: cmake-build/bin/libgodot-cpp.macos.template_release.universal.a
80+
flags: ''
81+
run-tests: true
82+
godot_workflow: macos_builds.yml
83+
godot_artifact_name: macos-editor-mono
84+
godot_binary_path: Godot.app/Contents/MacOS/Godot
85+
test_shell: bash
86+
stable_url: https://github.com/godotengine/godot-builds/releases/download/4.5.1-stable/Godot_v4.5.1-stable_macos.universal.zip
87+
stable_binary_path: Godot_v4.5.1-stable_macos.universal/Godot.app/Contents/MacOS/Godot
88+
89+
# Windows MinGW: No tests
5290
- name: 🏁 Windows (x86_64, MinGW, Ninja)
5391
os: windows-2022
5492
platform: windows
5593
compiler: mingw
5694
config-flags:
5795
-GNinja -DCMAKE_BUILD_TYPE=Release
5896
-DCMAKE_CXX_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
97+
build-flags: ''
5998
artifact-name: godot-cpp-linux-mingw-x86_64-release.cmake
6099
artifact-path: cmake-build/bin/libgodot-cpp.windows.template_release.x86_64.a
100+
flags: ''
61101
run-tests: false
102+
godot_workflow: ''
103+
godot_artifact_name: ''
104+
godot_binary_path: ''
105+
test_shell: bash
106+
stable_url: ''
107+
stable_binary_path: ''
62108

63-
- name: 🍎 macOS (universal, Makefiles)
64-
os: macos-latest
65-
platform: macos
66-
config-flags: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
67-
artifact-name: godot-cpp-macos-universal-release.cmake
68-
artifact-path: cmake-build/bin/libgodot-cpp.macos.template_release.universal.a
69-
run-tests: false
70-
109+
# Android: No tests
71110
- name: 🤖 Android (arm64, Ninja)
72111
os: ubuntu-22.04
73112
platform: android
113+
compiler: ''
74114
config-flags:
75115
-G Ninja -DCMAKE_BUILD_TYPE=Release
76116
--toolchain ${ANDROID_HOME}/ndk/28.1.13356709/build/cmake/android.toolchain.cmake
77117
-DANDROID_PLATFORM=24 -DANDROID_ABI=arm64-v8a
118+
build-flags: ''
78119
artifact-name: godot-cpp-android-arm64-release.cmake
79120
artifact-path: cmake-build/bin/libgodot-cpp.android.template_release.arm64.a
80121
flags: arch=arm64
81122
run-tests: false
123+
godot_workflow: ''
124+
godot_artifact_name: ''
125+
godot_binary_path: ''
126+
test_shell: bash
127+
stable_url: ''
128+
stable_binary_path: ''
82129

130+
# iOS: No tests
83131
- name: 🍏 iOS (arm64, XCode)
84132
os: macos-latest
85133
platform: ios
134+
compiler: ''
86135
config-flags:
87136
-G Xcode
88137
--toolchain cmake/ios.toolchain.cmake
@@ -92,16 +141,32 @@ jobs:
92141
artifact-path: cmake-build/bin/libgodot-cpp.ios.template_release.arm64.a
93142
flags: arch=arm64
94143
run-tests: false
144+
godot_workflow: ''
145+
godot_artifact_name: ''
146+
godot_binary_path: ''
147+
test_shell: bash
148+
stable_url: ''
149+
stable_binary_path: ''
95150

151+
# Web: No tests
96152
- name: 🌐 Web (wasm32, Ninja)
97153
os: ubuntu-22.04
98154
platform: web
155+
compiler: ''
99156
config-flags:
100157
-G Ninja -DCMAKE_BUILD_TYPE=Release
101158
--toolchain ${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
159+
build-flags: ''
102160
artifact-name: godot-cpp-web-wasm32-release.cmake
103161
artifact-path: cmake-build/bin/libgodot-cpp.web.template_release.wasm32.a
162+
flags: ''
104163
run-tests: false
164+
godot_workflow: ''
165+
godot_artifact_name: ''
166+
godot_binary_path: ''
167+
test_shell: bash
168+
stable_url: ''
169+
stable_binary_path: ''
105170

106171
steps:
107172
- name: Checkout
@@ -140,43 +205,83 @@ jobs:
140205
shell: bash
141206
run: ${SCCACHE_PATH} --show-stats
142207

208+
# Godot Download & Prep (only if run-tests: true) - Identical to SCons
143209
- name: Download latest Godot artifacts
144-
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
210+
id: godot-download
145211
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
212+
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
146213
with:
147214
repo: godotengine/godot
148215
branch: master
149216
event: push
150-
workflow: linux_builds.yml
217+
workflow: ${{ matrix.godot_workflow }}
151218
workflow_conclusion: success
152-
name: linux-editor-mono
219+
name: ${{ matrix.godot_artifact_name }}
153220
search_artifacts: true
154221
check_artifacts: true
155222
ensure_latest: true
156223
path: godot-artifacts
224+
if_no_artifact_found: warn
225+
continue-on-error: true
157226

158-
- name: Prepare Godot artifacts for testing
159-
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
227+
- name: Download stable Godot (fallback or non-master)
228+
id: godot-fallback
229+
if: |
230+
matrix.run-tests &&
231+
(
232+
(env.GODOT_TEST_VERSION == 'master' && steps.godot-download.outcome != 'success') ||
233+
env.GODOT_TEST_VERSION != 'master'
234+
)
235+
shell: ${{ matrix.test_shell }}
236+
run: |
237+
curl -L -o Godot.zip "${{ matrix.stable_url }}"
238+
unzip -q Godot.zip
239+
echo "GODOT=$(pwd)/${{ matrix.stable_binary_path }}" >> $GITHUB_ENV
240+
241+
- name: Prepare Godot binary from artifacts
242+
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master' && steps.godot-download.outcome == 'success'
243+
shell: ${{ matrix.test_shell }}
160244
run: |
161-
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
162-
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
245+
if [ "${{ matrix.platform }}" != "windows" ]; then
246+
chmod +x "./godot-artifacts/${{ matrix.godot_binary_path }}"
247+
fi
248+
echo "GODOT=$(pwd)/godot-artifacts/${{ matrix.godot_binary_path }}" >> $GITHUB_ENV
249+
250+
- name: Verify Godot binary
251+
if: matrix.run-tests
252+
shell: ${{ matrix.test_shell }}
253+
run: $GODOT --headless --version
163254

164-
- name: Download requested Godot version for testing
165-
if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master'
255+
- name: Prep project import
256+
if: matrix.run-tests
257+
shell: ${{ matrix.test_shell }}
258+
run: |
259+
cd test/project
260+
timeout 30 $GODOT --import --headless || true
261+
262+
- name: Run unit tests
263+
if: matrix.run-tests
264+
shell: ${{ matrix.test_shell }}
265+
working-directory: test
166266
run: |
167-
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
168-
unzip -a Godot.zip
169-
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
170-
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
267+
if [ "${{ matrix.test_shell }}" = "pwsh" ]; then
268+
pwsh -File ./run-tests.ps1 --unit-only
269+
else
270+
./run-tests.sh --unit-only
271+
fi
171272
172-
- name: Run tests
273+
- name: Run reload test
173274
if: matrix.run-tests
275+
shell: ${{ matrix.test_shell }}
276+
working-directory: test
174277
run: |
175-
$GODOT --headless --version
176-
cd test
177-
# Need to run the editor so .godot is generated... but it crashes! Ignore that :-)
178-
(cd project && (timeout 30 $GODOT --import --headless >/dev/null 2>&1 || true))
179-
./run-tests.sh
278+
rm -f project/test_reload_lock
279+
if [ "${{ matrix.test_shell }}" = "pwsh" ]; then
280+
pwsh -File ./run-tests.ps1 --reload-only
281+
else
282+
./run-tests.sh --reload-only
283+
fi
284+
rm -f project/test_reload_lock
180285
181286
- name: Upload artifact
182287
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)