# CI for the packager itself: build the Docker image and smoke-test that it # produces a non-empty patch-Z.mpq from the test fixture. name: CI on: push: branches: [main] pull_request: jobs: build-and-smoke: runs-on: ubuntu-latest steps: # octowow.st is served under /git, but Gitea generates clone URLs without # it (ROOT_URL/proxy misconfig), so actions/checkout 404s. Clone manually # against the correct base. Remove once the server ROOT_URL is fixed. - name: Checkout run: | git init -q . git remote add origin "https://gitea:${{ secrets.GITHUB_TOKEN }}@octowow.st/git/${{ github.repository }}.git" git fetch -q --depth 1 origin "${{ github.ref }}" git checkout -q FETCH_HEAD - name: Build image run: docker build -t mpq-packager:ci . # NOTE: act_runner runs these `docker` commands against the HOST daemon via # the mounted socket, so bind-mounting the job's files (-v "$PWD:/work") # doesn't work — the source path isn't on the host. Use `docker cp` to # stream files in/out of a created container instead. The GlueXML release # workflow uses this same pattern. - name: Package the fixture run: | set -euo pipefail cid=$(docker create \ -e INPUT_MANIFEST=mpq.yaml \ -e INPUT_VERSION=v0.0.0-ci \ -e INPUT_OUT_DIR=/work/dist \ -e GITHUB_WORKSPACE=/work \ mpq-packager:ci) docker cp test/. "$cid:/work" docker start -a "$cid" docker cp "$cid:/work/dist/patch-Z.mpq" ./patch-Z.mpq docker rm "$cid" >/dev/null - name: Assert archive is valid and contains the expected file run: | set -euo pipefail test -s patch-Z.mpq echo "size: $(stat -c%s patch-Z.mpq) bytes" # Read the archive back with StormLib (mpqpack --list/--cat) inside a # sleeping container we exec into. cid=$(docker run -d --entrypoint sleep mpq-packager:ci 120) docker cp patch-Z.mpq "$cid:/patch-Z.mpq" docker exec "$cid" mpqpack --list /patch-Z.mpq | tee list.txt grep -q 'Interface\\AddOns\\Fixture\\Hello.lua' list.txt docker exec "$cid" mpqpack --cat /patch-Z.mpq 'Interface\AddOns\Fixture\Hello.lua' \ | grep -q 'VERSION = "v0.0.0-ci"' docker rm -f "$cid" >/dev/null echo "OK: archive valid, path + substitution confirmed"