Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 12 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ concurrency:
cancel-in-progress: true

jobs:
# Master pushes exercise every supported host. Pull requests use one Linux job
# so that the normal feedback loop does not spend four runner-minutes on the
# same compiler test suite; the full host matrix still runs before release.
# The release workflow runs the full platform matrix for version tags.
build:
name: Gradle build on ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ${{ fromJSON(github.event_name == 'push' && '["ubuntu-latest","windows-latest","macos-latest","macos-15-intel"]' || '["ubuntu-latest"]') }}
runs-on: ${{ matrix.os }}
name: Gradle build on ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
checks: write
Expand All @@ -43,14 +37,12 @@ jobs:
- name: Setup JDK 27
uses: actions/setup-java@v4
with:
# Temurin 27 has no macOS x64 build; Zulu keeps the Intel artifact supported.
distribution: ${{ matrix.os == 'macos-15-intel' && 'zulu' || 'temurin' }}
distribution: temurin
java-version: '27'
cache: 'gradle'

# Linux only: use a portable, pristine Temurin 27 for jlink
# Use a portable, pristine Temurin 27 for jlink.
- name: (Linux) Install portable Temurin 27
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
Expand All @@ -62,7 +54,6 @@ jobs:
echo "PORTABLE_JAVA_HOME=$PORTABLE_JAVA_HOME" >> "$GITHUB_ENV"
echo "$PORTABLE_JAVA_HOME/bin" >> "$GITHUB_PATH"

# Pin Gradle toolchain to the active JDK (portable on Linux, setup-java on Windows)
- name: Pin Gradle toolchain
shell: bash
run: |
Expand All @@ -86,7 +77,6 @@ jobs:
uses: gradle/actions/setup-gradle@v4

- name: Prepare bundled Lua runtime (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
Expand All @@ -101,26 +91,16 @@ jobs:
# checkouts; keep them usable as a fallback for local/older images.
chmod +x src/test/resources/lua53 src/test/resources/luac53

- name: Install Lua compiler (macOS)
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: '1'
shell: bash
run: brew install lua

- name: Test release gate
if: runner.os == 'Linux'
shell: bash
run: python ../scripts/test-release.py

- name: Check CI runtime limits
if: runner.os == 'Linux'
timeout-minutes: 1
shell: bash
run: python ../scripts/test-ci-timeouts.py

- name: Test compiler version metadata
if: runner.os == 'Linux'
shell: bash
run: python ../scripts/test-version-metadata.py

Expand All @@ -133,21 +113,15 @@ jobs:
timeout-minutes: 22
shell: bash
run: |
# Master pushes also run every executing test on Lua (-PallBackends) where the Lua is 5.3, as
# the exemptions were established on: Linux installs lua5.3 and Windows uses the bundled lua.exe.
# macOS takes Homebrew's unpinned Lua.
ALL_BACKENDS=""
if [[ "${{ github.event_name }}" == "push" && "${{ runner.os }}" != "macOS" ]]; then
ALL_BACKENDS="-PallBackends"
fi
if [[ "${{ github.event_name }}" == "push" && "${{ runner.os }}" == "Linux" ]]; then
./gradlew test jacocoTestReport $ALL_BACKENDS --no-daemon --stacktrace --quiet
# On master, run all executing tests on Lua 5.3 and collect coverage.
if [[ "${{ github.event_name }}" == "push" ]]; then
./gradlew test jacocoTestReport -PallBackends --no-daemon --stacktrace --quiet
else
./gradlew test $ALL_BACKENDS --no-daemon --stacktrace --quiet
./gradlew test --no-daemon --stacktrace --quiet
fi

- name: Upload coverage to Coveralls
if: github.event_name == 'push' && runner.os == 'Linux'
if: github.event_name == 'push'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -159,7 +133,7 @@ jobs:
uses: mikepenz/action-junit-report@v4
with:
report_paths: de.peeeq.wurstscript/build/test-results/**/*.xml
check_name: Test Results (${{ matrix.os }})
check_name: Test Results (ubuntu-latest)
fail_on_failure: false

# luaOutputIsDeterministicForGenericOverrideSlots compiles one program twice and keeps both
Expand All @@ -170,7 +144,7 @@ jobs:
if: failure()
uses: actions/upload-artifact@v4
with:
name: determinism-scripts-${{ matrix.os }}
name: determinism-scripts-ubuntu-latest
path: |
de.peeeq.wurstscript/test-output/determinism-first.lua
de.peeeq.wurstscript/test-output/determinism-second.lua
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ jobs:
run: ./gradlew -p ../HelperScripts test --no-daemon --stacktrace --quiet
- name: Test compiler and package runtime
timeout-minutes: 27
run: ./gradlew test packageSlimCompilerDist --no-daemon --stacktrace
run: |
args=()
# Linux and Windows use Lua 5.3. macOS uses Homebrew's current Lua.
if [[ "$RUNNER_OS" != "macOS" ]]; then
args+=(-PallBackends)
fi
./gradlew test packageSlimCompilerDist "${args[@]}" --no-daemon --stacktrace
- name: Verify packaged compiler version
run: |
set -euo pipefail
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The Gradle wrapper lives inside `de.peeeq.wurstscript/` (not the repo root); run

### Cross-OS responsibility

PR CI deliberately runs only Ubuntu to keep feedback cheap; master tests Windows and both macOS architectures too.
PRs and untagged master pushes run CI on Ubuntu. The release workflow tests Windows and both macOS architectures too.
**A green Ubuntu PR is not evidence of cross-OS compatibility.** Before finishing a change, inspect the changed code
and tests for host assumptions, run focused checks on the available host, and report which relevant platforms remain
unverified. Keep PR CI slim; do not expand its matrix or add full builds to compensate for missing portability work.
Expand All @@ -138,7 +138,7 @@ tool discovery, map-build fixtures, or runtime packaging. Regressions have repea

* `test().executeProg()` runs the compiled program in the interpreter and requires a `testSuccess()` call.
* `test().testLua(true).executeProg()` runs the **Lua path only** (`testLua` sets `luaOnly`, which skips the Jass and interpreter runs; add `.luaOnly(false)` to keep them). It syntax-checks the emitted Lua with luac and executes it with a stock Lua interpreter (5.3 on Windows and the Linux CI, see below) against the WC3 runtime in `src/test/resources/luaruntime/` (wc3shim + Reforged `common.j.lua`/`blizzard.j.lua` dumps).
* `-PallBackends` (master CI on Linux and Windows) also runs every other executing test on Lua after its Jass runs; `-PallBackends=full` adds a Lua run with `-inline -localOptimizations`. A test which cannot hold on Lua says why, and how it fails there, with `.luaExempt(LuaExemption.X, expectedFailure)` (`testLua(false)` is rejected): it runs no Lua in an ordinary run, and under the flag its Lua run must fail with that text and of the reason's kind (`LuaExemption.mismatch`), so a stale exemption or a new Lua failure fails the test (`LuaExemptionTests`). `KNOWN_LUA_DEFECT` cites its `BACKLOG.md` item by the bold title, and fails every run once that item is gone.
* `-PallBackends` (master CI on Ubuntu and tagged release CI on Linux and Windows) also runs every other executing test on Lua after its Jass runs; `-PallBackends=full` adds a Lua run with `-inline -localOptimizations`. A test which cannot hold on Lua says why, and how it fails there, with `.luaExempt(LuaExemption.X, expectedFailure)` (`testLua(false)` is rejected): it runs no Lua in an ordinary run, and under the flag its Lua run must fail with that text and of the reason's kind (`LuaExemption.mismatch`), so a stale exemption or a new Lua failure fails the test (`LuaExemptionTests`). `KNOWN_LUA_DEFECT` cites its `BACKLOG.md` item by the bold title, and fails every run once that item is gone.
* Interpreter discovery (`WurstScriptTest.getLuaExecutable`): on Linux `lua5.3` from PATH, then the bundled `lua53`; on Windows the bundled `lua.exe`; then `lua53`/`lua` from PATH. The version is never checked: Linux CI asserts 5.3 and the bundled Windows `lua.exe` is 5.3, but CI's macOS job installs whatever `brew install lua` gives. A missing interpreter skips the execution (visibly); a missing `luac` fails the test.
* A Lua run fails when a package fails to initialise ("Could not initialize package X"), even if it reaches `testSuccess`: the generated script reports the failure and goes on without the package. A native which a package init needs belongs in `wc3shim.lua`.
* Use `LuaBackendAuditTests` as the reference style for backend regression repros.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ function GetUnitTypeId(u) return u.typeId end
-- Null-handle defaults let Blizzard helpers evaluate their own conditions. Live unit state is not modeled.
function GetUnitState(u, state)
if u == nil then return 0 end
error("GetUnitState: live unit state is not modeled by the test runtime")
error("The native 'GetUnitState' is not implemented for live units in the test runtime")
end
function CreateDestructable(objectId, x, y, face, scale, variation)
return { typeId = objectId, x = x, y = y, face = face, scale = scale, variation = variation }
Expand Down
4 changes: 2 additions & 2 deletions docs/CROSS_OS_FOOTGUNS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Cross-OS footguns

PR CI intentionally runs Ubuntu only. Master runs compiler tests on Windows x64, Linux x64, macOS arm64 and
macOS x64; the versioned release workflow also packages those hosts. Keep that inexpensive PR loop. Agents own
PRs and untagged master pushes run CI on Ubuntu. The versioned release workflow tests and packages Windows x64,
Linux x64, macOS arm64 and macOS x64. Keep routine CI inexpensive. Agents own
portability in both production code and tests: inspect the affected host boundaries, construct a focused regression
that exposes the assumption, run the relevant test class, and state any platform-specific validation still missing.
One passing host is not a completed portability review.
Expand Down
Loading