From 385c46ef39176c6617803d3504b26e94c015c321 Mon Sep 17 00:00:00 2001 From: "Cameron Armstrong (Nightfox)" Date: Mon, 24 Aug 2026 03:14:08 +0800 Subject: [PATCH] Add Amiga workflow --- .github/workflows/amiga.yml | 58 +++++++++++++++++++++++++++++++++++++ package-amiga.sh | 9 ++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/amiga.yml diff --git a/.github/workflows/amiga.yml b/.github/workflows/amiga.yml new file mode 100644 index 0000000..70f82d0 --- /dev/null +++ b/.github/workflows/amiga.yml @@ -0,0 +1,58 @@ +name: amiga + +on: [push, pull_request, workflow_dispatch] + +concurrency: + group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + package: + runs-on: ubuntu-latest + timeout-minutes: 120 + steps: + - uses: actions/checkout@v4 + + # Ubuntu's `lha` package is lhasa: extract-only, cannot create archives. + # Build LHa for UNIX (https://github.com/jca02266/lha) instead. + - name: Install LHa for UNIX + working-directory: ${{runner.temp}} + run: | + sudo apt-get update + sudo apt-get install -y autoconf automake + curl -fsSL -o lha.tar.gz \ + https://github.com/jca02266/lha/archive/16619b066b189ef289bb8b07b37d1c38d550da99.tar.gz + tar -xzf lha.tar.gz + cd lha-16619b066b189ef289bb8b07b37d1c38d550da99 + autoreconf -is + ./configure --prefix="$HOME/.local" + make -j"$(nproc)" + make install + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: Check lha can create archives + run: | + command -v lha + d=$(mktemp -d) + echo probe > "$d/f" + ( cd "$d" && lha -aq2 t.lha f ) + test -s "$d/t.lha" + + - name: Pull compiler images + run: | + docker pull sacredbanana/amiga-compiler:m68k-amigaos & + docker pull sacredbanana/amiga-compiler:ppc-amigaos & + docker pull sacredbanana/amiga-compiler:ppc-morphos & + wait + + - name: Build and package + run: ./package-amiga.sh + + - uses: actions/upload-artifact@v4 + with: + name: json-c.lha + path: dist/json-c.lha + if-no-files-found: error diff --git a/package-amiga.sh b/package-amiga.sh index f99300e..2456c4c 100755 --- a/package-amiga.sh +++ b/package-amiga.sh @@ -18,6 +18,15 @@ STAGE=$DIST/stage OSES=("$@"); [[ ${#OSES[@]} -eq 0 ]] && OSES=(AmigaOS3 AmigaOS4 MorphOS) command -v lha >/dev/null || { echo "error: lha not found on PATH" >&2; exit 1; } +# Ubuntu's `lha` package is lhasa, which can only extract. +_lha_probe=$(mktemp -d) +echo x > "$_lha_probe/f" +if ! ( cd "$_lha_probe" && lha -aq2 t.lha f >/dev/null 2>&1 && [[ -s t.lha ]] ); then + echo "error: lha cannot create archives (is it lhasa?). Install LHa for UNIX: https://github.com/jca02266/lha" >&2 + rm -rf "$_lha_probe" + exit 1 +fi +rm -rf "$_lha_probe" # Build straight into the staging tree by pointing AMIGA_SDK at it: the build # script's SDK layout ($SDK/) is the same shape we want per OS, so each