956356ff2b
The runner image (golang:*) ships without Node.js, and actions/cache@v4 plus actions/upload-artifact@v4 transitively need it for hashFiles + artifact upload. Verified by CI failure on first push (run #1, task 710): "OCI runtime exec failed ... 'node': executable file not found in $PATH". For now we accept ~20-30s of go module download per run (small project, fine). Real release artifacts go via release.yml (next task) which will use curl + Forgejo REST API to upload — pure bash, no Node needed. Drop the smoke-build artifact upload too — it was only for inspection during dev. Add `./bin/drover --version` to the linux smoke build so we get exit-code verification that the CLI bootstraps correctly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
2.1 KiB
YAML
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://forgejo-runner:${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://forgejo-runner:${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
|