Files
drover-go/.gitea/workflows/build.yml
T
root 8c70640bfd
Build / test (push) Failing after 1s
Build / build-windows (push) Has been skipped
workflows: clone without auth (public repo, no basic-auth needed)
Both 'forgejo-runner:$TOKEN' and 'x-access-token:$TOKEN' formulas
are rejected by Gitea's act_runner with HTTP 401:
  remote: Failed to authenticate user
  fatal: Authentication failed

For public repos the simplest fix is: don't send credentials at all.
Plain https://host/owner/repo.git clones unauthenticated and Gitea
serves it (root/drover-go is public).

If/when we move to private repos this'll need a different approach
(GITEA_TOKEN env, oauth2 username, or .netrc) — but that's a future
problem.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 02:38:25 +03:00

78 lines
2.5 KiB
YAML

name: Build
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- 'README.md'
- 'LICENSE'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
# We deliberately avoid actions/cache@v4 and actions/upload-artifact@v4 in this
# workflow. They are Node.js-based and the runner image (golang:*) has no Node.
# Installing Node would add ~10s per job for every run; for now we accept
# that go module downloads happen on each invocation (~20-30s once warm).
# Real release artifacts are produced by release.yml via curl + Forgejo API.
jobs:
test:
runs-on: go
steps:
- name: Checkout
run: |
# Public repo — clone without auth. Both Gitea and Forgejo
# rejected hardcoded "forgejo-runner"/"x-access-token" basic-auth
# formulas; for an unauthenticated read on public repos plain
# https works on every server.
git clone --no-checkout "https://git.okcu.io/${GITHUB_REPOSITORY}.git" /tmp/src
git -C /tmp/src checkout "$GITHUB_SHA"
cp -a /tmp/src/. .
- name: Vet
run: go vet ./...
- name: Test with race
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Linux smoke build
run: |
mkdir -p bin
go build -trimpath -ldflags="-s -w" -o bin/drover ./cmd/drover
./bin/drover --version
build-windows:
runs-on: go
needs: test
steps:
- name: Checkout
run: |
# Public repo — clone without auth. Both Gitea and Forgejo
# rejected hardcoded "forgejo-runner"/"x-access-token" basic-auth
# formulas; for an unauthenticated read on public repos plain
# https works on every server.
git clone --no-checkout "https://git.okcu.io/${GITHUB_REPOSITORY}.git" /tmp/src
git -C /tmp/src checkout "$GITHUB_SHA"
cp -a /tmp/src/. .
- name: Cross-compile drover.exe (windows/amd64)
env:
GOOS: windows
GOARCH: amd64
CGO_ENABLED: '0'
run: |
SHORT_SHA="${GITHUB_SHA:0:7}"
BUILD_DATE="$(date -u +%Y-%m-%d)"
mkdir -p bin
go build -trimpath -ldflags="-s -w \
-X main.Version=dev-${SHORT_SHA} \
-X main.Commit=${SHORT_SHA} \
-X main.BuildDate=${BUILD_DATE}" \
-o bin/drover.exe ./cmd/drover
ls -la bin/
sha256sum bin/drover.exe