Fix pipeline
All checks were successful
release / linux/aarch64 (pull_request) Successful in 58s
release / linux/armv7 (pull_request) Successful in 1m6s
release / linux/i686 (pull_request) Successful in 45s
release / linux/x86_64 (pull_request) Successful in 41s
release / android (pull_request) Successful in 1m42s
release / freebsd/x86_64 (pull_request) Successful in 4m45s
release / windows/i686 (pull_request) Successful in 1m6s
release / windows/x86_64 (pull_request) Successful in 1m18s

This commit is contained in:
pedro-bento 2026-10-21 21:41:18 +01:00
parent 0954f5cbfc
commit db48c2be51
4 changed files with 50 additions and 97 deletions

View file

@ -3,17 +3,9 @@
# #
# freebsd-build.sh <output-file> [source-dir] # freebsd-build.sh <output-file> [source-dir]
# #
# Runs on Linux (CI job container or a workstation) and needs: # Needs qemu-system-x86, cloud-image-utils, openssh-client, xz and curl, plus
# qemu-system-x86, cloud-image-utils (cloud-localds), openssh-client, xz, curl # /dev/kvm (act_runner: options: "--device /dev/kvm"); under TCG the boot takes
# # many minutes. The guest runs with -snapshot, so nothing persists.
# 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.
set -eu set -eu
VERSION="${FREEBSD_VERSION:-15.1}" VERSION="${FREEBSD_VERSION:-15.1}"
@ -126,8 +118,7 @@ tar czf "$WORK/src.tar.gz" -C "$SRC" \
--exclude='*.o' --exclude='*.a' --exclude='*.so' . --exclude='*.o' --exclude='*.a' --exclude='*.so' .
scp $SCP_OPTS "$WORK/src.tar.gz" "root@127.0.0.1:/root/src.tar.gz" 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 # FreeBSD has no gcc: CC must be on the command line to reach the sub-make.
# the command line for it to reach the sub-make.
log "building" log "building"
ssh_vm 'set -e ssh_vm 'set -e
rm -rf /root/src && mkdir -p /root/src rm -rf /root/src && mkdir -p /root/src

View file

@ -3,11 +3,8 @@
# #
# release-asset.sh <file> [asset-name] # release-asset.sh <file> [asset-name]
# #
# Idempotent: re-running a tagged pipeline replaces the existing asset instead # Idempotent: a re-run replaces the asset, and jobs racing to create the same
# of failing, and concurrent jobs racing to create the same release converge on # release converge. Env: FORGEJO_API_URL, FORGEJO_TOKEN, REPO, TAG.
# whichever POST wins.
#
# Environment: FORGEJO_API_URL, FORGEJO_TOKEN, REPO (owner/name), TAG
set -eu set -eu
api="${FORGEJO_API_URL:?FORGEJO_API_URL is not set}" 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 case "$api" in
http*) ;; http*) ;;
*) *)
# An unexpanded ${{ github.server_url }} leaves this as a bare "/api/v1"; # An unexpanded github.server_url leaves a bare "/api/v1"; fail loudly.
# fail loudly instead of letting curl emit a cryptic URL error.
echo "release-asset: FORGEJO_API_URL is not a URL: '$api'" >&2 echo "release-asset: FORGEJO_API_URL is not a URL: '$api'" >&2
echo " set github.server_url support or override the env var" >&2 echo " set github.server_url support or override the env var" >&2
exit 1 exit 1

View file

@ -1,13 +1,7 @@
# Apple targets (macOS + iOS), kept out of the main release pipeline. # 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
# Why a separate file: Forgejo Runner is Linux-only, so these jobs need a # evaluate `vars` in `if:`, so the jobs queued forever and the run never
# self-hosted runner carrying the `macos` label. Gating them inside # finished. Manual dispatch only, until a Mac runner exists.
# 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.
name: apple name: apple
on: on:
@ -26,8 +20,7 @@ env:
jobs: jobs:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# macOS. Apple SDKs are universal, so either runner arch can cross-build the # macOS. The SDKs are universal: only target objects get -arch.
# other; only the target objects get -arch, the build tools stay native.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
macos: macos:
name: macos/${{ matrix.arch }} name: macos/${{ matrix.arch }}
@ -42,10 +35,8 @@ jobs:
with: with:
submodules: false submodules: false
# luajit.org serves git over dumb HTTP, which rejects shallow clones. # luajit.org is dumb HTTP and rejects the --depth that checkout's
# checkout's submodule support always passes --depth, which fails with # submodule support always passes, so clone it here in full.
# "dumb http transport does not support shallow capabilities", so the
# submodule is cloned in full here instead.
- name: Fetch submodules - name: Fetch submodules
run: git submodule update --init --recursive 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 }}" 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 # iOS. Builds only the archive (JIT compiled out) for an Xcode app target.
# archive is linked into an Xcode app target. Requires jq for the upload.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
ios: ios:
name: ios/arm64 name: ios/arm64

View file

@ -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 / pull_request -> build only
# push a tag matching 'v*' -> build + release assets # tag 'v*' -> build + release assets
# workflow_dispatch -> same as a branch push
# #
# Release assets are uploaded straight to the REST API, one file per platform: # Assets: hate-no-d-linux-*, -android-*, -windows_mingw_w64-*.exe, -freebsd-x86_64.
# hate-no-d-linux-{x86_64,i686,aarch64,armv7} # macOS/iOS live in apple.yml; everything here builds on the Linux runner.
# 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.
name: release name: release
on: on:
@ -28,10 +18,8 @@ concurrency:
group: release-${{ github.ref }} group: release-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
# Note: Forgejo ignores `permissions:` entirely. The automatic workflow token # Forgejo ignores `permissions:`; the workflow token already has write access
# already has write access to its own repository, which is what the release # to its own repo, and fork PRs never reach the tag-gated upload steps.
# steps rely on. Forked pull requests get a read-only token, but they never
# reach the upload steps (those are tag-gated).
env: env:
FORGEJO_API_URL: ${{ github.server_url }}/api/v1 FORGEJO_API_URL: ${{ github.server_url }}/api/v1
@ -41,15 +29,15 @@ env:
jobs: jobs:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Linux. Built on Debian bullseye so the binaries carry a glibc 2.31 floor # Linux. bookworm sets the glibc 2.36 floor (Debian 12, Ubuntu 24.04+) and is
# (Debian 11, Ubuntu 20.04+, RHEL 9). Bumping the image silently raises that # shared with the android/windows jobs. Do not fall back to bullseye: its LTS
# floor, so do not move it without meaning to. # ended 2026-08 and deb.debian.org no longer serves bullseye-security.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
linux: linux:
name: linux/${{ matrix.arch }} name: linux/${{ matrix.arch }}
runs-on: docker runs-on: docker
container: 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: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -58,10 +46,8 @@ jobs:
machine: X86-64 machine: X86-64
make_args: '' make_args: ''
packages: '' packages: ''
# 32-bit target: HOST_CC defaults to $(CC), so leaving HOST_CC # 32-bit target: leaving HOST_CC unset keeps minilua/buildvm 32-bit
# unset builds minilua/buildvm 32-bit too. LuaJIT requires host and # too. Host and target pointer sizes must match -- do not use HOST_CC=gcc.
# target pointer sizes to match -- do not "optimise" this to
# HOST_CC=gcc.
- arch: i686 - arch: i686
machine: 'Intel 80386' machine: 'Intel 80386'
make_args: 'CC="gcc -m32"' make_args: 'CC="gcc -m32"'
@ -70,12 +56,16 @@ jobs:
- arch: aarch64 - arch: aarch64
machine: AArch64 machine: AArch64
make_args: 'CC=aarch64-linux-gnu-gcc HOST_CC=gcc' make_args: 'CC=aarch64-linux-gnu-gcc HOST_CC=gcc'
packages: 'gcc-aarch64-linux-gnu qemu-user-static' packages: 'gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user-static'
# 32-bit target: the 32-bit host tools are mandatory here. # 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 - arch: armv7
machine: ARM machine: ARM
make_args: 'CC=arm-linux-gnueabihf-gcc HOST_CC="gcc -m32"' 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: steps:
- name: Checkout - name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4 uses: https://data.forgejo.org/actions/checkout@v4
@ -88,6 +78,10 @@ jobs:
- name: Install toolchain - name: Install toolchain
run: | run: |
set -eu 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 update -qq
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
make gcc libc6-dev binutils jq curl ca-certificates ${{ matrix.packages }} make gcc libc6-dev binutils jq curl ca-certificates ${{ matrix.packages }}
@ -95,8 +89,7 @@ jobs:
- name: Build - name: Build
run: make ${{ matrix.make_args }} all run: make ${{ matrix.make_args }} all
# Guards the cross builds: a mis-set CROSS/CC silently yields a host # A mis-set CC silently yields a host binary, so check the ELF machine.
# binary, which is otherwise indistinguishable until it is run.
- name: Verify architecture - name: Verify architecture
run: | run: |
set -eu set -eu
@ -108,9 +101,8 @@ jobs:
run: sh .forgejo/scripts/release-asset.sh ./hate-no-d "hate-no-d-linux-${{ matrix.arch }}" 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 # Android. One job for all ABIs so the ~630 MB NDK is downloaded once. The
# sharing it beats three parallel copies. The resulting binaries are Bionic # binaries are Bionic ELF, so only the ELF header can be checked here.
# ELF, so they cannot be executed here -- only the ELF header is checked.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
android: android:
name: android name: android
@ -131,8 +123,7 @@ jobs:
run: git submodule update --init --recursive run: git submodule update --init --recursive
- name: Install toolchain - name: Install toolchain
# gcc-multilib is needed for the 32-bit host tools LuaJIT requires when # gcc-multilib: armeabi-v7a needs 32-bit host tools.
# the target is 32-bit (armeabi-v7a).
run: | run: |
set -eu set -eu
apt-get update -qq apt-get update -qq
@ -176,16 +167,9 @@ jobs:
done done
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# FreeBSD. Built inside a FreeBSD VM booted with QEMU/KVM on the Linux runner, # FreeBSD. Compiled inside a QEMU/KVM guest, so no FreeBSD runner is needed.
# so no FreeBSD runner is needed: the tooling lives on the Linux side and only # The container must expose /dev/kvm (act_runner: options: "--device /dev/kvm"),
# the compilation happens in the guest. # otherwise QEMU falls back to TCG and the boot crawls. ~1m40s end to end.
#
# 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.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
bsd: bsd:
name: freebsd/x86_64 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 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 # Windows. Cross-compiled with mingw-w64; no Windows machine or MSVC involved.
# machine and no MSVC are involved: the result is a self-contained PE that # i686 needs a 32-bit host compiler for the native buildvm. The build stays
# imports only KERNEL32/msvcrt. build.bat remains for native MSVC builds. # hate-no-d.exe -- only the release asset name carries the toolchain.
#
# 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: windows:
name: windows/${{ matrix.arch }} name: windows/${{ matrix.arch }}
@ -255,8 +232,7 @@ jobs:
- name: Fetch submodules - name: Fetch submodules
run: git submodule update --init --recursive run: git submodule update --init --recursive
# libc6-dev is not pulled in by gcc under --no-install-recommends, and # --no-install-recommends omits libc6-dev, and minilua needs limits.h.
# without it the host build of minilua cannot find limits.h.
- name: Install toolchain - name: Install toolchain
run: | run: |
set -eu set -eu