ci: fix host-mode docker go invocation
All checks were successful
CI / Test and build (push) Successful in 2m3s

This commit is contained in:
Maxfield Luke 2026-07-29 05:00:11 -04:00
parent 10b311410e
commit 9cd56a7770
2 changed files with 14 additions and 30 deletions

View file

@ -1,4 +1,3 @@
# Host-mode runner: no local Go — use official golang image + docker.sock.
name: CI
on:
@ -22,19 +21,12 @@ jobs:
run: |
set -euo pipefail
case "$GITHUB_WORKSPACE" in
/data/*) HOST_WORKSPACE="/opt/forgejo-runner/data${GITHUB_WORKSPACE#/data}" ;;
*) HOST_WORKSPACE="$GITHUB_WORKSPACE" ;;
/data/*) HOST_WS="/opt/forgejo-runner/data${GITHUB_WORKSPACE#/data}" ;;
*) HOST_WS="$GITHUB_WORKSPACE" ;;
esac
test -f "$GITHUB_WORKSPACE/go.mod"
# Single -c string so host-mode act does not split the docker command.
docker run --rm --network host \
--volume "$HOST_WORKSPACE:/src" \
--workdir /src \
-e CGO_ENABLED=0 \
-v "${HOST_WS}:/src" -w /src -e CGO_ENABLED=0 \
golang:1.25-bookworm \
bash -lc '
set -euo pipefail
go version
go test ./...
make build
ls -la dist/
'
sh -c "go version && go test ./... && make build && ls -la dist/"