Some checks failed
release / linux/aarch64 (pull_request) Failing after 37s
release / linux/armv7 (pull_request) Failing after 15s
release / linux/i686 (pull_request) Failing after 13s
release / linux/x86_64 (pull_request) Failing after 13s
release / android (pull_request) Successful in 1m53s
release / freebsd/x86_64 (pull_request) Failing after 47s
release / windows/i686 (pull_request) Successful in 1m4s
release / windows/x86_64 (pull_request) Successful in 3m29s
282 lines
10 KiB
YAML
282 lines
10 KiB
YAML
# Build hate-no-d for 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
|
|
#
|
|
# 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.
|
|
name: release
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
tags: ['v*']
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
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).
|
|
|
|
env:
|
|
FORGEJO_API_URL: ${{ github.server_url }}/api/v1
|
|
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
REPO: ${{ github.repository }}
|
|
TAG: ${{ github.ref_name }}
|
|
|
|
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:
|
|
name: linux/${{ matrix.arch }}
|
|
runs-on: docker
|
|
container:
|
|
image: node:20-bullseye # node + git: actions/checkout is a JS action
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x86_64
|
|
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.
|
|
- arch: i686
|
|
machine: 'Intel 80386'
|
|
make_args: 'CC="gcc -m32"'
|
|
packages: 'gcc-multilib libc6-dev-i386'
|
|
# 64-bit host -> 64-bit target, so host tools stay native.
|
|
- 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.
|
|
- 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'
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://data.forgejo.org/actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
|
|
- name: Fetch submodules
|
|
run: git submodule update --init --recursive
|
|
|
|
- name: Install toolchain
|
|
run: |
|
|
set -eu
|
|
apt-get update -qq
|
|
apt-get install -y --no-install-recommends \
|
|
make gcc libc6-dev binutils jq curl ca-certificates ${{ matrix.packages }}
|
|
|
|
- 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.
|
|
- name: Verify architecture
|
|
run: |
|
|
set -eu
|
|
readelf -h ./hate-no-d | grep -F 'Machine:' | grep -F '${{ matrix.machine }}'
|
|
echo "architecture ok: ${{ matrix.machine }}"
|
|
|
|
- name: Attach to release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
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:
|
|
name: android
|
|
runs-on: docker
|
|
container:
|
|
image: node:20-bookworm
|
|
env:
|
|
ANDROID_NDK_VERSION: r27c
|
|
ANDROID_NDK: /opt/android-ndk-r27c
|
|
ANDROID_API: '21'
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://data.forgejo.org/actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
|
|
- name: Fetch submodules
|
|
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).
|
|
run: |
|
|
set -eu
|
|
apt-get update -qq
|
|
apt-get install -y --no-install-recommends \
|
|
make gcc libc6-dev binutils jq curl ca-certificates unzip \
|
|
gcc-multilib libc6-dev-i386
|
|
|
|
- name: Install NDK r27c
|
|
run: |
|
|
set -eu
|
|
url="https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip"
|
|
curl -fsSL -o /tmp/ndk.zip "$url"
|
|
mkdir -p /opt
|
|
unzip -q /tmp/ndk.zip -d /opt
|
|
rm -f /tmp/ndk.zip
|
|
test -d "$ANDROID_NDK"
|
|
|
|
- name: Build all ABIs
|
|
run: |
|
|
set -eu
|
|
mkdir -p dist
|
|
for abi in arm64-v8a armeabi-v7a x86_64; do
|
|
make clean >/dev/null 2>&1 || true
|
|
if [ "$abi" = armeabi-v7a ]; then
|
|
make PLATFORM=Android ANDROID_NDK="$ANDROID_NDK" ANDROID_API="$ANDROID_API" \
|
|
ANDROID_ABI="$abi" HOST_CC="gcc -m32" all
|
|
else
|
|
make PLATFORM=Android ANDROID_NDK="$ANDROID_NDK" ANDROID_API="$ANDROID_API" \
|
|
ANDROID_ABI="$abi" HOST_CC=gcc all
|
|
fi
|
|
readelf -h ./hate-no-d | grep -F 'Machine:' | grep -E 'AArch64|ARM|X86-64'
|
|
cp ./hate-no-d "dist/hate-no-d-android-$abi"
|
|
done
|
|
|
|
- name: Attach to release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
set -eu
|
|
for abi in arm64-v8a armeabi-v7a x86_64; do
|
|
sh .forgejo/scripts/release-asset.sh "dist/hate-no-d-android-$abi" "hate-no-d-android-$abi"
|
|
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.
|
|
# ---------------------------------------------------------------------------
|
|
bsd:
|
|
name: freebsd/x86_64
|
|
runs-on: docker
|
|
container:
|
|
image: node:20-bookworm
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://data.forgejo.org/actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
|
|
- name: Fetch submodules
|
|
run: git submodule update --init --recursive
|
|
|
|
- name: Install QEMU
|
|
run: |
|
|
set -eu
|
|
apt-get update -qq
|
|
apt-get install -y --no-install-recommends \
|
|
qemu-system-x86 cloud-image-utils openssh-client xz-utils jq
|
|
|
|
- name: Build in FreeBSD VM
|
|
run: |
|
|
set -eu
|
|
mkdir -p dist
|
|
sh .forgejo/scripts/freebsd-build.sh dist/hate-no-d-freebsd-x86_64 .
|
|
|
|
- name: Attach to release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
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:
|
|
name: windows/${{ matrix.arch }}
|
|
runs-on: docker
|
|
container:
|
|
image: node:20-bookworm
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x86_64
|
|
tag: windows_mingw_w64-x64
|
|
host_cc: gcc
|
|
- arch: i686
|
|
tag: windows_mingw_w64-x86
|
|
host_cc: gcc -m32
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://data.forgejo.org/actions/checkout@v4
|
|
with:
|
|
submodules: false
|
|
|
|
- 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.
|
|
- name: Install toolchain
|
|
run: |
|
|
set -eu
|
|
apt-get update -qq
|
|
apt-get install -y --no-install-recommends \
|
|
make gcc libc6-dev gcc-multilib mingw-w64 jq
|
|
|
|
- name: Build
|
|
run: make PLATFORM=Windows WIN_ARCH=${{ matrix.arch }} HOST_CC="${{ matrix.host_cc }}" all
|
|
|
|
- name: Verify executable
|
|
run: |
|
|
set -eu
|
|
bin=hate-no-d.exe
|
|
file "./$bin" | grep -q 'for MS Windows'
|
|
deps=$(${{ matrix.arch }}-w64-mingw32-objdump -p "./$bin" | awk '/DLL Name/{print $3}')
|
|
echo "$deps"
|
|
bad=$(printf '%s\n' "$deps" | grep -v -E '^(KERNEL32|msvcrt)\.dll$' || true)
|
|
[ -z "$bad" ] || { echo "unexpected runtime DLL dependency: $bad" >&2; exit 1; }
|
|
|
|
- name: Attach to release
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: sh .forgejo/scripts/release-asset.sh ./hate-no-d.exe hate-no-d-${{ matrix.tag }}.exe
|