-
Notifications
You must be signed in to change notification settings - Fork 15
335 lines (326 loc) · 11.3 KB
/
main.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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
name: 'Build and Test'
on:
push:
schedule: # Build and test daily.
- cron: 0 11 * * *
jobs:
import_assets:
name: 'Import Assets'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
steps:
- uses: actions/checkout@v3
- name: Import assets
uses: ./.github/actions/import-assets
with:
godot-version: v4.2.1-stable
- name: Upload imports
uses: actions/upload-artifact@v3
with:
name: imports-${{ matrix.os }}
path: .godot/
build_docker:
name: 'Build Docker'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target: [ release, debug ]
arch: [ x86_64, x86_32 ]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache submodules
uses: ./.github/actions/cache-submodules
id: cache-submodules
with:
platform: linux
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
- name: Pull docker images
run: docker-compose pull
working-directory: addons/godot_xterm/native
- name: Cache docker image layers
uses: jpribyl/[email protected]
continue-on-error: true
- name: Ensure scons cache exists
run: mkdir -p ${{github.workspace}}/.scons-cache
- name: Build libuv
if: steps.cache-submodules.outputs.cache-hit != 'true'
working-directory: addons/godot_xterm/native
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e ARCH=${{ matrix.arch }} -v ${{github.workspace}}/.scons-cache:/scons-cache libuv-linux
- name: Build libgodot-xterm
working-directory: addons/godot_xterm/native
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e ARCH=${{ matrix.arch }} -v ${{github.workspace}}/.scons-cache:/scons-cache libgodot-xterm-linux
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: libgodot-xterm-${{ matrix.target }}
path: |
addons/godot_xterm/native/bin/*.so
build_native:
if: false # Temporarily disabled.
name: 'Build Native'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform: [ javascript, osx, windows ]
target: [ release, debug ]
bits: [ 64, 32 ]
include:
- platform: javascript
os: ubuntu-22.04
- platform: osx
os: macos-12
- platform: windows
os: windows-2022
exclude:
- platform: javascript
bits: 64 # Currently only wasm32 is supported.
- platform: osx
bits: 32 # Only 64-bit supported on macOS.
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache submodules
uses: ./.github/actions/cache-submodules
id: cache-submodules
with:
platform: ${{ matrix.platform }}
target: ${{ matrix.target }}
bits: ${{ matrix.bits }}
- name: Cache emscripten
if: ${{ matrix.platform == 'javascript' }}
uses: actions/cache@v3
env:
cache-name: cache-emscripten
with:
path: addons/godot_xterm/native/.emcache
key: emsdk-cache-${{ matrix.target }}-${{ hashFiles('**/*.c*', '**/*.h*') }}
restore-keys: |
emsdk-cache-${{ matrix.target }}-
- name: Install javascript build dependencies
if: ${{ matrix.platform == 'javascript' }}
uses: mymindstorm/setup-emsdk@v11
with:
version: 3.1.14
actions-cache-folder: emsdk-cache-${{ matrix.target }}
- name: Install additional javascript build dependencies
if: ${{ matrix.platform == 'javascript' }}
run: sudo apt-get update && sudo apt-get install -y scons gcc-multilib g++-multilib
- name: Install additional macos build dependencies
if: ${{ matrix.os == 'macos-12' }}
run: brew install scons
- name: Install additional windows build dependencies
if: ${{ matrix.os == 'windows-2022' }}
run: python -m pip install scons
- name: Setup MSVC command prompt
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-2022' }}
with:
arch: win${{ matrix.bits }}
- name: Build godot-cpp bindings
if: steps.cache-submodules.outputs.cache-hit != 'true'
run: |
cd addons/godot_xterm/native/thirdparty/godot-cpp
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} generate_bindings=yes -j2
- name: Setup cmake
if: steps.cache-submodules.outputs.cache-hit != 'true'
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: '3.23.2'
use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-2022' }}
- name: Build libuv
if: steps.cache-submodules.outputs.cache-hit != 'true'
shell: bash
env:
TARGET: ${{ matrix.target }}
BITS: ${{ matrix.bits }}
OS: ${{ matrix.os }}
run: |
cd addons/godot_xterm/native/thirdparty/libuv
args="-DCMAKE_BUILD_TYPE=$TARGET -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
if [ "$TARGET" == "release" ]; then
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL"
else
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"
fi
if [ "$BITS" -eq 32 -a "$OS" == "windows-2022" ]; then
cmake -G "Visual Studio 17 2022" -A Win32 -S $(pwd) -B "build" $args
else
mkdir build || true
cd build
if [ "$BITS" -eq 32 ]; then args="$args -DCMAKE_SYSTEM_PROCESSOR=i686 -DCMAKE_C_FLAGS=-m32"; fi
cmake .. $args
cd ..
fi
cmake --build build --config $TARGET
- name: Build libgodot-xterm
run: |
cd addons/godot_xterm/native
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} -j2
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: libgodot-xterm-${{ matrix.target }}
path: |
addons/godot_xterm/native/bin/*.wasm
addons/godot_xterm/native/bin/*.dylib
addons/godot_xterm/native/bin/*.dll
html5_export:
if: false # Temporarily disabled.
name: 'HTML5 Export'
needs: [ build_docker, build_native ]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Godot
uses: lihop/setup-godot@4aad9daa7dd81c11329c4b54fdc26dbd39eea7d6
with:
export-templates: true
- name: Install binary build artifacts
uses: actions/download-artifact@v3
with:
name: libgodot-xterm-release
path: addons/godot_xterm/native/bin
- name: Import assets
uses: ./.github/actions/import-assets
- name: Export HTML5
uses: nick-fields/retry@v2
with:
command: godot --no-window --export HTML5
retry_on: error
timeout_minutes: 5
max_attempts: 6
- name: NPM cache
uses: c-hive/gha-npm-cache@v1
with:
directory: test/html5
- name: Smoke test HTML5 export
shell: bash
working-directory: test/html5
run: |
npm ci
npx serve ../../docs/demo -p 3000 &
npx cypress run
- name: Upload cypress artifacts (on failure)
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: cypress-artifacts
path: |-
test/html5/cypress/screenshots
test/html5/cypress/videos
- name: Upload export
uses: actions/upload-artifact@v3
with:
name: html5-demo
path: docs/demo
test:
name: 'Test'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ] #, macos-12, windows-2022 ] Temporarily disabled.
bits: [ 64, 32 ]
godot_version: [ 'v4.2.1-stable' ]
exclude:
- os: macos-12
bits: 32
steps:
- uses: actions/checkout@v3
- name: Setup Godot
uses: lihop/setup-godot@4aad9daa7dd81c11329c4b54fdc26dbd39eea7d6
with:
version: ${{ matrix.godot_version }}
bits: ${{ matrix.bits }}
- name: Wait for asset import
uses: fountainhead/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: Import Assets (${{ matrix.os }})
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Download imports
uses: actions/download-artifact@v3
with:
name: imports-${{ matrix.os }}
path: .godot
- name: Wait for build
uses: fountainhead/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: Build Docker (debug, x86_${{ matrix.bits }})
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Install debug binary build artifacts
uses: actions/download-artifact@v3
with:
name: libgodot-xterm-debug
path: addons/godot_xterm/native/bin
- name: Run tests
run: godot -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.ci.json
- name: Run unix tests
if: ${{ matrix.os != 'windows-2022' }}
run: godot -s addons/gut/gut_cmdln.gd -gconfig=test/.gutconfig.unix.json
delete_imports:
name: 'Delete Imports'
needs: [ test ]
runs-on: ubuntu-22.04
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: imports-*
# Git archive should only include addons/godot_xterm directory.
check-archive:
name: 'Check Archive'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Create git archive
run: git archive -o archive.zip HEAD
- name: Extract archive
run: mkdir -p /tmp/unzipped && unzip archive.zip -d /tmp/unzipped
- name: Check that archive only contains addons/godot_xterm directory
run: |
shopt -s nullglob dotglob
ls -lR /tmp/unzipped
files=(/tmp/unzipped/*)
if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in archive (${#files[@]}) expected 1."
exit 1
fi
if [ ! -d "/tmp/unzipped/addons" ]; then
echo "Expected directory (addons) not found."
exit 1
fi
files=(/tmp/unzipped/addons)
if [ ${#files[@]} -ne 1 ]; then
echo "Wrong number of files in addons directory (${#files[@]}) expected 1."
exit 1
fi
if [ ! -d "/tmp/unzipped/addons/godot_xterm" ]; then
echo "Expected directory (addons/godot_xterm) not found."
exit 1
fi
check-code-format:
name: 'Check Code Format'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install python dependencies
run: pip install -r requirements.txt
- name: GDScript format check
run: gdformat -c .