-
Notifications
You must be signed in to change notification settings - Fork 0
245 lines (202 loc) Β· 8.3 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
name: Run Unit Tests
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_dispatch:
env:
LINUX_64_TARGET: x86_64-unknown-linux-gnu
LINUX_64_LIB: libglecs.so
WINDOWS_64_TARGET: x86_64-pc-windows-gnu
WINDOWS_64_LIB: libglecs.dll
jobs:
compile_glecs:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
glecs_lib: libglecs.so
# - os: ubuntu-latest
# target: x86_64-pc-windows-gnu
# glecs_lib: libglecs.dll
# - os: ubuntu-latest
# target: x86_64-pc-windows-gnu
# glecs_lib: libglecs.dll
runs-on: ${{ matrix.os }}
steps:
- name: π Settup git environment
uses: actions/checkout@v4
- name: π³οΈ Initialize git submodules
run: git submodule update --init --recursive
- name: πΎ Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "./addons/glecs/rust/glecs"
cache-on-failure: true
- name: ποΈ Update Rust
run: |
rustup update
rustup target add ${{ matrix.target }}
- name: πͺ Install mingw for Windows build
if: ${{ matrix.target }} == x86_64-pc-windows-gnu
run: |
sudo apt install gcc-mingw-w64
- name: π¦ Build Rust code
run: |
cargo build \
--release
--manifest-path ./addons/glecs/rust/glecs/Cargo.toml \
--features compile_bindings \
--target-dir ./addons/glecs/bin \
--target ${{ matrix.target }}
- name: πΎ Cache compiled library
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/${{ matrix.target }}/release/${{ matrix.glecs_lib }}
# An explicit key for restoring and saving the cache
key: glecslib.${{ matrix.target }}
run_godot_test_suite:
needs: compile_glecs
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
glecs_lib: libglecs.so
# - os: ubuntu-latest
# target: x86_64-pc-windows-gnu
# glecs_lib: libglecs.dll
# - os: ubuntu-latest
# target: x86_64-pc-windows-gnu
# glecs_lib: libglecs.dll
runs-on: ${{ matrix.os }}
steps:
- name: π Settup git environment
uses: actions/checkout@v4
- name: β³ Load compiled library
uses: actions/cache/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: ./addons/glecs/bin/${{ matrix.target }}/release/${{ matrix.glecs_lib }}
# An explicit key for restoring and saving the cache
key: glecslib.${{ matrix.target }}
# 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: Move lib
run: |
mkdir ./addons/glecs/bin/release/
mkdir ./addons/glecs/bin/debug/
cp ./addons/glecs/bin/${{ matrix.target }}/release/${{ matrix.glecs_lib }} ./addons/glecs/bin/release/${{ matrix.glecs_lib }}
cp ./addons/glecs/bin/${{ matrix.target }}/release/${{ matrix.glecs_lib }} ./addons/glecs/bin/debug/${{ matrix.glecs_lib }}
- name: π€ Setup Godot
uses: chickensoft-games/setup-godot@v1
with:
# Version must include major, minor, and patch, and be >= 4.0.0
version: 4.2.1
# This shouldn't be needed because the important files from .godot are
# included, but we run the import process just in case.
- name: π§ Run Godot import
run: |
godot --headless --editor --quit-after 100
- name: βοΈ Run unittests
run: |
godot -s res://addons/gut/gut_cmdln.gd --headless -gdir="res://unittests" -gexit
- name: π€ Run Godot unit tests
id: run-godot-tests
uses: croconut/godot-tester@v5
with:
# required
version: "4.2"
is-mono: "false"
# the folder with your project.godot file in it
path: "./"
# the ratio of tests that must pass for this action to pass
# e.g. 0.6 means 60% of your tests must pass
minimum-pass: "1.0"
# the directory containing Gut tests
test-dir: "res://unittests"
# default is GUTs default: 'res://.gutconfig.json'; set this to load a different config file
config-file: "res://.gut_editor_config.json"
# relative path to the xml file to read / write GUT's results from, recommended
# for direct-scene users to check this file if you have issues
result-output-file: "test_results.xml"
- name: π Print logs
if: failure() && steps.run-godot-tests.outcome != 'success'
run: echo "$(cat logs/godot.log)"
update_nightly:
needs: run_godot_test_suite
runs-on: windows-latest
steps:
# Run only if new commits were pushed
- name: π Proceed if action is "push"
if: ${{ github.action }} != "push"
run: |
exit 0
- name: π Settup 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/${{ env.LINUX_64_TARGET }}/release/${{ env.LINUX_64_LIB }}
# An explicit key for restoring and saving the cache
key: glecslib.${{ env.LINUX_64_TARGET }}
# 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/${{ env.WINDOWS_64_TARGET }}/release/${{ env.WINDOWS_64_LIB }}
# An explicit key for restoring and saving the cache
key: glecslib.${{ env.WINDOWS_64_TARGET }}
# 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/
cp ../nightly_tmp/README.md ../nightly/README.md
cp ../nightly_tmp/.gitignore ../nightly/.gitignore
- name: π¨οΈ Copy dev branch plugin to nightly
run: |
cp -r -force ./addons/glecs/* ../nightly/
- name: β Add / 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 }}"
# Prevent error
echo ""
- name: π€ Push to nightly
if: steps.add-and-commit.outcome == 'success'
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