Files
questshock/.gitea/workflows/build.yml
T
ml ac640762d7
build / build (push) Successful in 2m13s
Fix Quest launch crashes, version the APK like the tarball, and support native builds in Android Studio
- patchelf gl4es's embedded SONAME to libGL.so so AGP's jniLibs packaging
  (which drops any file not literally named "*.so") and the dynamic
  linker's NEEDED-entry resolution (by embedded SONAME, not filename)
  finally agree - fixes the "library \"libGL.so.1\" not found" crash seen
  on real Quest hardware.
- QuestShockActivity now checks that res/data and res/sound exist before
  starting the native engine, showing an explanatory dialog instead of
  crashing on init_popups' unchecked NULL resource load when a fresh
  install has no game data copied in yet.
- dist/questshock-<version>-android-arm64.apk is now versioned from the
  same git-tag-or-dev-placeholder scheme as the desktop tarball
  (build-image/version.sh, shared by both via the Makefile and
  build-apk.sh).
- build-image/prepare-android-project.sh (prep logic extracted out of
  build-apk.sh) can now stage android/ for a native build directly in
  Android Studio (--host-paths), exporting the prebuilt SDL2/SDL2_mixer/
  fluidsynth-lite/gl4es libraries and writing host-resolvable paths,
  instead of only ever building inside the Docker image.
- Corrected GET_ASSETS.txt/GET_ASSETS_QUEST.txt, which wrongly described
  merging res/pc/hd and res/pc/cdrom trees out of the raw installer's
  sshock.kpf - an already-installed copy's res/data res/sound can just
  be copied directly, with extract_assets.sh only needed from the raw
  installer.
2026-07-23 06:42:45 +02:00

95 lines
4.0 KiB
YAML

name: build
# Builds a versioned Linux release tarball (see `make package`) on every
# push/PR, plus on-demand via the Gitea "Run workflow" button. Runs
# inside the build-image (see ../../build-image/Dockerfile, built/pushed
# via ../../build-image.sh and ../../upload-image.sh), which bundles
# every dependency engine/ needs to compile - no network access needed
# at job runtime. Since the job's container already *is* the build-image
# (QUESTSHOCK_BUILD_IMAGE=1), `make package`'s `engine` prerequisite
# compiles directly instead of trying to docker-run it again, which
# wouldn't work here (no nested docker).
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
# Runner defaults `run:` steps to `sh`, which doesn't understand
# `set -o pipefail` used below - force bash explicitly.
defaults:
run:
shell: bash
# Must match a label your act_runner is registered with.
runs-on: ubuntu-latest
container:
image: cr.ladkau.de/questshock/builder:latest
credentials:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- uses: actions/checkout@v4
with:
# `make package`'s version comes from `git describe --tags` -
# needs full history/tags, not actions/checkout's default
# shallow single-commit clone.
fetch-depth: 0
- name: Preflight
run: |
set -euo pipefail
command -v cc >/dev/null 2>&1 || { echo "PREFLIGHT FAIL: no C compiler (cc) in PATH" >&2; exit 1; }
command -v cmake >/dev/null 2>&1 || { echo "PREFLIGHT FAIL: cmake not in PATH" >&2; exit 1; }
[ -n "${QUESTSHOCK_BUILD_IMAGE:-}" ] || { echo "PREFLIGHT FAIL: QUESTSHOCK_BUILD_IMAGE not set - not running inside the questshock build-image?" >&2; exit 1; }
[ -d /opt/prebuilt/built_sdl ] || { echo "PREFLIGHT FAIL: /opt/prebuilt/built_sdl missing" >&2; exit 1; }
[ -d /opt/prebuilt/android/gl4es ] || { echo "PREFLIGHT FAIL: /opt/prebuilt/android/gl4es missing - runner is using a build-image older than the Android/Quest layer" >&2; exit 1; }
- name: Build package
run: make package
- name: Upload build artifact
# v4 uses the newer @actions/artifact backend, which this Gitea
# instance's artifact storage doesn't support (GHESNotSupportedError) - v3 works.
uses: actions/upload-artifact@v3
with:
name: shockolate
path: dist/shockolate-*-linux-*.tar.gz
- name: Build Quest APK
# QUESTSHOCK_BUILD_IMAGE is already set (see Preflight above), so
# this runs build-apk.sh directly instead of trying to docker-run
# the image again - same reasoning as `make package` above.
# Unlike the fully offline engine/package build, this needs
# network access for Gradle/AGP's own dependency resolution - a
# scoped, accepted exception (see build-image/Dockerfile).
run: make apk
- name: Upload APK artifact
uses: actions/upload-artifact@v3
with:
name: questshock-quest-apk
path: dist/questshock-*-android-*.apk
- name: Publish to dl.ladkau.de
# Uploads the tarball and APK over SFTP instead of using
# actions/upload-artifact (whose zip wrapping can't be disabled).
# Only runs on push so PR builds don't publish.
if: gitea.event_name == 'push'
run: |
set -euo pipefail
TARBALL="$(ls dist/shockolate-*-linux-*.tar.gz)"
APK="$(ls dist/questshock-*-android-*.apk)"
mkdir -p ~/.ssh
echo "${{ secrets.DL_SFTP_KEY }}" > ~/.ssh/dl_sftp_key
chmod 600 ~/.ssh/dl_sftp_key
sftp -i ~/.ssh/dl_sftp_key -P 2223 \
-o StrictHostKeyChecking=accept-new \
uploader@dl.ladkau.de <<EOF
-mkdir files/questshock
put $TARBALL files/questshock/$(basename "$TARBALL")
put $APK files/questshock/$(basename "$APK")
EOF