-
Notifications
You must be signed in to change notification settings - Fork 0
318 lines (272 loc) Β· 11.1 KB
/
unittests.yml
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
name: Build Process
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_dispatch:
jobs:
data:
runs-on: ubuntu-latest
outputs:
lib_debug_linux_x86_64: libglecs.linux.template_debug.x86_64.so
lib_release_linux_x86_64: libglecs.linux.template_release.x86_64.so
lib_debug_macos_x86_64: libglecs.macos.template_debug.x86_64.dylib
lib_release_macos_x86_64: libglecs.macos.template_release.x86_64.dylib
lib_debug_windows_x86_64: libglecs.windows.template_debug.x86_64.dll
lib_release_windows_x86_64: libglecs.windows.template_release.x86_64.dll
steps:
- name: Pass
run: echo Pass
compile_glecs:
needs: [data]
strategy:
matrix:
include:
# Linux
- platform: linux
arch: x86_64
glecs_lib: ${{ needs.data.outputs.lib_debug_linux_x86_64 }}
os: ubuntu-latest
# - platform: linux
# arc: arm64
# target: i686-unknown-linux-gnu
# glecs_lib: libglecs.linux.template_debug.arm64.so
# os: ubuntu-latest
# Mac
- platform: macos
arch: x86_64
glecs_lib: ${{ needs.data.outputs.lib_debug_macos_x86_64 }}
os: macos-13
# - target: aarch64-apple-darwin
# os: macos-latest
# glecs_lib: libglecs.dylib
# Windows
- platform: windows
release plreleasem: windows
arch: x86_64
glecs_lib: ${{ needs.data.outputs.lib_debug_windows_x86_64 }}
os: windows-latest
runs-on: ${{ matrix.os }}
outputs:
# Linux
bin_key_linux_x86_64: ${{ steps.set_cache_key.outputs.bin_key_linux_x86_64 }}
# i686-linux_bin_key: ${{ steps.set_cache_key.outputs.i686-unknown-linux-gnu_bin_key }}
# Mac
bin_key_macos_x86_64: ${{ steps.set_cache_key.outputs.bin_key_macos_x86_64 }}
# bin_key_macos_i686: ${{ steps.set_cache_key.outputs.bin_key_macos_i686 }}
# Windows
bin_key_windows_x86_64: ${{ steps.set_cache_key.outputs.bin_key_windows_x86_64 }}
steps:
- name: π Setup git environment
uses: actions/checkout@v4
- name: π³οΈ Initialize git submodules
run: git submodule update --init --recursive
- name: π Python install
uses: actions/setup-python@v5
with:
python-version: '3.10'
# --- Define keys ---
- name: ποΈ Define library cache key in env Linux
shell: bash
run: echo "bin_key=lib.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/bin') }}" >> $GITHUB_ENV
- name: ποΈ Define cpp cache key Linux
shell: bash
run: echo "cpp_key=cpp.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/cpp/') }}" >> $GITHUB_ENV
- name: ποΈ Define includes cache key Linux
shell: bash
run: echo "include_key=include.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/cpp/include') }}.${{ hashFiles('addons/glecs/cpp/SConstruct') }}" >> $GITHUB_ENV
# --- Restore caches ---
- name: πΎ Restore cached cpp files
uses: actions/cache/[email protected]
with:
path: addons/glecs/cpp
key: ${{ env.cpp_key }}
- name: πΎ Restore cached include files
uses: actions/cache/[email protected]
with:
path: addons/glecs/cpp/include
key: ${{ env.include_key }}
# --- Platform specific setup ---
# - name: π§ Install GCC multilib for Linux i686 build
# if: ${{ matrix.platform == 'linux' && matrix.arch == 'i686' && runner.os == 'Linux'}}
# run: sudo apt-get install gcc-multilib
- name: πͺ Install mingw for cross compiling from Linux to Windows
if: ${{ matrix.platform == 'windows' && runner.os == 'Linux' }}
run: |
sudo apt install g++-mingw-w64-x86-64
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
# --- Compile Glecs ---
- name: π¨ Install scons
run: |
pip install scons
- name: π οΈ Build C++ code
run: |
scons --directory=addons/glecs/cpp platform=${{ matrix.platform }} arch=${{ matrix.arch }}
printf *** ls addons/glecs/bin/ ***
ls addons/glecs/bin
#target=template_release
# --- Define bin key ---
- name: ποΈ Define library cache key in env
shell: bash
run: |
printf "*** Setting key in env***"
echo "bin_key=bin.${{ matrix.platform }}_${{ matrix.arch }}.${{ hashFiles('addons/glecs/bin') }}" >> $GITHUB_ENV
- name: ποΈ Define library cache key in output
id: set_cache_key
shell: bash
run: |
printf "*** Setting key ***"
echo "bin_key_${{ matrix.platform }}_${{ matrix.arch }}=${{env.bin_key}}" >> $GITHUB_OUTPUT
# --- Save caches ---
- name: πΎ Cache cpp source build files
uses: actions/cache/save@v4
with:
path: addons/glecs/cpp
key: ${{ env.cpp_key }}
- name: πΎ Cache cpp include build files
uses: actions/cache/save@v4
with:
path: addons/glecs/cpp/include
key: ${{ env.include_key }}
- name: πΎ Cache bin
uses: actions/cache/[email protected]
with:
path: ./addons/glecs/bin/${{ matrix.glecs_lib }}
key: ${{ env.bin_key }}
enableCrossOsArchive: true
run_test_suite:
needs: [data, compile_glecs]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
bin_key: ${{ needs.compile_glecs.outputs.bin_key_linux_x86_64 }}
lib_debug: ${{ needs.data.outputs.lib_debug_linux_x86_64 }}
lib_release: ${{ needs.data.outputs.lib_release_linux_x86_64 }}
- os: macos-13
bin_key: ${{ needs.compile_glecs.outputs.bin_key_macos_x86_64 }}
lib_debug: ${{ needs.data.outputs.lib_debug_macos_x86_64 }}
lib_release: ${{ needs.data.outputs.lib_release_macos_x86_64 }}
- os: windows-latest
bin_key: ${{ needs.compile_glecs.outputs.bin_key_windows_x86_64 }}
lib_debug: ${{ needs.data.outputs.lib_debug_windows_x86_64 }}
lib_release: ${{ needs.data.outputs.lib_release_windows_x86_64 }}
runs-on: ${{ matrix.os }}
steps:
- name: π Setup git environment
uses: actions/checkout@v4
- name: πΎ Load cached library as debug
uses: actions/cache/[email protected]
with:
path: ./addons/glecs/bin/${{ matrix.lib_debug }}
key: ${{ matrix.bin_key }}
enableCrossOsArchive: true
- name: πΎ Load cached library as release
uses: actions/cache/[email protected]
with:
path: ./addons/glecs/bin/${{ matrix.lib_release }}
key: ${{ matrix.bin_key }}
enableCrossOsArchive: true
- name: π€ Setup Godot binary
uses: lihop/setup-godot@v2
with:
version: 4.3-stable
bits: 64
mono: false
- name: π€ Run Godot import
shell: bash
run: godot --headless --import
- name: π Run Glecs tests
id: run-godot-tests
shell: bash
run: godot --script unittests.gd --headless --verbose
- name: π Debug print when tests error
shell: bash
if: failure() && steps.run-godot-tests.outcome != 'success'
run: |
echo ""
echo "***"
echo "LS"
echo "***"
ls -g -A
echo ""
echo "***"
echo "LS glecs/bin/"
echo "***"
ls addons/glecs/bin
update_nightly:
if: ${{ github.event_name == 'push' || github.event_name == 'closed' }}
needs: ["compile_glecs", "run_test_suite"]
runs-on: windows-latest
steps:
- name: π Setup git environment
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: π§ Load compiled library, Linux x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-unknown-linux-gnu/release/libglecs.so
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_linux_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true
- name: π Load compiled library, Mac x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-apple-darwin/release/libglecs.dylib
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_macos_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true
- name: πͺ Load compiled library, Windows x86_64
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/x86_64-pc-windows-gnu/release/glecs.dll
# An explicit key for restoring and saving the cache
key: ${{ needs.compile_glecs.outputs.bin_key_windows_x86_64 }}
# An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms
enableCrossOsArchive: true
- name: π Setup Python
uses: actions/[email protected]
with:
python-version: 3.11.2
cache: pip
# - name: π£ββοΈ Convert dev plugin to nightly format
# run: |
# cd addons/glecs
# pip install regex
# python _build_for_nightly.py
- name: π Clone nightly branch
run: |
git clone https://github.com/${{ github.repository }} ../nightly_tmp -b nightly
mkdir ../nightly
mkdir ../nightly/.git
cp -r ../nightly_tmp/.git/* ../nightly/.git/
- name: π¨οΈ Copy dev branch plugin to nightly
run: |
cp -r -force ./addons/glecs/* ../nightly/
- name: β Add and commit to nightly
id: add-and-commit
continue-on-error: true
run: |
cd ../nightly
git config --global user.name github-actions[bot]
git config --global user.email [email protected]
git add .
git commit --all -m "(AUTO) ${{ github.event.head_commit.message }}"
- name: π€ Push to nightly
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
branch: nightly
directory: ../nightly
- name: π Finish
run: exit 0