Build scripts, CMake/source patches, npm packaging, and a Gitea CI workflow to compile the real Visual Pinball engine (SDL3 + WebGL2 + libwinevbs for real VBScript) to WebAssembly. The patches are validated end-to-end: the patched engine boots in a real browser, loads a real .vpx table, compiles its real GLSL shaders, computes environment map radiance, initializes physics, and starts the VBScript engine, before hanging on the one deliberately-deferred piece of work (game loop rewrite around emscripten_set_main_loop), documented in the README's roadmap.
129 lines
3.6 KiB
YAML
129 lines
3.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build wasm engine
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Install bison
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y bison
|
|
|
|
- name: Cache emsdk
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: emsdk
|
|
key: emsdk-${{ hashFiles('scripts/versions.sh') }}
|
|
|
|
- name: Cache wasm32 dependency builds
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: build/deps-wasm32
|
|
key: deps-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/**') }}
|
|
|
|
- name: Cache libwinevbs build
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: vendor/libwinevbs/build
|
|
key: libwinevbs-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/libwinevbs/**') }}
|
|
|
|
- name: Setup (fetch + patch vendor sources)
|
|
run: ./scripts/setup.sh
|
|
|
|
- name: Build wasm32 dependencies
|
|
run: |
|
|
source emsdk/emsdk_env.sh
|
|
./scripts/build-deps.sh
|
|
|
|
- name: Build vpinball
|
|
run: |
|
|
source emsdk/emsdk_env.sh
|
|
./scripts/build.sh
|
|
|
|
- name: Verify build output
|
|
run: |
|
|
test -f dist/vpinball.wasm
|
|
test -f dist/vpinball.js
|
|
echo "Build artifacts present:"
|
|
ls -la dist/
|
|
|
|
- name: Build npm wrapper
|
|
run: |
|
|
npm install --no-save typescript
|
|
npx tsc -p package/tsconfig.json
|
|
|
|
- uses: https://github.com/actions/upload-artifact@v4
|
|
with:
|
|
name: vpinball-wasm-dist
|
|
path: dist/
|
|
|
|
publish:
|
|
name: Publish to npm registry
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Install bison
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y bison
|
|
|
|
- name: Cache emsdk
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: emsdk
|
|
key: emsdk-${{ hashFiles('scripts/versions.sh') }}
|
|
|
|
- name: Cache wasm32 dependency builds
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: build/deps-wasm32
|
|
key: deps-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/**') }}
|
|
|
|
- name: Cache libwinevbs build
|
|
uses: https://github.com/actions/cache@v4
|
|
with:
|
|
path: vendor/libwinevbs/build
|
|
key: libwinevbs-wasm32-${{ hashFiles('scripts/versions.sh', 'patches/libwinevbs/**') }}
|
|
|
|
- name: Setup (fetch + patch vendor sources)
|
|
run: ./scripts/setup.sh
|
|
|
|
- name: Build wasm32 dependencies
|
|
run: |
|
|
source emsdk/emsdk_env.sh
|
|
./scripts/build-deps.sh
|
|
|
|
- name: Build vpinball
|
|
run: |
|
|
source emsdk/emsdk_env.sh
|
|
./scripts/build.sh
|
|
|
|
- name: Build npm wrapper
|
|
run: |
|
|
npm install --no-save typescript
|
|
npx tsc -p package/tsconfig.json
|
|
|
|
- name: Set package version from the tag
|
|
run: npm pkg set version="${GITHUB_REF_NAME#v}"
|
|
|
|
# Scoped to this one registry host+path (via publishConfig.registry in
|
|
# package.json) rather than actions/setup-node's registry-url, which
|
|
# would set it as the *default* registry for every install.
|
|
- name: Configure registry auth for publish
|
|
run: npm config set "//dev.pivoine.art/api/packages/valknar/npm/:_authToken" "$PACKAGE_TOKEN"
|
|
env:
|
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
|
|
- name: Publish to Gitea npm registry
|
|
run: npm publish
|