-
Notifications
You must be signed in to change notification settings - Fork 29
413 lines (402 loc) · 17.2 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
name: CI
on: [ push, pull_request ]
env:
GODOT_EXPORT_TEMPLATE_VERSION: 3.4.4
LIBSMCE_TAG: v1.5.7
LIBSMCE_VERSION: 1.5.7
jobs:
rules:
name: Compute job rules
runs-on: ubuntu-latest
outputs:
release: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
build_linux: ${{ true }}
build_macos: ${{ true }}
build_windows: ${{ true }}
platform_package: ${{ steps.changed_files.outputs.any_changed == 'true' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v18.7
with:
files: |
CMakeLists.txt
\.yaml$
\.cmake$
make-release:
name: Publish release
if: needs.rules.outputs.release == 'true'
needs: [ rules, build-ubuntu, build-macos, build-windows, package-deb ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download all build artifacts
uses: actions/download-artifact@v3
- name: Create Release
shell: bash
run: |
tag_name="${GITHUB_REF##*/}"
mkdir release
mv $(find . -mindepth 1 -maxdepth 2 -type d -name 'SMCE_gd-*' -printf '%p/* ') release/
cd release
mkdir hashes
for alg in md5 sha1 sha224 sha256 sha384 sha512; do
"${alg}sum" $(find . -maxdepth 1 -type f | sed 's/.\///') > hashes/$alg.txt
done
mv hashes/* ./
rmdir hashes
hub release create $(find . -type f -printf "-a %p ") -m "SMCE_gd $tag_name" "$tag_name"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-ubuntu:
name: SMCE-gd - Ubuntu (${{ matrix.compiler.name }})
needs: rules
if: needs.rules.outputs.build_linux == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- name: GCC 10
c: gcc-10
cxx: g++-10
- name: Clang/LLVM 10
c: clang-10
cxx: clang++-10
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cxx }}
steps:
- uses: actions/checkout@v3
- name: Check deps
id: deps
run: |
sudo apt install ninja-build libxrandr2 libxinerama1 libxrender1 libxi6 libgl1 libxcursor1
wget -c https://downloads.tuxfamily.org/godotengine/${GODOT_EXPORT_TEMPLATE_VERSION}/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_linux_headless.64.zip -O godot.zip
mkdir bin
unzip godot.zip -d bin
mv bin/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_linux_headless.64 bin/godot
export PATH="$(realpath bin):$PATH"
godot --version || true
ninja --version
echo "::set-output name=GODOT_VERSION::$(godot --version | grep -oP '^\d+\.\d+(\.\d+)?\.\w+')"
echo "::set-output name=GODOT_TEMPLATE_CACHE_KEY::$(echo "$GODOT_EXPORT_TEMPLATE_VERSION" | sed 's/\.//g')"
wget -O libsmce.sh "https://github.com/ItJustWorksTM/libSMCE/releases/download/${LIBSMCE_TAG}/libSMCE-${LIBSMCE_VERSION}-Linux-x86_64-GNU.sh"
chmod +x libsmce.sh
sudo ./libsmce.sh --prefix=/usr --skip-license --exclude-subdir
- name: Cache Godot export template
uses: actions/cache@v3
id: cache-godot
with:
path: |
~/.local/share/godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
key: godot-${{ steps.deps.outputs.GODOT_TEMPLATE_CACHE_KEY }}-linux_64
- name: Get export templates
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
wget -c "https://downloads.tuxfamily.org/godotengine/${GODOT_EXPORT_TEMPLATE_VERSION}/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_export_templates.tpz" -O godot_export.tpz
unzip godot_export.tpz
mkdir -p ~/.local/share/godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
mv templates/linux_x11_64* ~/.local/share/godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
- name: CMake Configure
run: |
export PATH="$(realpath bin):$PATH"
mkdir build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSMCEGD_BUNDLE_DEPS=True -S . -B build/
- name: CMake Build
run: cmake --build build/
- name: CPack
run: |
export PATH="$(realpath bin):$PATH"
mkdir build/packages
cd build/
cpack -B packages
cmake -DGODOT_DEBUG=On .
cpack -B packages
rm -rd packages/_CPack_Packages
cd ..
- name: Upload artifacts
uses: 'actions/upload-artifact@v2'
with:
name: SMCE_gd-ubuntu-${{ matrix.compiler.c }}
path: build/packages/*
build-macos:
name: SMCE-gd - macOS (${{ matrix.compiler.name }})
needs: rules
if: needs.rules.outputs.build_macos == 'true'
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
compiler:
- name: GCC 11
slug: gcc
c: gcc-11
cxx: g++-11
arch: x86_64
smce_artifact: GNU
- name: Clang/LLVM 13
slug: clang
c: clang-13
cxx: clang++-13
arch: universal
smce_artifact: AppleClang
- name: AppleClang 12
slug: appleclang
c: clang
cxx: clang++
arch: universal
smce_artifact: AppleClang
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cxx }}
steps:
- uses: actions/checkout@v3
- name: Check deps
id: deps
run: |
brew install --cask godot
ln -s /Applications/Godot.app/Contents/MacOS/Godot /usr/local/bin/godot3
brew install ninja
pip install pathlib
godot3 --version || true
ninja --version
echo "::set-output name=GODOT_VERSION::$(godot3 --version | egrep -o '^\d+\.\d+(\.\d+)?\.\w+')"
echo "::set-output name=GODOT_TEMPLATE_CACHE_KEY::$(echo "$GODOT_EXPORT_TEMPLATE_VERSION" | sed 's/\.//g')"
wget -O libsmce.sh "https://github.com/ItJustWorksTM/libSMCE/releases/download/${LIBSMCE_TAG}/libSMCE-${LIBSMCE_VERSION}-Darwin-${{ matrix.compiler.arch }}-${{ matrix.compiler.smce_artifact }}.sh"
chmod +x libsmce.sh
sudo ./libsmce.sh --prefix=/usr/local --skip-license --exclude-subdir
- name: Cache Godot export template
uses: actions/cache@v3
id: cache-godot
with:
path: ~/Library/Application\ Support/Godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
key: godot-${{ steps.deps.outputs.GODOT_TEMPLATE_CACHE_KEY }}-osx-f0
- name: Get export templates
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
wget -qc "https://downloads.tuxfamily.org/godotengine/${GODOT_EXPORT_TEMPLATE_VERSION}/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_export_templates.tpz" -O godot_export.tpz
unzip godot_export.tpz
mkdir -p ~/Library/Application\ Support/Godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
mv templates/osx* ~/Library/Application\ Support/Godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
- name: CMake Configure
if: matrix.compiler.slug == 'appleclang'
run: |
cmake -G Ninja \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DCMAKE_BUILD_TYPE=Release \
-DSMCEGD_BUNDLE_DEPS=True \
-DSMCE_CPACK_PROFILE=DragNDrop \
-DFORCE_STRIP_CODESIGNING=On \
-S . -B build
- name: CMake Configure
if: matrix.compiler.slug != 'appleclang'
run: |
[ "$CC" = "clang-13" ] && export CC="$(brew --prefix llvm)/bin/clang -stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
[ "$CXX" = "clang++-13" ] && export CXX="$(brew --prefix llvm)/bin/clang++ -stdlib=libc++ -nostdinc++ -I/usr/local/opt/llvm/include/c++/v1 -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
mkdir build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSMCEGD_BUNDLE_DEPS=True -DSMCE_CPACK_PROFILE=DragNDrop -DFORCE_STRIP_CODESIGNING=On -S . -B build/
- name: CMake Build
run: cmake --build build/
- name: CPack
run: |
mkdir build/packages
cd build/
cpack -B packages
cmake -DGODOT_DEBUG=On -DFORCE_STRIP_CODESIGNING=On .
cpack -B packages
otool -L -l export/SMCE-Godot.app/Contents/Frameworks/libgodot-smce.so
rm -rd packages/_CPack_Packages
cd ..
- name: Upload artifacts
uses: 'actions/upload-artifact@v2'
with:
name: SMCE_gd-macos-${{ matrix.compiler.slug }}
path: build/packages/*
build-windows:
name: SMCE-gd - Windows (${{ matrix.compiler.name }})
needs: rules
if: needs.rules.outputs.build_windows == 'true'
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
compiler:
- name: MSVC
c: cl
cxx: cl
# - name: Clang/LLVM
# c: clang-cl
# cxx: clang++-cl
env:
SMCE_ROOT: C:\smce
# CC: ${{ matrix.compiler.c }}
# CXX: ${{ matrix.compiler.cxx }}
steps:
- uses: actions/checkout@v3
- name: Check deps
id: deps
shell: powershell
run: |
choco install --no-progress ninja godot wget
ninja --version
$previous_exit_code = $global:LASTEXITCODE
$godot_version_output = godot --version
$global:LASTEXITCODE = $previous_exit_code
echo "Godot version: $godot_version_output"
echo "::set-output name=GODOT_VERSION::$([regex]::Matches($godot_version_output, "\d+\.\d+(?:\.\d+)?\.\w+").Value)"
echo "::set-output name=GODOT_TEMPLATE_CACHE_KEY::$($env:GODOT_EXPORT_TEMPLATE_VERSION.Replace('.', ''))"
wget -O libsmce.zip https://github.com/ItJustWorksTM/libSMCE/releases/download/$($env:LIBSMCE_TAG)/libSMCE-$($env:LIBSMCE_VERSION)-Windows-AMD64-MSVC-Release.zip
7z x libsmce.zip -oC:\
ren C:\libSMCE-$($env:LIBSMCE_VERSION)-Windows-AMD64-MSVC-Release C:\smce
- name: Cache Godot export template
uses: actions/cache@v3
id: cache-godot
with:
path: ~/AppData/Roaming/Godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
key: godot-${{ steps.deps.outputs.GODOT_TEMPLATE_CACHE_KEY }}-win64
- name: Get export templates
if: steps.cache-godot.outputs.cache-hit != 'true'
shell: powershell
run: |
Invoke-WebRequest "https://downloads.tuxfamily.org/godotengine/$($env:GODOT_EXPORT_TEMPLATE_VERSION)/Godot_v$($env:GODOT_EXPORT_TEMPLATE_VERSION)-stable_export_templates.tpz" -OutFile godot_export.zip
Expand-Archive -Path godot_export.zip -DestinationPath .
New-Item -ItemType Directory -Path ~\AppData\Roaming\Godot\templates\${{ steps.deps.outputs.GODOT_VERSION }}
Move-Item -Path .\templates\windows_64* -Destination ~\AppData\Roaming\Godot\templates\${{ steps.deps.outputs.GODOT_VERSION }}
- name: Get Mesa3D
shell: powershell
run: |
Invoke-WebRequest "https://downloads.fdossena.com/geth.php?r=mesa64-latest" -OutFile winmesa.7z
7z e -y winmesa.7z
Move-Item -Path .\opengl32.dll -Destination C:\ProgramData\chocolatey\lib\godot\tools
- uses: ilammy/msvc-dev-cmd@v1
- name: CMake configure
run: |
mkdir build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSMCEGD_BUNDLE_DEPS=True -DSMCE_CPACK_PROFILE=WiX -B ./build
- name: CMake build
run: cmake --build ./build
- name: Package
run: |
mkdir ./build/packages
cd build
cmake -DCPACK_PACKAGE_DIRECTORY="packages" .
cmake --build . --target package
cmake -DGODOT_DEBUG=On -DCPACK_PACKAGE_DIRECTORY="packages" .
cmake --build . --target package
rm -R packages/_CPack_Packages
cd ..
- name: Upload artifacts
uses: 'actions/upload-artifact@v2'
with:
name: SMCE_gd-windows-${{ matrix.compiler.c }}
path: build/packages/*
package-deb:
name: Package per-distro DEBs (${{ matrix.os.name }} ${{ matrix.os.codename }})
needs: rules
if: needs.rules.outputs.platform_package == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- name: Debian
codename: Bookworm
image: debian:bookworm
slug: debian12
- name: Debian
codename: Bullseye
image: gcc:11-bullseye
slug: debian11
- name: Ubuntu
codename: Jammy
image: ubuntu:jammy
slug: ubuntu2204
- name: Ubuntu
codename: Impish
image: ubuntu:impish
slug: ubuntu2110
- name: Ubuntu
codename: Hirsute
image: ubuntu:hirsute
slug: ubuntu2104
# - name: Ubuntu
# codename: Groovy
# image: ubuntu:groovy
# slug: ubuntu2010
- name: Ubuntu
codename: Focal
image: ubuntu:focal
slug: ubuntu2004
container:
image: ${{ matrix.os.image }}
options: --security-opt seccomp=unconfined
env:
DEBIAN_FRONTEND: "noninteractive"
CMAKE_VERSION: 3.23.1
steps:
- name: Setup workdir
run: mkdir /tmp/wk && cd /tmp/wk
- uses: actions/checkout@v3
- name: Fetch deps
id: deps
run: |
apt-get update -y
apt-get install -y unzip python3 file dpkg-dev wget libxrandr2 libxinerama1 libxrender1 libxi6 libgl1 libxcursor1 # CMake's dpkg-shlibdeps support needs 'file'
git --version || apt-get install -y git
ninja --version || apt-get install -y ninja-build
wget -c https://downloads.tuxfamily.org/godotengine/${GODOT_EXPORT_TEMPLATE_VERSION}/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_linux_headless.64.zip -O godot.zip
mkdir bin
unzip godot.zip -d bin
mv bin/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_linux_headless.64 bin/godot
export PATH="$(realpath bin):$PATH"
echo "::set-output name=GODOT_VERSION::$(godot --version | grep -oP '^\d+\.\d+(\.\d+)?\.\w+')"
echo "::set-output name=GODOT_TEMPLATE_CACHE_KEY::$(echo "$GODOT_EXPORT_TEMPLATE_VERSION" | sed 's/\.//g')"
wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh
chmod +x cmake-$CMAKE_VERSION-linux-x86_64.sh
./cmake-$CMAKE_VERSION-linux-x86_64.sh --skip-license --prefix=/usr/local
[ "$(g++ --version | grep -oP '\d+' | head -n1)0" -ge 100 ] || wget -O- https://github.com/ItJustWorksTM/libSMCE/raw/master/ci/install-highest-gcc.sh | bash # GCC 10 required for C++2a
wget "https://github.com/ItJustWorksTM/libSMCE/releases/download/${{ env.LIBSMCE_TAG }}/libsmce-bin_${{ env.LIBSMCE_VERSION }}-${{ matrix.os.slug }}.0_amd64.deb"
wget "https://github.com/ItJustWorksTM/libSMCE/releases/download/${{ env.LIBSMCE_TAG }}/libsmce-dev_${{ env.LIBSMCE_VERSION }}-${{ matrix.os.slug }}.0_amd64.deb"
apt-get install -y ./*.deb
- name: Cache Godot export template
uses: actions/cache@v3
id: cache-godot
with:
path: |
~/.local/share/godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
key: godot-${{ steps.deps.outputs.GODOT_TEMPLATE_CACHE_KEY }}-linux_64
- name: Get export templates
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
wget -c "https://downloads.tuxfamily.org/godotengine/${GODOT_EXPORT_TEMPLATE_VERSION}/Godot_v${GODOT_EXPORT_TEMPLATE_VERSION}-stable_export_templates.tpz" -O godot_export.tpz
unzip godot_export.tpz
mkdir -p ~/.local/share/godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
mv templates/linux_x11_64* ~/.local/share/godot/templates/${{ steps.deps.outputs.GODOT_VERSION }}
- name: CMake Configure
run: cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSMCE_BUILD_PROFILE=${{ matrix.os.name }}${{ matrix.os.codename }} -B build/
- name: CMake Build
run: cmake --build ./build
- name: CPack
run: |
export PATH="$(realpath bin):$PATH"
cd build
cpack
- name: Test installation
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.os.image }}
options: -v ${{ github.workspace }}:/host
run: |
apt-get update -y
apt-get install -y /host/libsmce-bin_${{ env.LIBSMCE_VERSION }}-${{ matrix.os.slug }}.0_amd64.deb
apt-get install -y /host/build/*.deb
which smce_gd
- name: Upload artifacts
uses: 'actions/upload-artifact@v2'
with:
name: SMCE_gd-DEB-${{ matrix.os.name }}${{ matrix.os.codename }}
path: build/*.deb