Skip to content

Use the organization-maintained AST generator (#1583) #1896

Use the organization-maintained AST generator (#1583)

Use the organization-maintained AST generator (#1583) #1896

Workflow file for this run

name: CI (build & test)
on:
push:
branches: [ master ]
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
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.
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 }}
timeout-minutes: 25
permissions:
checks: write
contents: read
env:
JAVA_TOOL_OPTIONS: >-
-XX:+UseStringDeduplication
--enable-native-access=ALL-UNNAMED
GRADLE_OPTS: -Dorg.gradle.daemon=false
defaults:
run:
working-directory: de.peeeq.wurstscript
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- 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' }}
java-version: '27'
cache: 'gradle'
# Linux only: use a portable, pristine Temurin 27 for jlink
- name: (Linux) Install portable Temurin 27
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
URL="https://github.com/adoptium/temurin27-binaries/releases/download/jdk-27%2B35/OpenJDK27U-jdk_x64_linux_hotspot_27_35.tar.gz"
mkdir -p "$RUNNER_TEMP/temurin27"
curl -fsSL "$URL" -o "$RUNNER_TEMP/temurin27/jdk.tar.gz"
tar -xzf "$RUNNER_TEMP/temurin27/jdk.tar.gz" -C "$RUNNER_TEMP/temurin27"
PORTABLE_JAVA_HOME="$(find "$RUNNER_TEMP/temurin27" -maxdepth 1 -type d -name 'jdk-27*' | head -n1)"
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: |
ACTIVE_JAVA_HOME="${PORTABLE_JAVA_HOME:-$JAVA_HOME}"
echo "JAVA_HOME=${ACTIVE_JAVA_HOME}" >> "$GITHUB_ENV"
echo "${ACTIVE_JAVA_HOME}/bin" >> "$GITHUB_PATH"
echo "org.gradle.java.installations.paths=${ACTIVE_JAVA_HOME}" >> gradle.properties
echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties
- name: Show Java & jlink
shell: bash
run: |
echo "JAVA_HOME=$JAVA_HOME"
"$JAVA_HOME/bin/java" -version
"$JAVA_HOME/bin/jlink" --version
- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Setup Gradle (cache)
uses: gradle/actions/setup-gradle@v4
- name: Prepare bundled Lua runtime (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
# Use Ubuntu's maintained Lua 5.3 build. The checked-in portable
# binary is linked against libreadline.so.6, which is absent from
# current runner images.
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends lua5.3
lua5.3 -e 'assert(_VERSION == "Lua 5.3")'
luac5.3 -v
# These binaries are tracked with mode 0644 for cross-platform
# 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
- name: Test game-data helpers
timeout-minutes: 5
shell: bash
run: ./gradlew -p ../HelperScripts test --no-daemon --stacktrace --quiet
- name: Run tests
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
else
./gradlew test $ALL_BACKENDS --no-daemon --stacktrace --quiet
fi
- name: Upload coverage to Coveralls
if: github.event_name == 'push' && runner.os == 'Linux'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: de.peeeq.wurstscript/build/reports/jacoco/test/jacocoTestReport.xml
format: jacoco
- name: Report test results
if: always()
uses: mikepenz/action-junit-report@v4
with:
report_paths: de.peeeq.wurstscript/build/test-results/**/*.xml
check_name: Test Results (${{ matrix.os }})
fail_on_failure: false
# luaOutputIsDeterministicForGenericOverrideSlots compiles one program twice and keeps both
# scripts when they differ. They are written to the runner's filesystem, so without this the
# evidence goes with the runner and the failure is as unactionable as it was before it kept
# anything. Most failures are not this test, hence if-no-files-found: ignore.
- name: Upload determinism scripts (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: determinism-scripts-${{ matrix.os }}
path: |
de.peeeq.wurstscript/test-output/determinism-first.lua
de.peeeq.wurstscript/test-output/determinism-second.lua
if-no-files-found: ignore
retention-days: 14