Skip to content

Commit 0dfbdbb

Browse files
committed
Copied Ivan's cmake-ci PR and stripped the cmake changes.
1 parent ee2a895 commit 0dfbdbb

File tree

1 file changed

+168
-86
lines changed

1 file changed

+168
-86
lines changed

.github/workflows/ci.yml

Lines changed: 168 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -17,78 +17,162 @@ concurrency:
1717

1818
jobs:
1919
build:
20-
name: ${{ matrix.name }}
21-
runs-on: ${{ matrix.os }}
20+
name: "${{ matrix.platform.name }} (${{ matrix.builder.name }}, ${{matrix.platform.description}})"
21+
runs-on: ${{ matrix.platform.os }}
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
include:
26-
- name: 🐧 Linux (GCC)
27-
os: ubuntu-22.04
25+
26+
# TODO: remove after CMake IOS config is ready
27+
exclude:
28+
- builder:
29+
name: CMake
30+
31+
platform:
32+
name: 🍏 iOS
33+
34+
builder:
35+
- name: SCons
36+
generate_sources: |
37+
scons {0} build_library=no verbose=yes
38+
scons -c
39+
40+
build_godot_cpp_debug: |
41+
scons {0} target=template_debug verbose=yes
42+
43+
build_debug: |
44+
cd test
45+
scons {0} target=template_debug build_library=no debug_symbols=yes optimize=debug verbose=yes
46+
47+
build_release: |
48+
cd test
49+
scons {0} target=template_release verbose=yes
50+
51+
- name: CMake
52+
generate_sources: |
53+
cmake {0} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -B build test
54+
55+
build_godot_cpp_debug: |
56+
cmake --build build --config Debug --target godot-cpp -v
57+
58+
build_debug: |
59+
cmake --build build --config Debug -v
60+
61+
build_release: |
62+
cmake {0} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DGODOT_TARGET=template_release -B build_release test
63+
cmake --build build_release --config Release -v
64+
65+
platform:
66+
- name: 🐧 Linux
67+
description: 'GCC'
68+
os: ubuntu-20.04
2869
platform: linux
2970
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
30-
artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a
71+
artifact-path:
72+
SCons: bin/libgodot-cpp.linux.template_release.x86_64.a
73+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.linux.template_release.x86_64.a
74+
flags:
75+
SCons: platform=linux
76+
CMake: -G "Ninja Multi-Config"
3177
run-tests: true
3278
cache-name: linux-x86_64
3379

34-
- name: 🐧 Linux (GCC, Double Precision)
35-
os: ubuntu-22.04
80+
- name: 🐧 Linux
81+
description: 'GCC, Double Precision'
82+
os: ubuntu-20.04
3683
platform: linux
3784
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
38-
artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
39-
flags: precision=double
85+
artifact-path:
86+
SCons: bin/libgodot-cpp.linux.template_release.double.x86_64.a
87+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.linux.template_release.double.x86_64.a
88+
flags:
89+
SCons: platform=linux precision=double
90+
CMake: -G "Ninja Multi-Config" -DGODOT_PRECISION=double
4091
run-tests: false
4192
cache-name: linux-x86_64-f64
4293

43-
- name: 🏁 Windows (x86_64, MSVC)
94+
- name: 🏁 Windows
95+
description: 'x86_64, MSVC'
4496
os: windows-2019
4597
platform: windows
4698
artifact-name: godot-cpp-windows-msvc2019-x86_64-release
47-
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.lib
99+
artifact-path:
100+
SCons: bin/libgodot-cpp.windows.template_release.x86_64.lib
101+
CMake: build_release/godot-cpp/bin/Release/godot-cpp.windows.template_release.x86_64.lib
102+
flags:
103+
Scons: platform=windows
104+
CMake: '-G "Visual Studio 16 2019" -A x64 -DCMAKE_VERBOSE_MAKEFILE=TRUE'
48105
run-tests: false
49106
cache-name: windows-x86_64-msvc
50107

51-
- name: 🏁 Windows (x86_64, MinGW)
108+
- name: 🏁 Windows
109+
description: 'x86_64, MinGW'
52110
os: windows-2019
53111
platform: windows
54112
artifact-name: godot-cpp-linux-mingw-x86_64-release
55-
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.a
56-
flags: use_mingw=yes
113+
artifact-path:
114+
SCons: bin/libgodot-cpp.windows.template_release.x86_64.a
115+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.windows.template_release.x86_64.a
116+
flags:
117+
SCons: platform=windows use_mingw=yes
118+
CMake: -G "Ninja Multi-Config"
119+
use-mingw: true
57120
run-tests: false
58121
cache-name: windows-x86_64-mingw
59122

60-
- name: 🍎 macOS (universal)
123+
- name: 🍎 macOS
124+
description: 'universal'
61125
os: macos-latest
62126
platform: macos
63127
artifact-name: godot-cpp-macos-universal-release
64-
artifact-path: bin/libgodot-cpp.macos.template_release.universal.a
65-
flags: arch=universal
128+
artifact-path:
129+
SCons: bin/libgodot-cpp.macos.template_release.universal.a
130+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.macos.template_release.a
131+
flags:
132+
SCons: platform=macos arch=universal
133+
CMake: -G Xcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
66134
run-tests: false
67135
cache-name: macos-universal
68136

69-
- name: 🤖 Android (arm64)
70-
os: ubuntu-22.04
137+
- name: 🤖 Android
138+
description: 'arm64'
139+
os: ubuntu-20.04
71140
platform: android
72141
artifact-name: godot-cpp-android-arm64-release
73-
artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
74-
flags: arch=arm64
142+
artifact-path:
143+
SCons: bin/libgodot-cpp.android.template_release.arm64.a
144+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.android.template_release.arm64.a
145+
flags:
146+
SCons: platform=android arch=arm64
147+
CMake: --toolchain ${ANDROID_HOME}/ndk/23.2.8568313/build/cmake/android.toolchain.cmake -G "Ninja Multi-Config" -DANDROID_PLATFORM=21
75148
run-tests: false
76149
cache-name: android-arm64
77150

78-
- name: 🍏 iOS (arm64)
151+
- name: 🍏 iOS
152+
description: 'arm64'
79153
os: macos-latest
80154
platform: ios
81155
artifact-name: godot-cpp-ios-arm64-release
82-
artifact-path: bin/libgodot-cpp.ios.template_release.arm64.a
83-
flags: arch=arm64
156+
artifact-path:
157+
SCons: bin/libgodot-cpp.ios.template_release.arm64.a
158+
CMake: build_release/godot-cpp/bin/Release/Release/libgodot-cpp.ios.template_release.a
159+
flags:
160+
SCons: platform=ios arch=arm64
161+
CMake: -G Xcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
84162
run-tests: false
85163
cache-name: ios-arm64
86164

87-
- name: 🌐 Web (wasm32)
88-
os: ubuntu-22.04
165+
- name: 🌐 Web
166+
description: 'wasm32'
167+
os: ubuntu-20.04
89168
platform: web
90169
artifact-name: godot-cpp-web-wasm32-release
91-
artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
170+
artifact-path:
171+
SCons: bin/libgodot-cpp.web.template_release.wasm32.a
172+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.web.template_release.wasm32.a
173+
flags:
174+
SCons: platform=web
175+
CMake: --toolchain ${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -G "Ninja Multi-Config"
92176
run-tests: false
93177
cache-name: web-wasm32
94178

@@ -103,45 +187,80 @@ jobs:
103187
submodules: recursive
104188

105189
- name: Restore Godot build cache
190+
if: ${{ matrix.builder.name == 'SCons' }}
106191
uses: ./.github/actions/godot-cache-restore
107192
with:
108-
cache-name: ${{ matrix.cache-name }}
193+
cache-name: ${{ matrix.platform.cache-name }}
109194
continue-on-error: true
110195

111-
- name: Setup godot-cpp
112-
uses: ./.github/actions/setup-godot-cpp
196+
- name: Set up Python (for SCons)
197+
if: ${{ matrix.builder.name == 'SCons' }}
198+
uses: actions/setup-python@v5
113199
with:
114200
platform: ${{ matrix.platform }}
115201
windows-compiler: ${{ contains(matrix.flags, 'use_mingw=yes') && 'mingw' || 'msvc' }}
116202

117-
- name: Generate godot-cpp sources only
203+
- name: Android dependencies
204+
if: ${{ matrix.platform.platform == 'android' }}
205+
uses: nttld/setup-ndk@v1
206+
with:
207+
ndk-version: r23c
208+
link-to-sdk: true
209+
210+
- name: Web dependencies
211+
if: ${{ matrix.platform.platform == 'web' }}
212+
uses: mymindstorm/setup-emsdk@v14
213+
with:
214+
version: ${{env.EM_VERSION}}
215+
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
216+
217+
- name: Setup MinGW for Windows/MinGW build
218+
if: ${{ matrix.platform.use-mingw }}
219+
uses: egor-tensin/setup-mingw@v2
220+
with:
221+
version: 12.2.0
222+
223+
- name: Install scons
224+
if: ${{ matrix.builder.name == 'SCons' }}
118225
run: |
119-
scons platform=${{ matrix.platform }} verbose=yes build_library=no ${{ matrix.flags }}
120-
scons -c
226+
python -m pip install scons==4.0.0
227+
228+
- name: Install CMake
229+
if: ${{ matrix.builder.name == 'CMake' }}
230+
uses: jwlawson/actions-setup-cmake@v2
231+
232+
- name: Install ccache
233+
if: ${{ matrix.builder.name == 'CMake' }}
234+
uses: hendrikmuhs/ccache-action@v1.2
235+
with:
236+
key: ${{ matrix.platform.cache-name }}
237+
238+
- name: Install Ninja
239+
if: ${{ matrix.builder.name == 'CMake' }}
240+
uses: ashutoshvarma/setup-ninja@master
241+
242+
- name: Generate godot-cpp sources only
243+
run: ${{ format(matrix.builder.generate_sources, matrix.platform.flags[matrix.builder.name]) }}
121244

122245
- name: Build godot-cpp (debug)
123-
run: |
124-
scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }}
246+
run: ${{ format(matrix.builder.build_godot_cpp_debug, matrix.platform.flags[matrix.builder.name]) }}
125247

126248
- name: Build test without rebuilding godot-cpp (debug)
127-
run: |
128-
cd test
129-
scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }} build_library=no
249+
run: ${{ format(matrix.builder.build_debug, matrix.platform.flags[matrix.builder.name]) }}
130250

131251
- name: Build test and godot-cpp (release)
132-
run: |
133-
cd test
134-
scons platform=${{ matrix.platform }} verbose=yes target=template_release ${{ matrix.flags }}
252+
run: ${{ format(matrix.builder.build_release, matrix.platform.flags[matrix.builder.name]) }}
135253

136254
- name: Save Godot build cache
255+
if: ${{ matrix.builder.name == 'SCons' }}
137256
uses: ./.github/actions/godot-cache-save
138257
with:
139-
cache-name: ${{ matrix.cache-name }}
258+
cache-name: ${{ matrix.builder.cache-name }}
140259
continue-on-error: true
141260

142261
- name: Download latest Godot artifacts
143262
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
144-
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
263+
if: ${{ matrix.platform.run-tests && env.GODOT_TEST_VERSION == 'master' }}
145264
with:
146265
repo: godotengine/godot
147266
branch: master
@@ -155,21 +274,21 @@ jobs:
155274
path: godot-artifacts
156275

157276
- name: Prepare Godot artifacts for testing
158-
if: matrix.run-tests && env.GODOT_TEST_VERSION == 'master'
277+
if: ${{ matrix.platform.run-tests && env.GODOT_TEST_VERSION == 'master' }}
159278
run: |
160279
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
161280
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
162281
163282
- name: Download requested Godot version for testing
164-
if: matrix.run-tests && env.GODOT_TEST_VERSION != 'master'
283+
if: ${{ matrix.platform.run-tests && env.GODOT_TEST_VERSION != 'master' }}
165284
run: |
166285
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
167286
unzip -a Godot.zip
168287
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
169288
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
170289
171290
- name: Run tests
172-
if: matrix.run-tests
291+
if: ${{ matrix.platform.run-tests }}
173292
run: |
174293
$GODOT --headless --version
175294
cd test
@@ -180,43 +299,6 @@ jobs:
180299
- name: Upload artifact
181300
uses: actions/upload-artifact@v4
182301
with:
183-
name: ${{ matrix.artifact-name }}
184-
path: ${{ matrix.artifact-path }}
302+
name: ${{ matrix.platform.artifact-name }}-${{ matrix.builder.name }}
303+
path: ${{ matrix.platform.artifact-path[matrix.builder.name] }}
185304
if-no-files-found: error
186-
187-
linux-cmake-ninja:
188-
name: 🐧 Build (Linux, GCC, CMake Ninja)
189-
runs-on: ubuntu-22.04
190-
steps:
191-
- name: Checkout
192-
uses: actions/checkout@v4
193-
with:
194-
submodules: recursive
195-
196-
- name: Install dependencies
197-
run: |
198-
sudo apt-get update -qq
199-
sudo apt-get install -qqq build-essential pkg-config cmake ninja-build
200-
201-
- name: Build test GDExtension library
202-
run: |
203-
mkdir cmake-build
204-
cd cmake-build
205-
cmake ../ -DGODOT_ENABLE_TESTING=YES
206-
cmake --build . --verbose -j $(nproc) -t godot-cpp.test.template_release --config Release
207-
208-
windows-msvc-cmake:
209-
name: 🏁 Build (Windows, MSVC, CMake)
210-
runs-on: windows-2019
211-
steps:
212-
- name: Checkout
213-
uses: actions/checkout@v4
214-
with:
215-
submodules: recursive
216-
217-
- name: Build test GDExtension library
218-
run: |
219-
mkdir cmake-build
220-
cd cmake-build
221-
cmake ../ -DGODOT_ENABLE_TESTING=YES
222-
cmake --build . --verbose -t godot-cpp.test.template_release --config Release

0 commit comments

Comments
 (0)