# Build every supported target and attach the binaries to a Forgejo release. # # push / pull_request -> build only # tag 'v*' -> build + release assets # # Assets: one archive per target, named hate-no-d--.tar.gz (zip on # Windows), each unpacking to a directory of the same name holding the binary # plus LICENSE and README.md. Release attachments are a flat list with no # folders, so the archive is what groups a target's files together. # macOS/iOS live in apple.yml; everything here builds on the Linux runner. name: release on: push: branches: [master] tags: ['v*'] pull_request: workflow_dispatch: concurrency: group: release-${{ github.ref }} cancel-in-progress: true # 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 FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} TAG: ${{ github.ref_name }} jobs: # --------------------------------------------------------------------------- # 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-bookworm # 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: 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"' 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 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 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 with: submodules: false - name: Fetch submodules run: git submodule update --init --recursive - 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 }} - name: Build run: make ${{ matrix.make_args }} all lib # A mis-set CC silently yields a host binary, so check the ELF machine. - name: Verify architecture run: | set -eu readelf -h ./hate-no-d | grep -F 'Machine:' | grep -F '${{ matrix.machine }}' echo "architecture ok: ${{ matrix.machine }}" - name: Package run: sh .forgejo/scripts/make-archive.sh "hate-no-d-linux-${{ matrix.arch }}" tar.gz ./hate-no-d ./libhate-no-d.a - name: Attach to release if: startsWith(github.ref, 'refs/tags/') run: sh .forgejo/scripts/release-asset.sh "./hate-no-d-linux-${{ matrix.arch }}.tar.gz" # --------------------------------------------------------------------------- # 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 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: armeabi-v7a needs 32-bit host tools. 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 lib else make PLATFORM=Android ANDROID_NDK="$ANDROID_NDK" ANDROID_API="$ANDROID_API" \ ANDROID_ABI="$abi" HOST_CC=gcc all lib fi readelf -h ./hate-no-d | grep -F 'Machine:' | grep -E 'AArch64|ARM|X86-64' mkdir -p "dist/$abi" cp ./hate-no-d "dist/$abi/hate-no-d" cp ./libhate-no-d.a "dist/$abi/libhate-no-d.a" done - name: Package run: | set -eu for abi in arm64-v8a armeabi-v7a x86_64; do sh .forgejo/scripts/make-archive.sh "hate-no-d-android-$abi" tar.gz \ "dist/$abi/hate-no-d" "dist/$abi/libhate-no-d.a" 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 "hate-no-d-android-$abi.tar.gz" done # --------------------------------------------------------------------------- # 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 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 . - name: Package run: | sh .forgejo/scripts/make-archive.sh hate-no-d-freebsd-x86_64 tar.gz \ dist/hate-no-d dist/libhate-no-d.a - name: Attach to release if: startsWith(github.ref, 'refs/tags/') run: sh .forgejo/scripts/release-asset.sh ./hate-no-d-freebsd-x86_64.tar.gz # --------------------------------------------------------------------------- # Windows. Cross-compiled with mingw-w64; no Windows machine or MSVC involved. # i686 needs a 32-bit host compiler for the native buildvm. The asset is a zip # (Windows convention) holding hate-no-d.exe; the toolchain is not part of the # name because it is not a compatibility axis for anyone downloading it. # --------------------------------------------------------------------------- windows: name: windows/${{ matrix.arch }} runs-on: docker container: image: node:20-bookworm strategy: fail-fast: false matrix: include: - arch: x86_64 host_cc: gcc - arch: i686 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 # --no-install-recommends omits libc6-dev, and minilua needs limits.h. # zip: the release asset is a .zip, matching the Windows convention. - 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 zip - name: Build run: make PLATFORM=Windows WIN_ARCH=${{ matrix.arch }} HOST_CC="${{ matrix.host_cc }}" all lib - 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: Package run: | sh .forgejo/scripts/make-archive.sh "hate-no-d-windows-${{ matrix.arch }}" zip \ ./hate-no-d.exe ./libhate-no-d.a - name: Attach to release if: startsWith(github.ref, 'refs/tags/') run: sh .forgejo/scripts/release-asset.sh "./hate-no-d-windows-${{ matrix.arch }}.zip"