Skip to content

[pull] master from GaijinEntertainment:master #1013

[pull] master from GaijinEntertainment:master

[pull] master from GaijinEntertainment:master #1013

Workflow file for this run

name: wasm_build
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
###########################################################
pre_job:
###########################################################
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest-fat
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'same_content'
do_not_skip: '["pull_request", "workflow_dispatch"]'
###########################################################
wasm_build:
###########################################################
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
target: [linux, darwin, windows]
architecture: [ 64 ]
cmake_preset: [ Release ]
include:
- target: linux
runner: ubuntu-latest-fat
- target: darwin
runner: macos-latest-xlarge
- target: windows
runner: windows-latest-fat
- target: windows
architecture: 64
architecture_string: x64
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: "Install: Required Dev Packages"
run: |
set -eux
git clone https://github.com/emscripten-core/emsdk.git
case "${{ matrix.target }}${{ matrix.architecture }}" in
linux64)
echo "MARCH=64" >> $GITHUB_ENV
sudo apt-get update -y
sudo apt-get install --no-install-recommends -y \
libatomic-ops-dev \
libglu1-mesa-dev \
freeglut3-dev \
mesa-common-dev \
libglfw3-dev \
libfreetype6-dev \
libudev-dev \
libopenal-dev \
libvorbis-dev \
libflac-dev \
libclang-dev \
libx11-dev \
libxrandr-dev \
libxcursor-dev \
libxinerama-dev \
libxi-dev
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
source "/home/runner/work/daScript/daScript/emsdk/emsdk_env.sh"
;;
windows*)
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
./emsdk/emsdk_env.bat
;;
*)
# macOS stock bison is 2.3; install Homebrew bison 3.x and shadow
# the system one on PATH so any FIND_FLEX_AND_BISON pickup is sane.
if [[ "$(uname -m)" == "arm64" ]]; then
brew install bison
echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> ~/.bash_profile
export PATH="/opt/homebrew/opt/bison/bin:$PATH"
else
brew install bison
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
export PATH="/usr/local/opt/bison/bin:$PATH"
fi
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
source "/Users/runner/work/daScript/daScript/emsdk/emsdk_env.sh"
;;
esac
- name: "Build: daslang web"
run: |
set -eux
cd web
rm -r -f cmake_temp
mkdir cmake_temp
cd cmake_temp
cmake -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake_preset }} -G Ninja -DCMAKE_TOOLCHAIN_FILE=../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake ../
ninja
- name: "Test: hello world via Node.js"
run: |
set -eux
# Use emsdk-bundled Node (deterministic version that supports the
# --experimental-wasm-exnref flag). System Node may be older or use
# a different spelling for the EH proposal flag.
source ./emsdk/emsdk_env.sh
cd web
# Modern wasm EH proposal (try_table / exnref) is gated in Node 22.
# Default-on in Node 24+. Force-enable for forward compat with current LTS.
"$EMSDK_NODE" --experimental-wasm-exnref test/dastest_wasm.js ../ ./output
###########################################################
wasm_cross:
###########################################################
# Cross-compile utility mains to wasm32 via dasLLVM and execute under
# wasmtime. Smoke-tests the runtime-linked cross-compile pipeline
# end-to-end (see modules/dasLLVM/README.md "Cross-compilation").
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest-fat
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Setup Emscripten
uses: emscripten-core/setup-emsdk@v11
with:
# 5.0.7 ships clang commit 7b58716d that crashes in
# TextDiagnostic::emitSnippetAndCaret on utils/dasFormatter/ds_parser.cpp
# (std::length_error during diagnostic snippet rendering). 5.0.3 works.
version: '5.0.3'
- name: Setup Wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "44.0.1"
- name: "Install: graphics dev libs"
run: |
set -eux
sudo apt-get update -y
# OpenGL + GLFW headers needed by dasGlfw (enabled by default in host
# cmake). Same set as extended_checks.yml.
sudo apt-get install --no-install-recommends -y \
mesa-common-dev libglu1-mesa-dev libgl1-mesa-dev libglfw3-dev \
libx11-dev libxrandr-dev libxcursor-dev libxinerama-dev libxi-dev
- name: "Build + run cross-compiled wasm examples"
run: |
set -eux
cd web
mkdir -p cmake_temp && cd cmake_temp
emcmake cmake -DCMAKE_BUILD_TYPE=Release -G Ninja ..
ninja run_wasm_examples