Skip to content

Commit 6b91103

Browse files
author
Vano
committed
cmake ci
1 parent a978dbb commit 6b91103

File tree

1 file changed

+141
-110
lines changed

1 file changed

+141
-110
lines changed

.github/workflows/ci.yml

+141-110
Original file line numberDiff line numberDiff line change
@@ -13,78 +13,162 @@ concurrency:
1313

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

30-
- name: 🐧 Linux (GCC, Double Precision)
76+
- name: 🐧 Linux
77+
description: 'GCC, Double Precision'
3178
os: ubuntu-20.04
3279
platform: linux
3380
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
34-
artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
35-
flags: precision=double
81+
artifact-path:
82+
SCons: bin/libgodot-cpp.linux.template_release.double.x86_64.a
83+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.linux.template_release.double.x86_64.a
84+
flags:
85+
SCons: platform=linux precision=double
86+
CMake: -G "Ninja Multi-Config" -DGODOT_PRECISION=double
3687
run-tests: false
3788
cache-name: linux-x86_64-f64
3889

39-
- name: 🏁 Windows (x86_64, MSVC)
90+
- name: 🏁 Windows
91+
description: 'x86_64, MSVC'
4092
os: windows-2019
4193
platform: windows
4294
artifact-name: godot-cpp-windows-msvc2019-x86_64-release
43-
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.lib
95+
artifact-path:
96+
SCons: bin/libgodot-cpp.windows.template_release.x86_64.lib
97+
CMake: build_release/godot-cpp/bin/Release/godot-cpp.windows.template_release.x86_64.lib
98+
flags:
99+
Scons: platform=windows
100+
CMake: '-G "Visual Studio 16 2019" -A x64 -DCMAKE_VERBOSE_MAKEFILE=TRUE'
44101
run-tests: false
45102
cache-name: windows-x86_64-msvc
46103

47-
- name: 🏁 Windows (x86_64, MinGW)
104+
- name: 🏁 Windows
105+
description: 'x86_64, MinGW'
48106
os: windows-2019
49107
platform: windows
50108
artifact-name: godot-cpp-linux-mingw-x86_64-release
51-
artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.a
52-
flags: use_mingw=yes
109+
artifact-path:
110+
SCons: bin/libgodot-cpp.windows.template_release.x86_64.a
111+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.windows.template_release.x86_64.a
112+
flags:
113+
SCons: platform=windows use_mingw=yes
114+
CMake: -G "Ninja Multi-Config"
115+
use-mingw: true
53116
run-tests: false
54117
cache-name: windows-x86_64-mingw
55118

56-
- name: 🍎 macOS (universal)
119+
- name: 🍎 macOS
120+
description: 'universal'
57121
os: macos-latest
58122
platform: macos
59123
artifact-name: godot-cpp-macos-universal-release
60-
artifact-path: bin/libgodot-cpp.macos.template_release.universal.a
61-
flags: arch=universal
124+
artifact-path:
125+
SCons: bin/libgodot-cpp.macos.template_release.universal.a
126+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.macos.template_release.a
127+
flags:
128+
SCons: platform=macos arch=universal
129+
CMake: -G Xcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
62130
run-tests: false
63131
cache-name: macos-universal
64132

65-
- name: 🤖 Android (arm64)
133+
- name: 🤖 Android
134+
description: 'arm64'
66135
os: ubuntu-20.04
67136
platform: android
68137
artifact-name: godot-cpp-android-arm64-release
69-
artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
70-
flags: arch=arm64
138+
artifact-path:
139+
SCons: bin/libgodot-cpp.android.template_release.arm64.a
140+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.android.template_release.arm64.a
141+
flags:
142+
SCons: platform=android arch=arm64
143+
CMake: --toolchain ${ANDROID_HOME}/ndk/23.2.8568313/build/cmake/android.toolchain.cmake -G "Ninja Multi-Config" -DANDROID_PLATFORM=21
71144
run-tests: false
72145
cache-name: android-arm64
73146

74-
- name: 🍏 iOS (arm64)
147+
- name: 🍏 iOS
148+
description: 'arm64'
75149
os: macos-latest
76150
platform: ios
77151
artifact-name: godot-cpp-ios-arm64-release
78-
artifact-path: bin/libgodot-cpp.ios.template_release.arm64.a
79-
flags: arch=arm64
152+
artifact-path:
153+
SCons: bin/libgodot-cpp.ios.template_release.arm64.a
154+
CMake: build_release/godot-cpp/bin/Release/Release/libgodot-cpp.ios.template_release.a
155+
flags:
156+
SCons: platform=ios arch=arm64
157+
CMake: -G Xcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
80158
run-tests: false
81159
cache-name: ios-arm64
82160

83-
- name: 🌐 Web (wasm32)
161+
- name: 🌐 Web
162+
description: 'wasm32'
84163
os: ubuntu-20.04
85164
platform: web
86165
artifact-name: godot-cpp-web-wasm32-release
87-
artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
166+
artifact-path:
167+
SCons: bin/libgodot-cpp.web.template_release.wasm32.a
168+
CMake: build_release/godot-cpp/bin/Release/libgodot-cpp.web.template_release.wasm32.a
169+
flags:
170+
SCons: platform=web
171+
CMake: --toolchain ${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -G "Ninja Multi-Config"
88172
run-tests: false
89173
cache-name: web-wasm32
90174

@@ -100,68 +184,79 @@ jobs:
100184
submodules: recursive
101185

102186
- name: Restore Godot build cache
187+
if: ${{ matrix.builder.name == 'SCons' }}
103188
uses: ./.github/actions/godot-cache-restore
104189
with:
105-
cache-name: ${{ matrix.cache-name }}
190+
cache-name: ${{ matrix.platform.cache-name }}
106191
continue-on-error: true
107192

108193
- name: Set up Python (for SCons)
194+
if: ${{ matrix.builder.name == 'SCons' }}
109195
uses: actions/setup-python@v5
110196
with:
111197
python-version: '3.x'
112198

113199
- name: Android dependencies
114-
if: ${{ matrix.platform == 'android' }}
200+
if: ${{ matrix.platform.platform == 'android' }}
115201
uses: nttld/setup-ndk@v1
116202
with:
117203
ndk-version: r23c
118204
link-to-sdk: true
119205

120206
- name: Web dependencies
121-
if: ${{ matrix.platform == 'web' }}
207+
if: ${{ matrix.platform.platform == 'web' }}
122208
uses: mymindstorm/setup-emsdk@v14
123209
with:
124210
version: ${{env.EM_VERSION}}
125211
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
126212

127213
- name: Setup MinGW for Windows/MinGW build
128-
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
214+
if: ${{ matrix.platform.use-mingw }}
129215
uses: egor-tensin/setup-mingw@v2
130216
with:
131217
version: 12.2.0
132218

133219
- name: Install scons
220+
if: ${{ matrix.builder.name == 'SCons' }}
134221
run: |
135222
python -m pip install scons==4.0.0
136223
224+
- name: Install CMake
225+
if: ${{ matrix.builder.name == 'CMake' }}
226+
uses: jwlawson/actions-setup-cmake@v2
227+
228+
- name: Install ccache
229+
if: ${{ matrix.builder.name == 'CMake' }}
230+
uses: hendrikmuhs/[email protected]
231+
with:
232+
key: ${{ matrix.platform.cache-name }}
233+
234+
- name: Install Ninja
235+
if: ${{ matrix.builder.name == 'CMake' }}
236+
uses: ashutoshvarma/setup-ninja@master
237+
137238
- name: Generate godot-cpp sources only
138-
run: |
139-
scons platform=${{ matrix.platform }} verbose=yes build_library=no ${{ matrix.flags }}
140-
scons -c
239+
run: ${{ format(matrix.builder.generate_sources, matrix.platform.flags[matrix.builder.name]) }}
141240

142241
- name: Build godot-cpp (debug)
143-
run: |
144-
scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }}
242+
run: ${{ format(matrix.builder.build_godot_cpp_debug, matrix.platform.flags[matrix.builder.name]) }}
145243

146244
- name: Build test without rebuilding godot-cpp (debug)
147-
run: |
148-
cd test
149-
scons platform=${{ matrix.platform }} verbose=yes target=template_debug ${{ matrix.flags }} build_library=no
245+
run: ${{ format(matrix.builder.build_debug, matrix.platform.flags[matrix.builder.name]) }}
150246

151247
- name: Build test and godot-cpp (release)
152-
run: |
153-
cd test
154-
scons platform=${{ matrix.platform }} verbose=yes target=template_release ${{ matrix.flags }}
248+
run: ${{ format(matrix.builder.build_release, matrix.platform.flags[matrix.builder.name]) }}
155249

156250
- name: Save Godot build cache
251+
if: ${{ matrix.builder.name == 'SCons' }}
157252
uses: ./.github/actions/godot-cache-save
158253
with:
159-
cache-name: ${{ matrix.cache-name }}
254+
cache-name: ${{ matrix.platform.cache-name }}
160255
continue-on-error: true
161256

162257
- name: Download latest Godot artifacts
163258
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
164-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
259+
if: ${{ matrix.platform.run-tests && env.GODOT_TEST_VERSION == 'master' }}
165260
with:
166261
repo: godotengine/godot
167262
branch: master
@@ -175,21 +270,21 @@ jobs:
175270
path: godot-artifacts
176271

177272
- name: Prepare Godot artifacts for testing
178-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
273+
if: ${{ matrix.platform.run-tests && env.GODOT_TEST_VERSION == 'master' }}
179274
run: |
180275
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
181276
echo "GODOT=$(pwd)/godot-artifacts/godot.linuxbsd.editor.x86_64.mono" >> $GITHUB_ENV
182277
183278
- name: Download requested Godot version for testing
184-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION != 'master' }}
279+
if: ${{ matrix.platform.run-tests && env.GODOT_TEST_VERSION != 'master' }}
185280
run: |
186281
wget "https://github.com/godotengine/godot-builds/releases/download/${GODOT_TEST_VERSION}/Godot_v${GODOT_TEST_VERSION}_linux.x86_64.zip" -O Godot.zip
187282
unzip -a Godot.zip
188283
chmod +x "Godot_v${GODOT_TEST_VERSION}_linux.x86_64"
189284
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
190285
191286
- name: Run tests
192-
if: ${{ matrix.run-tests }}
287+
if: ${{ matrix.platform.run-tests }}
193288
run: |
194289
$GODOT --headless --version
195290
cd test
@@ -200,70 +295,6 @@ jobs:
200295
- name: Upload artifact
201296
uses: actions/upload-artifact@v3
202297
with:
203-
name: ${{ matrix.artifact-name }}
204-
path: ${{ matrix.artifact-path }}
298+
name: ${{ matrix.platform.artifact-name }}-${{ matrix.builder.name }}
299+
path: ${{ matrix.platform.artifact-path[matrix.builder.name] }}
205300
if-no-files-found: error
206-
207-
linux-cmake:
208-
name: 🐧 Build (Linux, GCC, CMake)
209-
runs-on: ubuntu-20.04
210-
steps:
211-
- name: Checkout
212-
uses: actions/checkout@v4
213-
with:
214-
submodules: recursive
215-
216-
- name: Install dependencies
217-
run: |
218-
sudo apt-get update -qq
219-
sudo apt-get install -qqq build-essential pkg-config cmake
220-
221-
- name: Build godot-cpp
222-
run: |
223-
cmake -DCMAKE_BUILD_TYPE=Release -Bbuild test
224-
cmake --build build -v -j $(nproc) --target godot-cpp
225-
226-
- name: Build test GDExtension library
227-
run: |
228-
cmake --build build -v -j $(nproc)
229-
230-
linux-cmake-ninja:
231-
name: 🐧 Build (Linux, GCC, CMake Ninja)
232-
runs-on: ubuntu-20.04
233-
steps:
234-
- name: Checkout
235-
uses: actions/checkout@v4
236-
with:
237-
submodules: recursive
238-
239-
- name: Install dependencies
240-
run: |
241-
sudo apt-get update -qq
242-
sudo apt-get install -qqq build-essential pkg-config cmake ninja-build
243-
244-
- name: Build godot-cpp
245-
run: |
246-
cmake -DCMAKE_BUILD_TYPE=Release -GNinja -Bbuild test
247-
cmake --build build -v -j $(nproc) --target godot-cpp
248-
249-
- name: Build test GDExtension library
250-
run: |
251-
cmake --build build -v -j $(nproc)
252-
253-
windows-msvc-cmake:
254-
name: 🏁 Build (Windows, MSVC, CMake)
255-
runs-on: windows-2019
256-
steps:
257-
- name: Checkout
258-
uses: actions/checkout@v4
259-
with:
260-
submodules: recursive
261-
262-
- name: Build godot-cpp
263-
run: |
264-
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" -Bbuild test
265-
cmake --build build -v --target godot-cpp
266-
267-
- name: Build test GDExtension library
268-
run: |
269-
cmake --build build -v

0 commit comments

Comments
 (0)