Skip to content

Commit 3e70edd

Browse files
committed
Add web build
1 parent 20eaa00 commit 3e70edd

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,25 @@ on:
1717
jobs:
1818
build:
1919
runs-on: ${{ matrix.runner }}
20-
name: ${{ matrix.platform }} ${{ matrix.target }} ${{ matrix.arch }} ${{ matrix.optimize }}
20+
name: ${{ matrix.platform }} ${{ matrix.target }} ${{ matrix.arch }} ${{ matrix.optimize }} ${{ matrix.scons_args }}
21+
2122
env:
22-
BUILD_ID: ${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.arch }}-${{ matrix.optimize }}
23+
BUILD_ID: ${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.arch }}-${{ matrix.optimize }}-${{ matrix.scons_args }}
24+
EM_VERSION: 3.1.64
25+
EM_CACHE_FOLDER: "emsdk-cache"
26+
2327
strategy:
2428
fail-fast: false
2529
matrix:
2630
target: [ template_debug, template_release ]
27-
identifier: [ windows, linux, macos, android, android_arm64 ]
31+
identifier: [ windows, linux, macos, android, android_arm64, web_threads, web_nothreads ]
2832

2933
include:
3034
# Defaults
3135
- runner: ubuntu-22.04
3236
- optimize: speed
3337
- arch: x86_64
38+
- scons_args:
3439

3540
# Debug build settings
3641
- target: template_debug
@@ -55,6 +60,16 @@ jobs:
5560
platform: android
5661
arch: arm64
5762

63+
- identifier: web_threads
64+
platform: web
65+
arch: wasm32
66+
scons_args: threads=yes
67+
68+
- identifier: web_nothreads
69+
platform: web
70+
arch: wasm32
71+
scons_args: threads=no
72+
5873
steps:
5974
- name: Check settings
6075
if: ${{ matrix.platform == '' || matrix.target == '' || matrix.runner == '' || matrix.optimize == '' || matrix.arch == ''}}
@@ -95,6 +110,20 @@ jobs:
95110
ndk-version: r23c
96111
link-to-sdk: true
97112

113+
- name: (Web) Set up Emscripten cache
114+
if: ${{ matrix.platform == 'web' }}
115+
uses: actions/cache@v4
116+
with:
117+
path: ${{env.EM_CACHE_FOLDER}}
118+
key: ${{env.EM_VERSION}}-${{ env.BUILD_ID }}
119+
120+
- name: (Web) Set up Emscripten
121+
if: ${{ matrix.platform == 'web' }}
122+
uses: mymindstorm/setup-emsdk@v14
123+
with:
124+
version: ${{env.EM_VERSION}}
125+
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
126+
98127
- name: Set up Python
99128
uses: actions/setup-python@v5
100129
with:
@@ -113,21 +142,6 @@ jobs:
113142
submodules: recursive
114143
ref: ${{ inputs.git-ref }}
115144

116-
# TODO: Cache doesn't work yet. SCons rebuilds the objects even if they already exist. Could be caused by modification dates or extension_api.json.
117-
# fetch-depth: 0 May be needed for cache. See: <https://github.com/actions/checkout/issues/468>.
118-
# - name: Set up SCons cache
119-
# uses: actions/cache@v3
120-
# with:
121-
# path: |
122-
# ${{ github.workspace }}/.scons-cache/
123-
# ${{ github.workspace }}/**/.sconsign.dblite
124-
# ${{ github.workspace }}/godot-cpp/gen/
125-
# key: ${{ matrix.platform }}-${{ github.ref }}-${{ github.sha }}
126-
# restore-keys: |
127-
# ${{ matrix.platform }}-${{ github.ref }}-${{ github.sha }}
128-
# ${{ matrix.platform }}-${{ github.ref }}
129-
# ${{ matrix.platform }}
130-
131145
- name: Scons Cache
132146
id: scons-cache
133147
uses: actions/cache@v4
@@ -140,7 +154,7 @@ jobs:
140154
env:
141155
SCONS_CACHE: .scons-cache
142156
run: |
143-
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' optimize=${{ matrix.optimize }} -j2
157+
scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' optimize=${{ matrix.optimize }} ${{ matrix.scons_args }} -j2
144158
ls -l demo/addons/*/bin/
145159
146160
- name: Prepare files for publish

demo/addons/ropesim/libropesim.gdextension

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ android.debug.x86_64 = "res://addons/ropesim/bin/libropesim.android.template_deb
1515
android.release.x86_64 = "res://addons/ropesim/bin/libropesim.android.template_release.x86_64.so"
1616
android.debug.arm64 = "res://addons/ropesim/bin/libropesim.android.template_debug.arm64.so"
1717
android.release.arm64 = "res://addons/ropesim/bin/libropesim.android.template_release.arm64.so"
18+
web.debug.wasm32 = "res://addons/ropesim/bin/libropesim.web.template_debug.wasm32.wasm"
19+
web.release.wasm32 = "res://addons/ropesim/bin/libropesim.web.template_release.wasm32.wasm"

0 commit comments

Comments
 (0)