Files
2026-11-14 10:45:13 -08:00

100 lines
3.6 KiB
YAML

# UNSUPPORTED: this workflow cannot currently produce a working build.
# The target was abandoned in 2025; its caller in matrix.yml was commented out
# on 2025-07-14 in commit f530407bda (PR #81827). SDL2 support has since been
# removed. Emscripten ships an SDL3 port and SDL3_ttf, but no SDL3_image or
# SDL3_mixer, so how to build tiles here is an open question. Kept in its
# bit-rotted state for anyone who wants to revive the path.
name: Emscripten build
on:
workflow_call:
# We only care about the latest revision of a PR, so cancel previous instances.
concurrency:
group: emscripten-build-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
jobs:
build_catatclysm:
name: Build
runs-on: ubuntu-latest
env:
CCACHE: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
- name: Install ccache
run: |
emsdk install ccache-git-emscripten-64bit
emsdk activate ccache-git-emscripten-64bit
- name: Get ccache vars
id: get-vars
run: |
echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT
echo "datetime-seconds=$(/bin/date +%s)" >> $GITHUB_OUTPUT
echo "ccache-path=$(echo '~/.cache/ccache')" >> $GITHUB_OUTPUT
- name: ccache cache files
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ steps.get-vars.outputs.ccache-path }}
# double-dash after compiler is not a typo, it is to disambiguate between g++-<date> and g++-11-<date> for restore key prefix matching
key: ccache-${{ github.ref_name }}-emscripten--${{ steps.get-vars.outputs.datetime }}
restore-keys: |
ccache-master-emscripten--
- name: Build with emcc (emscripten)
run: |
emsdk activate ccache-git-emscripten-64bit
# This $PATH manipulation is to work around a bug in emsdk, see
# https://github.com/emscripten-core/emsdk/pull/1345
# Once that bug is fixed, we should be able to drop this weird PATH
# stuff.
export PATH="${PATH%%:*}/../../ccache/git-emscripten_64bit/bin":$PATH
# The forked ccache seems to crash unless EM_CONFIG is defined, I'm not
# sure why this isn't figured out automatically.
export EM_CONFIG=$EMSDK/.emscripten
export CCACHE_COMPILERCHECK=string:3.1.51
ccache --zero-stats
ccache -M 20G
ccache --show-stats
./build-scripts/build-emscripten.sh
- name: post-build ccache manipulation
run: |
emsdk activate ccache-git-emscripten-64bit
export PATH="${PATH%%:*}/../../ccache/git-emscripten_64bit/bin":$PATH
ccache --show-stats
NOW=`/bin/date +%s`
DELTA=$(( $NOW - ${STEPS_GET_VARS_OUTPUTS_DATETIME_SECONDS} ))
ccache --evict-older-than ${DELTA}s
ccache --show-stats
ccache -M 1G
ccache -c
ccache --show-stats
env:
STEPS_GET_VARS_OUTPUTS_DATETIME_SECONDS: ${{ steps.get-vars.outputs.datetime-seconds }}
- name: clear ccache on PRs
if: ${{ github.ref_name != 'master' && !failure() }}
run: |
emsdk activate ccache-git-emscripten-64bit
export PATH="${PATH%%:*}/../../ccache/git-emscripten_64bit/bin":$PATH
ccache -C
- name: Assemble web bundle
run: ./build-scripts/prepare-web.sh
- name: Create artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: play-cdda
path: build/*