Skip to content

Commit 83cf470

Browse files
committed
feat: Updated Emscripten build required for Unity 2021.2
- Split up Linux based builds into `linux` (updated to ubuntu latest) and `linux_legacy` (ubuntu 18.04) - Emscripten is cached now - Linux builds are still done on legacy/18.04 - CMake is upgraded via simpler GH action now
1 parent 71d54f8 commit 83cf470

File tree

1 file changed

+92
-41
lines changed

1 file changed

+92
-41
lines changed

.github/workflows/unity.yml

Lines changed: 92 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ on:
1212
- created
1313
workflow_dispatch:
1414

15+
env:
16+
# Emscripten version that comes with Unity 2021.2
17+
EM_VERSION: 2.0.19
18+
EM_CACHE_FOLDER: 'emsdk-cache'
19+
# Emscripten version that comes with older Unity versions
20+
EM_LEGACY_VERSION: 1.38.48-fastcomp
21+
EM_LEGACY_CACHE_FOLDER: 'emsdk-legacy-cache'
1522

1623
jobs:
1724

@@ -184,22 +191,18 @@ jobs:
184191

185192
linux:
186193

187-
runs-on: ubuntu-18.04
194+
runs-on: ubuntu-latest
188195

189196
steps:
190197
- uses: actions/checkout@v2
198+
- name: Setup cache
199+
id: cache-system-libraries
200+
uses: actions/cache@v2
201+
with:
202+
path: ${{env.EM_CACHE_FOLDER}}
203+
key: ${{env.EM_VERSION}}-${{ runner.os }}
191204
- uses: seanmiddleditch/gha-setup-ninja@v3
192205

193-
# Probably not needed anymore with ubuntu 20.04
194-
- name: install_cmake
195-
run: |
196-
sudo apt update
197-
sudo apt install apt-transport-https ca-certificates gnupg software-properties-common wget
198-
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
199-
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
200-
sudo apt update
201-
sudo apt install cmake
202-
203206
# Android
204207
- name: install Android NDK
205208
uses: nttld/setup-ndk@v1
@@ -245,6 +248,60 @@ jobs:
245248
- name: build_android_x86
246249
run: cmake --build build_android_x86 --target dracodec_unity -j
247250

251+
# Emscripten
252+
- name: setup Emscripten
253+
uses: mymindstorm/setup-emsdk@v10
254+
with:
255+
version: ${{env.EM_VERSION}}
256+
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
257+
- name: configure WebAssembly
258+
run: >
259+
emcmake cmake -B build_web
260+
-DCMAKE_BUILD_TYPE=MinSizeRel
261+
-DDRACO_JS_GLUE=OFF
262+
-DDRACO_UNITY_PLUGIN=ON
263+
-DDRACO_GLTF=ON
264+
-DDRACO_BACKWARDS_COMPATIBILITY=OFF
265+
- name: build WebAssembly
266+
run: cmake --build build_web --target dracodec_unity -j
267+
268+
# Linux artifacts
269+
- name: package Linux
270+
run: |
271+
mkdir -p draco_linux/WebGL
272+
mv build_web/libdracodec_unity.a draco_linux/WebGL
273+
mkdir -p draco_linux/Android/libs/arm64-v8a
274+
mkdir -p draco_linux/Android/libs/armeabi-v7a
275+
mkdir -p draco_linux/Android/libs/x86
276+
mv build_android_arm64-v8a/libdracodec_unity.so \
277+
draco_linux/Android/libs/arm64-v8a
278+
mv build_android_armeabi-v7a/libdracodec_unity.so \
279+
draco_linux/Android/libs/armeabi-v7a
280+
mv build_android_x86/libdracodec_unity.so \
281+
draco_linux/Android/libs/x86
282+
- name: upload artifact
283+
uses: actions/upload-artifact@v2
284+
with:
285+
name: draco_linux
286+
path: draco_linux
287+
288+
linux_legacy:
289+
290+
runs-on: ubuntu-18.04
291+
292+
steps:
293+
- uses: actions/checkout@v2
294+
- name: Setup cache
295+
id: cache-system-libraries
296+
uses: actions/cache@v2
297+
with:
298+
path: ${{env.EM_LEGACY_CACHE_FOLDER}}
299+
key: ${{env.EM_LEGACY_VERSION}}-${{ runner.os }}
300+
301+
# CMake that comes with Ubuntu 18.04 is too old, so install a recent version here
302+
- name: Get latest CMake and ninja
303+
uses: lukka/get-cmake@latest
304+
248305
# Linux 64
249306
- name: configure_linux64
250307
run: >
@@ -258,52 +315,44 @@ jobs:
258315
- name: build_linux64_dracoenc_unity
259316
run: cmake --build build_linux_64 --target dracoenc_unity -j
260317

261-
# Emscripten
262-
- name: setup Emscripten
263-
uses: mymindstorm/setup-emsdk@v7
318+
# Emscripten legacy
319+
- name: setup Emscripten legacy
320+
uses: mymindstorm/setup-emsdk@v10
264321
with:
265-
version: 1.38.48-fastcomp
266-
actions-cache-folder: 'emsdk-cache'
267-
- name: configure WebAssembly
322+
version: ${{env.EM_LEGACY_VERSION}}
323+
actions-cache-folder: ${{env.EM_LEGACY_CACHE_FOLDER}}
324+
- name: configure WebAssembly legacy
268325
run: >
269-
emcmake cmake -B build_web
326+
emcmake cmake -B build_web_legacy
270327
-DCMAKE_BUILD_TYPE=MinSizeRel
271328
-DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1
272329
-DDRACO_JS_GLUE=OFF
273330
-DDRACO_UNITY_PLUGIN=ON
274331
-DDRACO_GLTF=ON
275332
-DDRACO_BACKWARDS_COMPATIBILITY=OFF
276-
- name: build WebAssembly
277-
run: cmake --build build_web --target dracodec_unity -j
333+
- name: build WebAssembly legacy
334+
run: cmake --build build_web_legacy --target dracodec_unity -j
278335

279-
# Linux, WebGL and Android artifact
280-
- name: package Web Android Linux
336+
# Linux legacy artifacts
337+
- name: package Linux legacy
281338
run: |
282-
mkdir -p draco_web_android_linux/x86_64
283-
mv build_linux_64/libdracodec_unity.so draco_web_android_linux/x86_64
284-
mv build_linux_64/libdracoenc_unity.so draco_web_android_linux/x86_64
285-
mkdir -p draco_web_android_linux/WebGL
286-
mv build_web/libdracodec_unity.bc draco_web_android_linux/WebGL
287-
mkdir -p draco_web_android_linux/Android/libs/arm64-v8a
288-
mkdir -p draco_web_android_linux/Android/libs/armeabi-v7a
289-
mkdir -p draco_web_android_linux/Android/libs/x86
290-
mv build_android_arm64-v8a/libdracodec_unity.so \
291-
draco_web_android_linux/Android/libs/arm64-v8a
292-
mv build_android_armeabi-v7a/libdracodec_unity.so \
293-
draco_web_android_linux/Android/libs/armeabi-v7a
294-
mv build_android_x86/libdracodec_unity.so \
295-
draco_web_android_linux/Android/libs/x86
339+
mkdir -p draco_linux_legacy/x86_64
340+
mv build_linux_64/libdracodec_unity.so draco_linux_legacy/x86_64
341+
mv build_linux_64/libdracoenc_unity.so draco_linux_legacy/x86_64
342+
mkdir -p draco_linux_legacy/WebGL
343+
mv build_web_legacy/libdracodec_unity.bc draco_linux_legacy/WebGL
296344
- name: upload artifact
297345
uses: actions/upload-artifact@v2
298346
with:
299-
name: draco_web_android_linux
300-
path: draco_web_android_linux
347+
name: draco_linux_legacy
348+
path: draco_linux_legacy
349+
301350

302351

303352
combine:
304353
name: combine artifacts
305354
runs-on: ubuntu-latest
306-
needs: [mac, windows, linux]
355+
needs: [mac, windows, linux, linux_legacy]
307356
steps:
308357
- name: download artifacts
309358
uses: actions/download-artifact@v2
@@ -317,7 +366,8 @@ jobs:
317366
mkdir draco
318367
cp -r artifacts/draco_apple/* draco
319368
cp -r artifacts/draco_win/* draco
320-
cp -r artifacts/draco_web_android_linux/* draco
369+
cp -r artifacts/draco_linux/* draco
370+
cp -r artifacts/draco_linux_legacy/* draco
321371
- name: zip
322372
run: zip -r draco.zip draco
323373
- name: upload release assets
@@ -337,4 +387,5 @@ jobs:
337387
name: |
338388
draco_apple
339389
draco_win
340-
draco_web_android_linux
390+
draco_linux
391+
draco_linux_legacy

0 commit comments

Comments
 (0)