94 lines
3.3 KiB
YAML
94 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
# actions/upload-artifact@v5 still runs on Node.js 20. Force Node 24 to
|
|
# silence the deprecation warning until upload-artifact ships a Node-24
|
|
# release. Drop this once upgraded.
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
|
|
jobs:
|
|
simple_build_linux:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Get Dependencies
|
|
run: |
|
|
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
|
|
- name: Build
|
|
run: |
|
|
./configure
|
|
make database/database.h
|
|
make -j$(nproc)
|
|
simple_build_wasm:
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
# --- emsdk version switch ---------------------------------------------
|
|
# Pinned: post-build.sh patches depend on the exact text output of this
|
|
# Emscripten version. Bump intentionally and re-verify the patches.
|
|
# To test against the latest emsdk, comment the pinned line and
|
|
# uncomment the "latest" line below.
|
|
EMSDK_VERSION: '3.1.56'
|
|
# EMSDK_VERSION: 'latest'
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Get Dependencies
|
|
run: |
|
|
git clone https://github.com/emscripten-core/emsdk.git
|
|
cd emsdk
|
|
./emsdk install "$EMSDK_VERSION"
|
|
./emsdk activate "$EMSDK_VERSION"
|
|
# Dump native + emscripten preprocessor defines. Useful for diagnosing
|
|
# WASM-build differences after an emsdk bump.
|
|
- name: Emscripten Diagnostic
|
|
run: |
|
|
source ./emsdk/emsdk_env.sh
|
|
echo "===== gcc -dM -E - ====="
|
|
echo | gcc -dM -E - | sort
|
|
echo "===== g++ -dM -E - ====="
|
|
echo | g++ -dM -E - | sort
|
|
echo "===== emcc -dM -E - ====="
|
|
echo | emcc -dM -E - | sort
|
|
echo "===== em++ -dM -E - ====="
|
|
echo | em++ -dM -E - | sort
|
|
- name: Build
|
|
run: |
|
|
source ./emsdk/emsdk_env.sh
|
|
# --without/--disable flags: no WASM library available for these features
|
|
CFLAGS="--std=c17 -D_DEFAULT_SOURCE=1 -DEMSCRIPTEN=1 -g" emconfigure ./configure \
|
|
--without-cairo --without-opengl --without-x --without-tk --without-tcl \
|
|
--disable-readline --disable-compression \
|
|
--host=asmjs-unknown-emscripten \
|
|
--target=asmjs-unknown-emscripten
|
|
# Append WASM linker flags and activate the WASM link target
|
|
cat toolchains/emscripten/defs.mak >> defs.mak
|
|
# Echo the merged defs.mak so CI logs show the exact build config
|
|
echo "===== defs.mak ====="
|
|
cat defs.mak
|
|
echo "===== defs.mak ====="
|
|
# Build in order: techs must exist before mains (--embed-file embeds them)
|
|
emmake make depend
|
|
emmake make -j$(nproc) modules libs
|
|
emmake make techs
|
|
emmake make mains
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: '22'
|
|
- name: Run example tests
|
|
run: |
|
|
cp magic/magic.js npm/
|
|
cp magic/magic.wasm npm/
|
|
cd npm && npm run test
|
|
- name: Pack npm package
|
|
run: ./npm/pack.sh
|
|
- name: Upload npm package
|
|
uses: actions/upload-artifact@v5
|
|
with:
|
|
name: magic-vlsi-wasm-npm
|
|
path: ${{ github.workspace }}/npm/*.tgz
|