Files
drover-go/.gitea/workflows/build.yml
T
root 076cae6064
Build / test (push) Failing after 1s
Build / build-windows (push) Has been skipped
workflows: use x-access-token for git clone (Gitea-compatible)
The hardcoded "forgejo-runner" username worked on Forgejo because its
runner accepted any user when the password is a valid GITHUB_TOKEN.
Gitea's act_runner v0.6+ rejects unknown usernames with:
  remote: Failed to authenticate user
  fatal: Authentication failed for 'https://git.okcu.io/.../...'

x-access-token is the canonical "the password IS the token" username
on GitHub Actions and works equally on Gitea, Forgejo and gitea.com.

Run that surfaced the issue: gitea run #1, task 1, sha 0f63f15,
"Cloning into '/tmp/src'... remote: Failed to authenticate user".

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

70 lines
2.1 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: |
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@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: |
git clone --no-checkout "https://x-access-token:${GITHUB_TOKEN}@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