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 build dependencies run: | sudo apt-get update sudo apt-get install -y bison cmake curl python3 - 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 build dependencies run: | sudo apt-get update sudo apt-get install -y bison cmake curl python3 - 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