Files
vpinball-wasm/.gitea/workflows/ci.yml
T
valknarandClaude Sonnet 5 d22dc28af3
CI / Publish to npm registry (push) Canceled after 0s
CI / Build wasm engine (push) Canceled after 36s
Fix CI: drop upload-artifact (unsupported on Gitea, unused downstream)
actions/upload-artifact@v4+ refuses to run on Gitea (it's detected as
GHES, and v4's new backend API explicitly isn't supported there -
GHESNotSupportedError). Rather than pin back to the last GHES-compatible
v3.2.2, just remove the step: the publish job doesn't consume this
artifact - it does its own independent checkout+build - so it was only
ever a convenience for manually downloading dist/ from a CI run, not
something the pipeline depends on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 18:34:09 +02:00

150 lines
5.2 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 build dependencies
run: |
sudo apt-get update
sudo apt-get install -y bison cmake curl python3
# Gitea Actions doesn't support the built-in hashFiles() expression
# function (unlike GitHub Actions) - it silently evaluates to an empty
# string, which turned every cache key below into the same constant
# string regardless of what actually changed, so a cache entry from
# before a dependency-version or patch change would still be reused
# forever. Hash the same inputs by hand instead.
- name: Compute cache keys
id: cache-keys
run: |
echo "emsdk=$(sha256sum scripts/versions.sh | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "deps-wasm32=$(cat scripts/versions.sh $(find patches -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "libwinevbs=$(cat scripts/versions.sh $(find patches/libwinevbs -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Cache emsdk
uses: https://github.com/actions/cache@v4
with:
path: emsdk
key: emsdk-${{ steps.cache-keys.outputs.emsdk }}
- name: Cache wasm32 dependency builds
uses: https://github.com/actions/cache@v4
with:
path: build/deps-wasm32
key: deps-wasm32-${{ steps.cache-keys.outputs.deps-wasm32 }}
- name: Cache libwinevbs build
uses: https://github.com/actions/cache@v4
with:
path: vendor/libwinevbs/build
key: libwinevbs-wasm32-${{ steps.cache-keys.outputs.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
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
# Gitea Actions doesn't support the built-in hashFiles() expression
# function (unlike GitHub Actions) - it silently evaluates to an empty
# string, which turned every cache key below into the same constant
# string regardless of what actually changed, so a cache entry from
# before a dependency-version or patch change would still be reused
# forever. Hash the same inputs by hand instead.
- name: Compute cache keys
id: cache-keys
run: |
echo "emsdk=$(sha256sum scripts/versions.sh | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "deps-wasm32=$(cat scripts/versions.sh $(find patches -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "libwinevbs=$(cat scripts/versions.sh $(find patches/libwinevbs -type f | sort) | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Cache emsdk
uses: https://github.com/actions/cache@v4
with:
path: emsdk
key: emsdk-${{ steps.cache-keys.outputs.emsdk }}
- name: Cache wasm32 dependency builds
uses: https://github.com/actions/cache@v4
with:
path: build/deps-wasm32
key: deps-wasm32-${{ steps.cache-keys.outputs.deps-wasm32 }}
- name: Cache libwinevbs build
uses: https://github.com/actions/cache@v4
with:
path: vendor/libwinevbs/build
key: libwinevbs-wasm32-${{ steps.cache-keys.outputs.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