Files
drover-go/.gitea/workflows/build.yml
T
root 9bdbcd4d88
Build / test (push) Successful in 1m13s
Build / build-windows (push) Successful in 56s
Release / release (push) Successful in 3m15s
workflows: disable docker-clean so apt cache survives between runs
Debian-based Docker images install /etc/apt/apt.conf.d/docker-clean
which runs 'apt-get clean' after every apt-get install — wipes out
/var/cache/apt/archives so there's nothing for actions/cache to save.

Fix: remove the docker-clean drop-in and add keep-cache config first
thing in each job, before any apt activity. Also bump apt cache key
to v2 since the previous v1 was always empty.

Wait time on the Wine + Inno Setup step should drop from ~1m20s to
~10s on warm runs (debs already in /var/cache/apt/archives, dpkg
just installs them locally).

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

116 lines
3.6 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
# Node.js is installed at the start of every job so actions/cache@v4
# (which uses Node) can run. Installing Node costs ~10s; the resulting
# Go module + apt cache restore typically saves 30-60s on warm runs.
jobs:
test:
runs-on: go
steps:
- name: Disable apt auto-clean (preserve cache for actions/cache)
run: |
rm -f /etc/apt/apt.conf.d/docker-clean
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
- name: Install Node (required by actions/cache)
run: |
apt-get update >/dev/null
apt-get install -y --no-install-recommends nodejs >/dev/null
- name: Checkout
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: go-${{ runner.os }}-
- 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: Disable apt auto-clean (preserve cache for actions/cache)
run: |
rm -f /etc/apt/apt.conf.d/docker-clean
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
- name: Install Node (required by actions/cache)
run: |
apt-get update >/dev/null
apt-get install -y --no-install-recommends nodejs >/dev/null
- name: Checkout
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
restore-keys: go-${{ runner.os }}-
- 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
# -H=windowsgui = subsystem WINDOWS, double-click no longer
# flashes a console window. main.go calls AttachConsole on
# startup so CLI invocations from cmd/PowerShell still print
# to the parent terminal.
go build -trimpath -ldflags="-s -w -H=windowsgui \
-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