Skip to content

Version Packages (#26) #70

Version Packages (#26)

Version Packages (#26) #70

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
schedule:
# Nightly (07:00 UTC): keep the slow release-profile artifact path honest.
- cron: "0 7 * * *"
# Pinned shellcade-kit toolchain: the author binary the arcade ships, attached
# to this repo's matching release. Bump the version AND the linux/amd64 sha
# (from that release's checksums.txt) together when adopting a new toolchain.
env:
SHELLCADE_KIT_VERSION: "2.2.0"
SHELLCADE_KIT_SHA256: "eab71d43085ce894a0075af0c3af71c9e23c8f3150cc50e46d0df3668742eff7"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with: { go-version-file: go.mod }
- run: go build ./...
- run: go vet ./...
- run: go test ./...
- name: no private imports (the module must build from ABI.md alone)
run: |
! grep -rn "shellcade/shellcade" --include="*.go" . || (echo "FORBIDDEN private import" && exit 1)
# Author journey: prove the experience an author actually has — scaffold a
# fresh game with the pinned shellcade-kit, build the dev-profile wasm, and
# run the arcade's acceptance check on it. The scaffold pins a kit version, so
# we replace it with the PR's checkout to gate THIS repo's code, not a release.
wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { path: kit }
- uses: actions/setup-go@v5
with: { go-version-file: kit/go.mod }
- uses: acifani/setup-tinygo@v2
with: { tinygo-version: "0.41.0" }
- run: sudo apt-get update && sudo apt-get install -y binaryen
- name: fetch pinned shellcade-kit (sha256-verified)
run: |
set -euo pipefail
ver="${SHELLCADE_KIT_VERSION}"
asset="shellcade-kit_${ver}_linux_amd64.tar.gz"
base="https://github.com/shellcade/kit/releases/download/v${ver}"
curl -fsSL -o "${asset}" "${base}/${asset}"
# Verify against the exact sha we pin, then cross-check the release's
# own checksums.txt agrees (defence in depth against a swapped asset).
echo "${SHELLCADE_KIT_SHA256} ${asset}" | sha256sum -c -
curl -fsSL -o checksums.txt "${base}/checksums.txt"
grep " ${asset}\$" checksums.txt | sha256sum -c -
tar -xzf "${asset}" shellcade-kit
sudo install shellcade-kit /usr/local/bin/shellcade-kit
shellcade-kit version
- name: scaffold a fresh game
run: shellcade-kit new cigame
- name: build against this PR's kit (dev profile) and check
run: |
set -euo pipefail
cd cigame
# The scaffold pins a released kit; point it at the PR's checkout so
# the gate exercises THIS repo's SDK, then tidy and build.
go mod edit -replace github.com/shellcade/kit/v2=../kit
go mod tidy
go build ./...
tinygo build -opt=1 -no-debug -gc=leaking -o cigame.wasm \
-target wasip1 -buildmode=c-shared .
ls -la cigame.wasm
shellcade-kit check cigame.wasm
# Rust author journey: the Rust mirror of the wasm job above — scaffold with
# the pinned shellcade-kit (`new --rust`), point the scaffold's crate dep at
# the PR's checkout (the cargo equivalent of `go mod edit -replace`), build
# the release artifact, and run the arcade's acceptance check on it. This is
# the gate that catches scaffolder/crate drift at PR time.
wasm-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { path: kit }
- uses: dtolnay/rust-toolchain@stable
with: { targets: wasm32-wasip1 }
- name: fetch pinned shellcade-kit (sha256-verified)
run: |
set -euo pipefail
ver="${SHELLCADE_KIT_VERSION}"
asset="shellcade-kit_${ver}_linux_amd64.tar.gz"
base="https://github.com/shellcade/kit/releases/download/v${ver}"
curl -fsSL -o "${asset}" "${base}/${asset}"
echo "${SHELLCADE_KIT_SHA256} ${asset}" | sha256sum -c -
curl -fsSL -o checksums.txt "${base}/checksums.txt"
grep " ${asset}\$" checksums.txt | sha256sum -c -
tar -xzf "${asset}" shellcade-kit
sudo install shellcade-kit /usr/local/bin/shellcade-kit
shellcade-kit version
- name: scaffold a fresh Rust game
run: shellcade-kit new --rust cigame
- name: build against this PR's crate (release profile) and check
run: |
set -euo pipefail
cd cigame
# The scaffold pins a released kit tag; point it at the PR's checkout
# so the gate exercises THIS repo's crate.
sed -i 's|^shellcade-kit = .*|shellcade-kit = { path = "../kit/rust" }|' Cargo.toml
cargo build --release --target wasm32-wasip1
ls -la target/wasm32-wasip1/release/cigame.wasm
shellcade-kit check target/wasm32-wasip1/release/cigame.wasm
# Rust SDK: the shellcade-kit crate (rust/) and its golden-vector harness
# (crossverify/). Gates: unit tests, byte-identity with the Go reference
# encoder, a wasm32-wasip1 release build smoke of the crate, and the
# version lockstep (crate version == package.json version, kept in sync by
# scripts/sync-crate-version.mjs at `changeset version` time).
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with: { targets: wasm32-wasip1 }
- name: crate version == kit version (lockstep)
run: |
set -euo pipefail
kit_ver="$(node -p 'require("./package.json").version')"
crate_ver="$(grep -m1 '^version = ' rust/Cargo.toml | cut -d'"' -f2)"
if [ "${kit_ver}" != "${crate_ver}" ]; then
echo "version drift: package.json=${kit_ver} rust/Cargo.toml=${crate_ver}" >&2
echo "run: node scripts/sync-crate-version.mjs" >&2
exit 1
fi
- name: SDK tests
run: cargo test --manifest-path rust/Cargo.toml
- name: golden vectors (byte-identity vs the Go reference encoder)
run: cargo test --release --manifest-path crossverify/Cargo.toml
- name: wasm32-wasip1 release build smoke
run: cargo build --release --target wasm32-wasip1 --manifest-path rust/Cargo.toml
# Slow path: the release profile (-opt=2) that ships. Only nightly and on
# tags — it's the artifact authors submit, so keep it building, but don't
# pay its cost on every PR. Mirrors the author journey, release build.
release-wasm:
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { path: kit }
- uses: actions/setup-go@v5
with: { go-version-file: kit/go.mod }
- uses: acifani/setup-tinygo@v2
with: { tinygo-version: "0.41.0" }
- run: sudo apt-get update && sudo apt-get install -y binaryen
- name: fetch pinned shellcade-kit (sha256-verified)
run: |
set -euo pipefail
ver="${SHELLCADE_KIT_VERSION}"
asset="shellcade-kit_${ver}_linux_amd64.tar.gz"
base="https://github.com/shellcade/kit/releases/download/v${ver}"
curl -fsSL -o "${asset}" "${base}/${asset}"
echo "${SHELLCADE_KIT_SHA256} ${asset}" | sha256sum -c -
curl -fsSL -o checksums.txt "${base}/checksums.txt"
grep " ${asset}\$" checksums.txt | sha256sum -c -
tar -xzf "${asset}" shellcade-kit
sudo install shellcade-kit /usr/local/bin/shellcade-kit
- name: scaffold and release-build (-opt=2) against this PR's kit
run: |
set -euo pipefail
shellcade-kit new cigame
cd cigame
go mod edit -replace github.com/shellcade/kit/v2=../kit
go mod tidy
tinygo build -opt=2 -no-debug -gc=leaking -o cigame.wasm \
-target wasip1 -buildmode=c-shared .
ls -la cigame.wasm
shellcade-kit check cigame.wasm