Skip to content

Commit 4fb9fd5

Browse files
author
Vano
committed
cmake ci
1 parent ebbc12d commit 4fb9fd5

File tree

2 files changed

+203
-183
lines changed

2 files changed

+203
-183
lines changed

.github/workflows/ci.yml

+138-118
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.platforms.name }} (${{ matrix.builder.name }}, ${{matrix.platforms.description}})"
17+
runs-on: ${{ matrix.platforms.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+
platforms:
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 debug_symbols=yes optimize=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 -D CMAKE_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 -DTARGET=TEMPLATE_RELEASE -B build_release test
59+
cmake --build build_release --config Release -v
60+
61+
platforms:
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" -DFLOAT_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/Release/gdexample.windows.template_release.x86_64.lib
98+
flags:
99+
Scons: platform=windows
100+
CMake: '-G "Visual Studio 16 2019" -A x64'
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,58 +184,62 @@ jobs:
100184
submodules: recursive
101185

102186
- name: Restore Godot build cache
103-
uses: ./.github/actions/godot-cache-restore
187+
if: ${{ matrix.builder.name == 'SCons' }}
188+
uses: ./.github/actions/godot-cache
104189
with:
105-
cache-name: ${{ matrix.cache-name }}
190+
cache-name: ${{ matrix.platforms.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.platforms.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.platforms.platform == 'web' }}
122208
uses: mymindstorm/setup-emsdk@v14
123209
with:
124210
version: ${{env.EM_VERSION}}
125211
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
126212

127-
- name: Setup MinGW for Windows/MinGW build
128-
if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
129-
uses: egor-tensin/setup-mingw@v2
130-
with:
131-
version: 12.2.0
132-
133213
- name: Install scons
214+
if: ${{ matrix.builder.name == 'SCons' }}
134215
run: |
135216
python -m pip install scons==4.0.0
136217
218+
- name: Install CMake
219+
if: ${{ matrix.builder.name == 'CMake' }}
220+
uses: jwlawson/actions-setup-cmake@v2
221+
222+
- name: Install ccache
223+
if: ${{ matrix.builder.name == 'CMake' }}
224+
uses: hendrikmuhs/[email protected]
225+
with:
226+
key: ${{ matrix.platforms.cache-name }}
227+
228+
- name: Install Ninja
229+
if: ${{ matrix.builder.name == 'CMake' }}
230+
uses: ashutoshvarma/setup-ninja@master
231+
137232
- name: Generate godot-cpp sources only
138-
run: |
139-
scons platform=${{ matrix.platform }} verbose=yes build_library=no ${{ matrix.flags }}
140-
scons -c
233+
run: ${{ format(matrix.builder.generate_sources, matrix.platforms.flags[matrix.builder.name]) }}
141234

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

146238
- 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
239+
run: ${{ format(matrix.builder.build_debug, matrix.platforms.flags[matrix.builder.name]) }}
150240

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

156244
- name: Save Godot build cache
157245
uses: ./.github/actions/godot-cache-save
@@ -161,7 +249,7 @@ jobs:
161249

162250
- name: Download latest Godot artifacts
163251
uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
164-
if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}
252+
if: ${{ matrix.platforms.run-tests && env.GODOT_TEST_VERSION == 'master' }}
165253
with:
166254
repo: godotengine/godot
167255
branch: master
@@ -189,84 +277,16 @@ jobs:
189277
echo "GODOT=$(pwd)/Godot_v${GODOT_TEST_VERSION}_linux.x86_64" >> $GITHUB_ENV
190278
191279
- name: Run tests
192-
if: ${{ matrix.run-tests }}
280+
if: ${{ matrix.platforms.run-tests }}
193281
run: |
194282
$GODOT --headless --version
195283
cd test
196-
# Need to run the editor so .godot is generated... but it crashes! Ignore that :-)
197-
(cd project && (timeout 30 $GODOT --import --headless >/dev/null 2>&1 || true))
198-
./run-tests.sh
284+
GODOT=../godot-artifacts/godot.linuxbsd.editor.x86_64.mono ./run-tests.sh
199285
200286
- name: Upload artifact
201287
uses: actions/upload-artifact@v3
202288
with:
203-
name: ${{ matrix.artifact-name }}
204-
path: ${{ matrix.artifact-path }}
289+
name: ${{ matrix.platforms.artifact-name }}-${{ matrix.builder.name }}
290+
path: ${{ matrix.platforms.artifact-path[matrix.builder.name] }}
205291
if-no-files-found: error
206292

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 .
224-
make -j $(nproc) VERBOSE=1
225-
226-
- name: Build test GDExtension library
227-
run: |
228-
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." .
229-
make -j $(nproc) VERBOSE=1
230-
231-
linux-cmake-ninja:
232-
name: 🐧 Build (Linux, GCC, CMake Ninja)
233-
runs-on: ubuntu-20.04
234-
steps:
235-
- name: Checkout
236-
uses: actions/checkout@v4
237-
with:
238-
submodules: recursive
239-
240-
- name: Install dependencies
241-
run: |
242-
sudo apt-get update -qq
243-
sudo apt-get install -qqq build-essential pkg-config cmake ninja-build
244-
245-
- name: Build godot-cpp
246-
run: |
247-
cmake -DCMAKE_BUILD_TYPE=Release -GNinja .
248-
cmake --build . -j $(nproc) --verbose
249-
250-
- name: Build test GDExtension library
251-
run: |
252-
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -GNinja .
253-
cmake --build . -j $(nproc) --verbose
254-
255-
windows-msvc-cmake:
256-
name: 🏁 Build (Windows, MSVC, CMake)
257-
runs-on: windows-2019
258-
steps:
259-
- name: Checkout
260-
uses: actions/checkout@v4
261-
with:
262-
submodules: recursive
263-
264-
- name: Build godot-cpp
265-
run: |
266-
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" .
267-
cmake --build . --verbose
268-
269-
- name: Build test GDExtension library
270-
run: |
271-
cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 16 2019" .
272-
cmake --build . --verbose

0 commit comments

Comments
 (0)