add_workflow #1

Merged
pedro-bento merged 4 commits from add_workflow into master 2026-10-21 22:09:01 +01:00
3 changed files with 121 additions and 75 deletions
Showing only changes of commit 0954f5cbfc - Show all commits

View file

@ -0,0 +1,96 @@
# 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.
name: apple
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag to attach artifacts to (empty = build only)'
required: false
default: ''
env:
FORGEJO_API_URL: ${{ github.server_url }}/api/v1
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG: ${{ github.event.inputs.tag }}
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:
name: macos/${{ matrix.arch }}
runs-on: macos
strategy:
fail-fast: false
matrix:
arch: [arm64, x86_64]
steps:
- name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4
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.
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Build
run: |
make \
CFLAGS="-O2 -Wall -arch ${{ matrix.arch }}" \
LUAJIT_EXTRA="TARGET_FLAGS=-arch ${{ matrix.arch }}" \
all
- name: Verify architecture
run: |
set -eu
file ./hate-no-d
file ./hate-no-d | grep -q '${{ matrix.arch }}'
- name: Attach to release
if: github.event.inputs.tag != ''
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:
name: ios/arm64
runs-on: macos
steps:
- name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4
with:
submodules: false
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Build libluajit.a
run: make PLATFORM=iOS IOS_ARCH=arm64 all
- name: Verify archive
run: |
set -eu
lipo -info submodules/luajit/src/libluajit.a
lipo -info submodules/luajit/src/libluajit.a | grep -q arm64
- name: Attach to release
if: github.event.inputs.tag != ''
run: sh .forgejo/scripts/release-asset.sh submodules/luajit/src/libluajit.a hate-no-d-ios-arm64-luajit.a

View file

@ -6,15 +6,15 @@
# #
# Release assets are uploaded straight to the REST API, one file per platform: # 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-linux-{x86_64,i686,aarch64,armv7}
# hate-no-d-macos-{arm64,x86_64}
# hate-no-d-android-{arm64-v8a,armeabi-v7a,x86_64} # hate-no-d-android-{arm64-v8a,armeabi-v7a,x86_64}
# hate-no-d-windows_mingw_w64-{x64,x86}.exe # hate-no-d-windows_mingw_w64-{x64,x86}.exe
# hate-no-d-ios-arm64-luajit.a
# hate-no-d-freebsd-x86_64 # hate-no-d-freebsd-x86_64
# #
# Only Apple's targets need more than the Linux runner, and they are gated # apple.yml adds hate-no-d-macos-{arm64,x86_64} and hate-no-d-ios-arm64-luajit.a
# behind a repository variable set to "true" (needs a matching runner): # when it is dispatched against a Mac runner.
# ENABLE_MACOS (macOS runner, label: macos) -> macos + ios jobs #
# 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:
@ -80,7 +80,10 @@ jobs:
- name: Checkout - name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4 uses: https://data.forgejo.org/actions/checkout@v4
with: with:
submodules: recursive submodules: false
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Install toolchain - name: Install toolchain
run: | run: |
@ -122,7 +125,10 @@ jobs:
- name: Checkout - name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4 uses: https://data.forgejo.org/actions/checkout@v4
with: with:
submodules: recursive submodules: false
- name: Fetch submodules
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 is needed for the 32-bit host tools LuaJIT requires when
@ -169,68 +175,6 @@ jobs:
sh .forgejo/scripts/release-asset.sh "dist/hate-no-d-android-$abi" "hate-no-d-android-$abi" sh .forgejo/scripts/release-asset.sh "dist/hate-no-d-android-$abi" "hate-no-d-android-$abi"
done done
# ---------------------------------------------------------------------------
# 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:
name: macos/${{ matrix.arch }}
if: vars.ENABLE_MACOS == 'true'
runs-on: macos
strategy:
fail-fast: false
matrix:
arch: [arm64, x86_64]
steps:
- name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
make \
CFLAGS="-O2 -Wall -arch ${{ matrix.arch }}" \
LUAJIT_EXTRA="TARGET_FLAGS=-arch ${{ matrix.arch }}" \
all
- name: Verify architecture
run: |
set -eu
file ./hate-no-d
file ./hate-no-d | grep -q '${{ matrix.arch }}'
- name: Attach to release
if: startsWith(github.ref, 'refs/tags/')
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:
name: ios/arm64
if: vars.ENABLE_MACOS == 'true'
runs-on: macos
steps:
- name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4
with:
submodules: recursive
- name: Build libluajit.a
run: make PLATFORM=iOS IOS_ARCH=arm64 all
- name: Verify archive
run: |
set -eu
lipo -info submodules/luajit/src/libluajit.a
lipo -info submodules/luajit/src/libluajit.a | grep -q arm64
- name: Attach to release
if: startsWith(github.ref, 'refs/tags/')
run: sh .forgejo/scripts/release-asset.sh submodules/luajit/src/libluajit.a hate-no-d-ios-arm64-luajit.a
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# FreeBSD. Built inside a FreeBSD VM booted with QEMU/KVM on the Linux runner, # 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 # so no FreeBSD runner is needed: the tooling lives on the Linux side and only
@ -253,7 +197,10 @@ jobs:
- name: Checkout - name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4 uses: https://data.forgejo.org/actions/checkout@v4
with: with:
submodules: recursive submodules: false
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Install QEMU - name: Install QEMU
run: | run: |
@ -303,7 +250,10 @@ jobs:
- name: Checkout - name: Checkout
uses: https://data.forgejo.org/actions/checkout@v4 uses: https://data.forgejo.org/actions/checkout@v4
with: with:
submodules: recursive submodules: false
- name: Fetch submodules
run: git submodule update --init --recursive
# libc6-dev is not pulled in by gcc under --no-install-recommends, and # libc6-dev is not pulled in by gcc under --no-install-recommends, and
# without it the host build of minilua cannot find limits.h. # without it the host build of minilua cannot find limits.h.

View file

@ -4,14 +4,14 @@ A [Love2D](https://www.love2d.org/) antagonist.
## Quick Start ## Quick Start
### On Linux, macOS, BSD or POSIX ### On Linux, macOS, BSD, POSIX or Windows-MinGW
```sh ```sh
echo -e 'print("Hey! I am hate-no-d!")' > quick-start.lua echo -e 'print("Hey! I am hate-no-d!")' > quick-start.lua
./hate-no-d quick-start.lua ./hate-no-d quick-start.lua
``` ```
### On Windows ### On Windows MSVC
```bat ```bat
echo print("Hey! I am hate-no-d!") > quick-start.lua echo print("Hey! I am hate-no-d!") > quick-start.lua
@ -20,7 +20,7 @@ hate-no-d.exe quick-start.lua
## Build ## Build
### On Linux, macOS, BSD or POSIX ### On Linux, macOS, BSD, POSIX or Windows-MinGW
```sh ```sh
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
@ -28,7 +28,7 @@ cd hate-no-d
make make
``` ```
### On Windows ### On Windows MSVC
```bat ```bat
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git