limboai/.github/workflows/web.yml

141 lines
4.5 KiB
YAML
Raw Normal View History

2023-07-31 09:21:12 +00:00
name: 🌐 Web builds
on:
workflow_call:
inputs:
godot-treeish:
2023-07-31 09:21:12 +00:00
description: A tag, branch or commit hash in the Godot repository.
type: string
default: master
limboai-treeish:
2023-07-31 09:21:12 +00:00
description: A tag, branch or commit hash in the LimboAI repository.
type: string
default: master
workflow_dispatch:
inputs:
godot-treeish:
2023-07-31 09:21:12 +00:00
description: A tag, branch or commit hash in the Godot repository.
type: string
default: master
limboai-treeish:
2023-07-31 09:21:12 +00:00
description: A tag, branch or commit hash in the LimboAI repository.
type: string
default: master
# Global Settings
env:
SCONS_CACHE_LIMIT: 4096
# With `lto=full` VM seems to run out of ram and build fails
SCONSFLAGS: use_static_cpp=yes debug_symbols=no lto=thin optimize=size verbose=yes warnings=extra werror=yes tests=no
EM_VERSION: 3.1.45
2023-07-31 09:21:12 +00:00
EM_CACHE_FOLDER: "emsdk-cache"
jobs:
# Workaround for issue: https://github.com/mymindstorm/setup-emsdk/issues/20
init-emscripten:
name: Init Emscripten
runs-on: "ubuntu-20.04"
steps:
- name: Set up Emscripten
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
2023-07-31 09:21:12 +00:00
web-builds:
runs-on: "ubuntu-20.04"
name: ${{ matrix.name }}
needs: init-emscripten
2023-07-31 09:21:12 +00:00
strategy:
fail-fast: false
matrix:
include:
- name: Template (release)
target: template_release
dlink_enabled: false
2023-07-31 09:21:12 +00:00
- name: Template (release, dlink_enabled=true)
target: template_release
dlink_enabled: true
2023-07-31 09:21:12 +00:00
- name: Template (debug)
target: template_debug
dlink_enabled: false
2023-07-31 09:21:12 +00:00
- name: Template (debug, dlink_enabled=true)
target: template_debug
dlink_enabled: true
2023-07-31 09:21:12 +00:00
env:
CACHE_NAME: godot.web.${{matrix.target}}${{ matrix.dlink_enabled == true && '.dlink' || '' }}
steps:
- name: Clone Godot
2023-11-09 14:07:29 +00:00
uses: actions/checkout@v4
2023-07-31 09:21:12 +00:00
with:
repository: godotengine/godot
ref: ${{ inputs.godot-treeish }}
2023-07-31 09:21:12 +00:00
- name: Clone LimboAI module
2023-11-09 14:07:29 +00:00
uses: actions/checkout@v4
2023-07-31 09:21:12 +00:00
with:
path: modules/limboai
ref: ${{ inputs.limboai-treeish }}
2023-07-31 09:21:12 +00:00
2023-08-02 16:50:17 +00:00
# Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables.
- uses: ./modules/limboai/.github/actions/init-version
- name: Set up Emscripten cache
uses: actions/cache@v3
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{runner.os}}-libs
- name: Set up Emscripten
2023-07-31 09:21:12 +00:00
uses: mymindstorm/setup-emsdk@v12
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Verify Emscripten setup
run: |
emcc -v
- name: Set up scons
2023-07-31 09:21:12 +00:00
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0
python --version
scons --version
- name: Set up scons cache
2023-07-31 09:21:12 +00:00
uses: actions/cache@v3
with:
path: ${{github.workspace}}/.scons_cache/
2023-09-13 08:50:53 +00:00
key: ${{env.CACHE_NAME}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}}
2023-07-31 09:21:12 +00:00
restore-keys: |
2023-09-13 08:50:53 +00:00
${{env.CACHE_NAME}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}}
${{env.CACHE_NAME}}-${{inputs.godot-treeish}}-${{inputs.limboai-treeish}}
${{env.CACHE_NAME}}-${{inputs.godot-treeish}}
2023-07-31 09:21:12 +00:00
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons platform=web target=${{matrix.target}} dlink_enabled=${{matrix.dlink_enabled}} ${{env.SCONSFLAGS}}
- name: Prepare artifacts
run: |
mkdir -p out/templates/
mv bin/godot.web.template_release.wasm32.zip out/templates/web_release.zip || true
mv bin/godot.web.template_release.wasm32.dlink.zip out/templates/web_dlink_release.zip || true
mv bin/godot.web.template_debug.wasm32.zip out/templates/web_debug.zip || true
mv bin/godot.web.template_debug.wasm32.dlink.zip out/templates/web_dlink_debug.zip || true
rm -rf bin/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{env.NAME_PREFIX}}.export-templates
path: out/*