From db48c2be51b770b6dc8e93cadbefe3e2c7334f04 Mon Sep 17 00:00:00 2001 From: pedro-bento Date: Wed, 21 Oct 2026 21:41:18 +0100 Subject: [PATCH] Fix pipeline --- .forgejo/scripts/freebsd-build.sh | 17 ++---- .forgejo/scripts/release-asset.sh | 10 +--- .forgejo/workflows/apple.yml | 26 +++------ .forgejo/workflows/release.yml | 94 ++++++++++++------------------- 4 files changed, 50 insertions(+), 97 deletions(-) diff --git a/.forgejo/scripts/freebsd-build.sh b/.forgejo/scripts/freebsd-build.sh index c05f788..63731ef 100644 --- a/.forgejo/scripts/freebsd-build.sh +++ b/.forgejo/scripts/freebsd-build.sh @@ -3,17 +3,9 @@ # # freebsd-build.sh [source-dir] # -# Runs on Linux (CI job container or a workstation) and needs: -# qemu-system-x86, cloud-image-utils (cloud-localds), openssh-client, xz, curl -# -# The FreeBSD guest is booted with -snapshot, so every run starts from the -# pristine image: nothing is installed in it and nothing persists. -# -# Requires /dev/kvm. Under the Forgejo docker runner that means the runner -# config must pass it through, e.g. -# container: -# options: "--device /dev/kvm" -# Without KVM, QEMU falls back to TCG and a FreeBSD boot takes many minutes. +# Needs qemu-system-x86, cloud-image-utils, openssh-client, xz and curl, plus +# /dev/kvm (act_runner: options: "--device /dev/kvm"); under TCG the boot takes +# many minutes. The guest runs with -snapshot, so nothing persists. set -eu VERSION="${FREEBSD_VERSION:-15.1}" @@ -126,8 +118,7 @@ tar czf "$WORK/src.tar.gz" -C "$SRC" \ --exclude='*.o' --exclude='*.a' --exclude='*.so' . scp $SCP_OPTS "$WORK/src.tar.gz" "root@127.0.0.1:/root/src.tar.gz" -# FreeBSD has no gcc; LuaJIT's Makefile defaults to it, so CC must be forced on -# the command line for it to reach the sub-make. +# FreeBSD has no gcc: CC must be on the command line to reach the sub-make. log "building" ssh_vm 'set -e rm -rf /root/src && mkdir -p /root/src diff --git a/.forgejo/scripts/release-asset.sh b/.forgejo/scripts/release-asset.sh index e7999d5..0921bf2 100644 --- a/.forgejo/scripts/release-asset.sh +++ b/.forgejo/scripts/release-asset.sh @@ -3,11 +3,8 @@ # # release-asset.sh [asset-name] # -# Idempotent: re-running a tagged pipeline replaces the existing asset instead -# of failing, and concurrent jobs racing to create the same release converge on -# whichever POST wins. -# -# Environment: FORGEJO_API_URL, FORGEJO_TOKEN, REPO (owner/name), TAG +# Idempotent: a re-run replaces the asset, and jobs racing to create the same +# release converge. Env: FORGEJO_API_URL, FORGEJO_TOKEN, REPO, TAG. set -eu api="${FORGEJO_API_URL:?FORGEJO_API_URL is not set}" @@ -18,8 +15,7 @@ token="${FORGEJO_TOKEN:?FORGEJO_TOKEN is not set}" case "$api" in http*) ;; *) - # An unexpanded ${{ github.server_url }} leaves this as a bare "/api/v1"; - # fail loudly instead of letting curl emit a cryptic URL error. + # An unexpanded github.server_url leaves a bare "/api/v1"; fail loudly. echo "release-asset: FORGEJO_API_URL is not a URL: '$api'" >&2 echo " set github.server_url support or override the env var" >&2 exit 1 diff --git a/.forgejo/workflows/apple.yml b/.forgejo/workflows/apple.yml index 7a2d7d8..57a38eb 100644 --- a/.forgejo/workflows/apple.yml +++ b/.forgejo/workflows/apple.yml @@ -1,13 +1,7 @@ -# Apple targets (macOS + iOS), kept out of the main release pipeline. -# -# Why a separate file: Forgejo Runner is Linux-only, so these jobs need a -# self-hosted runner carrying the `macos` label. Gating them inside -# release.yml with `if: vars.ENABLE_MACOS == 'true'` did not work -- Forgejo -# does not evaluate the `vars` context there, so the jobs were queued forever -# on a label that does not exist and the whole run never finished. -# -# This workflow only exists when dispatched by hand, so it costs nothing until -# a Mac runner is registered. +# Apple targets (macOS + iOS), kept out of release.yml: they need a `macos` +# runner. Gating them there with `if: vars.*` does not work -- Forgejo does not +# evaluate `vars` in `if:`, so the jobs queued forever and the run never +# finished. Manual dispatch only, until a Mac runner exists. name: apple on: @@ -26,8 +20,7 @@ env: jobs: # --------------------------------------------------------------------------- - # macOS. Apple SDKs are universal, so either runner arch can cross-build the - # other; only the target objects get -arch, the build tools stay native. + # macOS. The SDKs are universal: only target objects get -arch. # --------------------------------------------------------------------------- macos: name: macos/${{ matrix.arch }} @@ -42,10 +35,8 @@ jobs: with: submodules: false - # luajit.org serves git over dumb HTTP, which rejects shallow clones. - # checkout's submodule support always passes --depth, which fails with - # "dumb http transport does not support shallow capabilities", so the - # submodule is cloned in full here instead. + # luajit.org is dumb HTTP and rejects the --depth that checkout's + # submodule support always passes, so clone it here in full. - name: Fetch submodules run: git submodule update --init --recursive @@ -67,8 +58,7 @@ jobs: run: sh .forgejo/scripts/release-asset.sh ./hate-no-d "hate-no-d-macos-${{ matrix.arch }}" # --------------------------------------------------------------------------- - # iOS. Deliberately produces no executable: the JIT is compiled out and the - # archive is linked into an Xcode app target. Requires jq for the upload. + # iOS. Builds only the archive (JIT compiled out) for an Xcode app target. # --------------------------------------------------------------------------- ios: name: ios/arm64 diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index f0ffd1d..51718ca 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -1,20 +1,10 @@ -# Build hate-no-d for every supported target and attach the binaries to a Forgejo release. +# Build every supported target and attach the binaries to a Forgejo release. # -# push to master / pull request -> build only -# push a tag matching 'v*' -> build + release assets -# workflow_dispatch -> same as a branch push +# push / pull_request -> build only +# tag 'v*' -> build + release assets # -# Release assets are uploaded straight to the REST API, one file per platform: -# hate-no-d-linux-{x86_64,i686,aarch64,armv7} -# hate-no-d-android-{arm64-v8a,armeabi-v7a,x86_64} -# hate-no-d-windows_mingw_w64-{x64,x86}.exe -# hate-no-d-freebsd-x86_64 -# -# apple.yml adds hate-no-d-macos-{arm64,x86_64} and hate-no-d-ios-arm64-luajit.a -# when it is dispatched against a Mac runner. -# -# Everything in this file builds on a Linux runner: FreeBSD inside a QEMU guest, -# Windows cross-compiled with mingw-w64. +# Assets: hate-no-d-linux-*, -android-*, -windows_mingw_w64-*.exe, -freebsd-x86_64. +# macOS/iOS live in apple.yml; everything here builds on the Linux runner. name: release on: @@ -28,10 +18,8 @@ concurrency: group: release-${{ github.ref }} cancel-in-progress: true -# Note: Forgejo ignores `permissions:` entirely. The automatic workflow token -# already has write access to its own repository, which is what the release -# steps rely on. Forked pull requests get a read-only token, but they never -# reach the upload steps (those are tag-gated). +# Forgejo ignores `permissions:`; the workflow token already has write access +# to its own repo, and fork PRs never reach the tag-gated upload steps. env: FORGEJO_API_URL: ${{ github.server_url }}/api/v1 @@ -41,15 +29,15 @@ env: jobs: # --------------------------------------------------------------------------- - # Linux. Built on Debian bullseye so the binaries carry a glibc 2.31 floor - # (Debian 11, Ubuntu 20.04+, RHEL 9). Bumping the image silently raises that - # floor, so do not move it without meaning to. + # Linux. bookworm sets the glibc 2.36 floor (Debian 12, Ubuntu 24.04+) and is + # shared with the android/windows jobs. Do not fall back to bullseye: its LTS + # ended 2026-08 and deb.debian.org no longer serves bullseye-security. # --------------------------------------------------------------------------- linux: name: linux/${{ matrix.arch }} runs-on: docker container: - image: node:20-bullseye # node + git: actions/checkout is a JS action + image: node:20-bookworm # node + git: actions/checkout is a JS action strategy: fail-fast: false matrix: @@ -58,10 +46,8 @@ jobs: machine: X86-64 make_args: '' packages: '' - # 32-bit target: HOST_CC defaults to $(CC), so leaving HOST_CC - # unset builds minilua/buildvm 32-bit too. LuaJIT requires host and - # target pointer sizes to match -- do not "optimise" this to - # HOST_CC=gcc. + # 32-bit target: leaving HOST_CC unset keeps minilua/buildvm 32-bit + # too. Host and target pointer sizes must match -- do not use HOST_CC=gcc. - arch: i686 machine: 'Intel 80386' make_args: 'CC="gcc -m32"' @@ -70,12 +56,16 @@ jobs: - arch: aarch64 machine: AArch64 make_args: 'CC=aarch64-linux-gnu-gcc HOST_CC=gcc' - packages: 'gcc-aarch64-linux-gnu qemu-user-static' - # 32-bit target: the 32-bit host tools are mandatory here. + packages: 'gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user-static' + # 32-bit target, so the host tools must be 32-bit too. gcc-multilib + # cannot be installed (gcc-12-arm-linux-gnueabihf conflicts with it); + # lib32gcc-12-dev + libc6-dev-i386 replace it, and linux-libc-dev:i386 + # adds the 32-bit asm/ headers. - arch: armv7 machine: ARM make_args: 'CC=arm-linux-gnueabihf-gcc HOST_CC="gcc -m32"' - packages: 'gcc-arm-linux-gnueabihf qemu-user-static gcc-multilib libc6-dev-i386' + packages: 'gcc-arm-linux-gnueabihf libc6-dev-armhf-cross lib32gcc-12-dev libc6-dev-i386 linux-libc-dev:i386 qemu-user-static' + multiarch_i386: true steps: - name: Checkout uses: https://data.forgejo.org/actions/checkout@v4 @@ -88,6 +78,10 @@ jobs: - name: Install toolchain run: | set -eu + # Only armv7: linux-libc-dev:i386 provides its 32-bit asm/ headers. + if [ '${{ matrix.multiarch_i386 }}' = 'true' ]; then + dpkg --add-architecture i386 + fi apt-get update -qq apt-get install -y --no-install-recommends \ make gcc libc6-dev binutils jq curl ca-certificates ${{ matrix.packages }} @@ -95,8 +89,7 @@ jobs: - name: Build run: make ${{ matrix.make_args }} all - # Guards the cross builds: a mis-set CROSS/CC silently yields a host - # binary, which is otherwise indistinguishable until it is run. + # A mis-set CC silently yields a host binary, so check the ELF machine. - name: Verify architecture run: | set -eu @@ -108,9 +101,8 @@ jobs: run: sh .forgejo/scripts/release-asset.sh ./hate-no-d "hate-no-d-linux-${{ matrix.arch }}" # --------------------------------------------------------------------------- - # Android. One job for all three ABIs: the NDK is a ~630 MB download and - # sharing it beats three parallel copies. The resulting binaries are Bionic - # ELF, so they cannot be executed here -- only the ELF header is checked. + # Android. One job for all ABIs so the ~630 MB NDK is downloaded once. The + # binaries are Bionic ELF, so only the ELF header can be checked here. # --------------------------------------------------------------------------- android: name: android @@ -131,8 +123,7 @@ jobs: run: git submodule update --init --recursive - name: Install toolchain - # gcc-multilib is needed for the 32-bit host tools LuaJIT requires when - # the target is 32-bit (armeabi-v7a). + # gcc-multilib: armeabi-v7a needs 32-bit host tools. run: | set -eu apt-get update -qq @@ -176,16 +167,9 @@ jobs: done # --------------------------------------------------------------------------- - # FreeBSD. Built inside a FreeBSD VM booted with QEMU/KVM on the Linux runner, - # so no FreeBSD runner is needed: the tooling lives on the Linux side and only - # the compilation happens in the guest. - # - # The job container needs /dev/kvm, e.g. in the act_runner config: - # container: - # options: "--device /dev/kvm" - # Without it the script fails immediately rather than crawling along on TCG. - # - # Measured ~1m40s end to end: 70s boot, ~15s pkg install, ~14s build. + # FreeBSD. Compiled inside a QEMU/KVM guest, so no FreeBSD runner is needed. + # The container must expose /dev/kvm (act_runner: options: "--device /dev/kvm"), + # otherwise QEMU falls back to TCG and the boot crawls. ~1m40s end to end. # --------------------------------------------------------------------------- bsd: name: freebsd/x86_64 @@ -220,16 +204,9 @@ jobs: run: sh .forgejo/scripts/release-asset.sh dist/hate-no-d-freebsd-x86_64 hate-no-d-freebsd-x86_64 # --------------------------------------------------------------------------- - # Windows. Cross-compiled with mingw-w64 on the Linux runner, so no Windows - # machine and no MSVC are involved: the result is a self-contained PE that - # imports only KERNEL32/msvcrt. build.bat remains for native MSVC builds. - # - # i686 needs a 32-bit host compiler: LuaJIT's buildvm runs natively and must - # have the target's pointer size. - # - # Releases are named hate-no-d-windows_mingw_w64-x64.exe and - # hate-no-d-windows_mingw_w64-x86.exe. The build itself stays hate-no-d.exe - # (same as build.bat); the toolchain-qualified name is only the asset name. + # Windows. Cross-compiled with mingw-w64; no Windows machine or MSVC involved. + # i686 needs a 32-bit host compiler for the native buildvm. The build stays + # hate-no-d.exe -- only the release asset name carries the toolchain. # --------------------------------------------------------------------------- windows: name: windows/${{ matrix.arch }} @@ -255,8 +232,7 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive - # libc6-dev is not pulled in by gcc under --no-install-recommends, and - # without it the host build of minilua cannot find limits.h. + # --no-install-recommends omits libc6-dev, and minilua needs limits.h. - name: Install toolchain run: | set -eu