cmd_step one-call form: events= tape rows, deferred completion, lua= … #413
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # LuaJIT cannot compile LuaRocks.org's root manifest after it grew past | |
| # 65,536 constants. Run the LuaRocks frontend with Lua 5.4, while the | |
| # LuaJIT setup below remains the Lua 5.1 target for installed rocks. | |
| - name: Setup isolated Lua 5.4 for LuaRocks | |
| run: | | |
| curl -fsSL https://www.lua.org/ftp/lua-5.4.8.tar.gz | tar xz -C "$RUNNER_TEMP" | |
| make -C "$RUNNER_TEMP/lua-5.4.8/src" posix | |
| echo "TECS_LUA54=$RUNNER_TEMP/lua-5.4.8/src/lua" >> "$GITHUB_ENV" | |
| - name: Setup LuaJIT | |
| uses: leafo/gh-actions-lua@v11 | |
| with: | |
| luaVersion: "luajit" | |
| - name: Setup LuaRocks | |
| uses: leafo/gh-actions-luarocks@v4 | |
| with: | |
| luarocksVersion: "3.12.2" | |
| - name: Install dependencies | |
| run: | | |
| lr() { "$TECS_LUA54" "$(command -v luarocks)" --lua-version=5.1 "$@"; } | |
| lr install busted | |
| lr install luacov | |
| lr --dev install tl | |
| make install-type-deps | |
| - name: Build project | |
| run: | | |
| eval "$(luarocks path)" | |
| make clean | |
| make compile | |
| - name: Run tests | |
| run: | | |
| eval "$(luarocks path)" | |
| make test | |
| test-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Lua 5.4 parses the oversized LuaRocks manifest; LuaJIT below remains | |
| # the target VM and ABI for every installed rock. | |
| - name: Setup isolated Lua 5.4 for LuaRocks | |
| run: | | |
| curl -fsSL https://www.lua.org/ftp/lua-5.4.8.tar.gz | tar xz -C "$RUNNER_TEMP" | |
| make -C "$RUNNER_TEMP/lua-5.4.8/src" posix | |
| echo "TECS_LUA54=$RUNNER_TEMP/lua-5.4.8/src/lua" >> "$GITHUB_ENV" | |
| - name: Setup LuaJIT | |
| uses: leafo/gh-actions-lua@v11 | |
| with: | |
| luaVersion: "luajit" | |
| - name: Setup LuaRocks | |
| uses: leafo/gh-actions-luarocks@v4 | |
| with: | |
| luarocksVersion: "3.12.2" | |
| - name: Install dependencies | |
| run: | | |
| lr() { "$TECS_LUA54" "$(command -v luarocks)" --lua-version=5.1 "$@"; } | |
| lr install busted | |
| lr install luacov | |
| lr --dev install tl | |
| make install-type-deps | |
| - name: Build project | |
| run: | | |
| eval "$(luarocks path)" | |
| make clean | |
| make compile | |
| - name: Run tests | |
| run: | | |
| eval "$(luarocks path)" | |
| make test | |
| # Love2D integration tests: boots real LÖVE fixture apps and drives them | |
| # over the tecs2d MCP HTTP server (spec/integration, `make test-love`). | |
| # Runs on macOS because those runners provide a windowing session with a | |
| # paravirtualized Metal GPU; the Makefile auto-downloads the pinned LÖVE | |
| # 12 nightly. Blocking: proven stable across the full 163-test suite. | |
| test-love-macos: | |
| runs-on: macos-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Lua 5.4 parses the oversized LuaRocks manifest; LuaJIT below remains | |
| # the target VM and ABI for every installed rock. | |
| - name: Setup isolated Lua 5.4 for LuaRocks | |
| run: | | |
| curl -fsSL https://www.lua.org/ftp/lua-5.4.8.tar.gz | tar xz -C "$RUNNER_TEMP" | |
| make -C "$RUNNER_TEMP/lua-5.4.8/src" posix | |
| echo "TECS_LUA54=$RUNNER_TEMP/lua-5.4.8/src/lua" >> "$GITHUB_ENV" | |
| - name: Setup LuaJIT | |
| uses: leafo/gh-actions-lua@v11 | |
| with: | |
| luaVersion: "luajit" | |
| - name: Setup LuaRocks | |
| uses: leafo/gh-actions-luarocks@v4 | |
| with: | |
| luarocksVersion: "3.12.2" | |
| - name: Install dependencies | |
| run: | | |
| lr() { "$TECS_LUA54" "$(command -v luarocks)" --lua-version=5.1 "$@"; } | |
| lr install busted | |
| # test-love resolves LuaSocket from the vendor tree (see the | |
| # target's LUA_CPATH), so install it there like `make dev` does. | |
| lr install --tree=vendor luasocket | |
| lr --dev install tl | |
| make install-type-deps | |
| - name: Build project | |
| run: | | |
| eval "$(luarocks path)" | |
| make clean | |
| make compile | |
| - name: Run Love2D integration tests | |
| run: | | |
| eval "$(luarocks path)" | |
| make test-love | |
| - name: Upload fixture app logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: love-test-logs | |
| path: build/test_deps/love_test_logs/ | |
| if-no-files-found: ignore | |
| # Windows runs through MSYS2/MinGW64, which provides a coherent POSIX shell | |
| # plus LuaJIT, LuaRocks, GNU make, and a C toolchain (needed to build | |
| # busted's C-extension dependencies). The leafo LuaRocks action can't install | |
| # on Windows (it builds from source via ./configure, absent on Windows). | |
| test-windows: | |
| runs-on: windows-latest | |
| env: | |
| TECS_LUA54: /mingw64/bin/lua5.4.exe | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup MSYS2 (MinGW64) | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| git | |
| make | |
| curl | |
| wget | |
| unzip | |
| zip | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-7zip | |
| mingw-w64-x86_64-lua54 | |
| mingw-w64-x86_64-luajit | |
| # MSYS2 has no luarocks package for MinGW64, but its POSIX shell + gcc can | |
| # build it from source (the Windows binary tarball lacks ./configure, which | |
| # is what broke the leafo action). Point it at the MinGW64 LuaJIT. | |
| - name: Install LuaRocks from source | |
| run: | | |
| ver=3.12.2 | |
| curl -L -o luarocks.tar.gz "https://luarocks.org/releases/luarocks-${ver}.tar.gz" | |
| tar xzf luarocks.tar.gz | |
| cd "luarocks-${ver}" | |
| ./configure --prefix=/mingw64 --lua-version=5.1 \ | |
| --with-lua-interpreter=luajit \ | |
| --with-lua=/mingw64 \ | |
| --with-lua-include=/mingw64/include/luajit-2.1 | |
| make | |
| make install | |
| # The LuaRocks frontend modules are pure Lua. Mirror them where the | |
| # Lua 5.4 loader expects them; rock trees and native builds stay 5.1. | |
| mkdir -p /mingw64/share/lua/5.4 | |
| cp -R /mingw64/share/lua/5.1/luarocks /mingw64/share/lua/5.4/ | |
| - name: Cache LuaRocks dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.luarocks | |
| key: windows-luarocks-3.12.2-teal-dev-v2 | |
| - name: Install dependencies | |
| run: | | |
| # MinGW LuaJIT makes LuaRocks use its win32 filesystem backend, which | |
| # extracts rocks via SEVENZ and copies with Windows-style globs. | |
| # Lua 5.4 runs LuaRocks only to parse the oversized registry manifest; | |
| # the configured target and every installed rock remain LuaJIT 5.1. | |
| mkdir -p "$HOME/bin" | |
| printf '%s\n' \ | |
| '#!/usr/bin/env bash' \ | |
| 'a=()' \ | |
| 'for x in "$@"; do' \ | |
| ' x="${x//\\//}"' \ | |
| ' if [[ "$x" == */\*.\* ]]; then x="${x%/*.*}/."; fi' \ | |
| ' a+=("$x")' \ | |
| 'done' \ | |
| 'exec /usr/bin/cp "${a[@]}"' > "$HOME/bin/cp-luarocks" | |
| chmod +x "$HOME/bin/cp-luarocks" | |
| luarocks config --scope user variables.SEVENZ /mingw64/bin/7z | |
| luarocks config --scope user variables.CP "$(cygpath -m /usr/bin/bash.exe) $(cygpath -m "$HOME/bin/cp-luarocks")" | |
| real_luarocks="$(cygpath -m "$(command -v luarocks)")" | |
| rocks_lua="$(cygpath -m /mingw64/share/lua/5.1)" | |
| lr() { | |
| LUA_PATH="$rocks_lua/?.lua;$rocks_lua/?/init.lua;;" \ | |
| "$TECS_LUA54" "$real_luarocks" --lua-version=5.1 "$@" | |
| } | |
| if [ ! -f "$HOME/.luarocks/bin/tl.bat" ] || \ | |
| [ ! -f "$HOME/.luarocks/bin/busted.bat" ] || \ | |
| [ ! -f "$HOME/.luarocks/bin/luacov.bat" ]; then | |
| lr install busted | |
| lr install luacov | |
| lr --dev install tl | |
| fi | |
| printf '%s\n' \ | |
| '#!/usr/bin/env bash' \ | |
| 'rocks_lua="$(cygpath -m /mingw64/share/lua/5.1)"' \ | |
| 'export LUA_PATH="$rocks_lua/?.lua;$rocks_lua/?/init.lua;;$LUA_PATH"' \ | |
| 'exec "$TECS_LUA54" '"\"$real_luarocks\""' --lua-version=5.1 "$@"' \ | |
| > "$HOME/bin/luarocks" | |
| chmod +x "$HOME/bin/luarocks" | |
| export PATH="$HOME/bin:$PATH" | |
| make install-type-deps | |
| for exe in tl busted luacov; do | |
| printf '%s\n' \ | |
| '#!/usr/bin/env bash' \ | |
| 'bat="$HOME/.luarocks/bin/'"$exe"'.bat"' \ | |
| 'exec cmd //C call "$(cygpath -w "$bat")" "$@"' > "$HOME/bin/$exe" | |
| chmod +x "$HOME/bin/$exe" | |
| done | |
| - name: Build project | |
| run: | | |
| export PATH="$HOME/bin:$HOME/.luarocks/bin:$PATH" | |
| export LUA_PATH="$(luarocks path --lr-path);;" | |
| export LUA_CPATH="$(luarocks path --lr-cpath);;" | |
| make clean | |
| # tl ultimately runs as a native Windows process, so its vendor search | |
| # path must be a Windows path even though make runs under MSYS2. | |
| make VENDOR_LUA="$(cygpath -m "$PWD/vendor/share/lua/5.1")" compile | |
| - name: Run tests | |
| run: | | |
| export PATH="$HOME/bin:$HOME/.luarocks/bin:$PATH" | |
| export LUA_PATH="$(luarocks path --lr-path);;" | |
| export LUA_CPATH="$(luarocks path --lr-cpath);;" | |
| make VENDOR_LUA="$(cygpath -m "$PWD/vendor/share/lua/5.1")" test | |
| example-compat: | |
| runs-on: ubuntu-latest | |
| needs: [test, test-macos, test-windows, lint] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: tecs | |
| fetch-depth: 0 | |
| - name: Check for non-doc changes | |
| id: changes | |
| working-directory: tecs | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| changed=$(git diff --name-only "origin/${{ github.base_ref }}"...HEAD) | |
| else | |
| changed=$(jq -r '.commits[]? | (.added[]?, .modified[]?, .removed[]?)' "$GITHUB_EVENT_PATH" | sort -u) | |
| if [ -z "$changed" ]; then | |
| if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then | |
| changed=$(git show --format= --name-only "${{ github.sha }}") | |
| elif git cat-file -e "${{ github.event.before }}^{commit}"; then | |
| changed=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}") | |
| else | |
| echo "run=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| fi | |
| fi | |
| if [ -z "$changed" ]; then | |
| echo "run=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| non_docs=$(printf '%s\n' "$changed" | grep -Ev '^(docs/|$)' || true) | |
| if [ -n "$non_docs" ]; then | |
| echo "run=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "run=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Check out the space example | |
| if: steps.changes.outputs.run == 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tecs-dev/tecs-space-example | |
| path: tecs-space-example | |
| - name: Check out CLI | |
| if: steps.changes.outputs.run == 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tecs-dev/tecs-cli | |
| path: tecs-cli | |
| - name: Build CLI with this Tecs commit | |
| if: steps.changes.outputs.run == 'true' | |
| env: | |
| TECS_DIR: ${{ github.workspace }}/tecs | |
| run: tecs-cli/scripts/build_love.sh | |
| - name: Type-check the space example against this Tecs commit | |
| if: steps.changes.outputs.run == 'true' | |
| working-directory: tecs-space-example | |
| env: | |
| TECS_CACHE_DIR: ${{ runner.temp }}/tecs-cache | |
| TECS_CLI_LOVE: ${{ github.workspace }}/tecs-cli/dist/tecs-cli.love | |
| run: ../tecs-cli/launcher/tecs check | |
| - name: Build the space example against this Tecs commit | |
| if: steps.changes.outputs.run == 'true' | |
| working-directory: tecs-space-example | |
| env: | |
| TECS_CACHE_DIR: ${{ runner.temp }}/tecs-cache | |
| TECS_CLI_LOVE: ${{ github.workspace }}/tecs-cli/dist/tecs-cli.love | |
| run: ../tecs-cli/launcher/tecs build | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Parse the LuaRocks registry with Lua 5.4, but install and type-check for | |
| # the LuaJIT/Lua 5.1 runtime configured below. | |
| - name: Setup isolated Lua 5.4 for LuaRocks | |
| run: | | |
| curl -fsSL https://www.lua.org/ftp/lua-5.4.8.tar.gz | tar xz -C "$RUNNER_TEMP" | |
| make -C "$RUNNER_TEMP/lua-5.4.8/src" posix | |
| echo "TECS_LUA54=$RUNNER_TEMP/lua-5.4.8/src/lua" >> "$GITHUB_ENV" | |
| - name: Setup Lua | |
| uses: leafo/gh-actions-lua@v11 | |
| with: | |
| luaVersion: "luajit" | |
| - name: Setup LuaRocks | |
| uses: leafo/gh-actions-luarocks@v4 | |
| with: | |
| luarocksVersion: "3.12.2" | |
| - name: Install Teal | |
| run: | | |
| "$TECS_LUA54" "$(command -v luarocks)" --lua-version=5.1 --dev install tl | |
| make install-type-deps | |
| - name: Type check | |
| run: make check | |
| docs-descriptions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Every docs page has a description | |
| run: bash scripts/check-docs-descriptions.sh |