magpie/.forgejo/workflows/ci.yml
Maxfield Luke 9cd56a7770
All checks were successful
CI / Test and build (push) Successful in 2m3s
ci: fix host-mode docker go invocation
2026-07-29 05:00:11 -04:00

32 lines
919 B
YAML

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: magpie-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test and build
runs-on: ubuntu-latest
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- name: Go test and build
run: |
set -euo pipefail
case "$GITHUB_WORKSPACE" in
/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 \
-v "${HOST_WS}:/src" -w /src -e CGO_ENABLED=0 \
golang:1.25-bookworm \
sh -c "go version && go test ./... && make build && ls -la dist/"