d9c8da139c
The v2.1.6 release binary is built with Go 1.24, and golangci-lint
refuses to load a config targeting a newer toolchain than itself
('Go language version (go1.24) used to build golangci-lint is lower
than the targeted Go version (1.25.0)'). go.mod is on 1.25, so the
binary needs to be too.
Locally this didn't bite because 'go install …@v2.1.6' compiled
v2.1.6 against the local Go 1.25 toolchain; CI uses the prebuilt
release tarball which carries the build-time Go version.
v2.5.0 is the first v2.x line built with Go 1.25 — pin in lockstep
with go.mod going forward.
85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
env:
|
|
# Floor is set by the heaviest dep (modernc.org/sqlite v1.50+).
|
|
GO_VERSION: "1.25"
|
|
|
|
jobs:
|
|
test:
|
|
name: Test (linux/amd64)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
cache: true
|
|
- name: go vet
|
|
run: go vet ./...
|
|
- name: go test
|
|
run: go test -race -coverprofile=coverage.out ./...
|
|
- name: coverage summary
|
|
run: go tool cover -func=coverage.out | tail -1
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
cache: true
|
|
- uses: golangci/golangci-lint-action@v7
|
|
with:
|
|
# Must be built against the same Go release as go.mod targets,
|
|
# otherwise the linter refuses to load with "Go language
|
|
# version used to build golangci-lint is lower than the
|
|
# targeted Go version". v2.5.0 is the first v2.x line built
|
|
# with Go 1.25; bump in lockstep with go.mod.
|
|
version: v2.5.0
|
|
args: --timeout=5m
|
|
|
|
build:
|
|
name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- goos: linux
|
|
goarch: amd64
|
|
- goos: linux
|
|
goarch: arm64
|
|
- goos: windows
|
|
goarch: amd64
|
|
ext: ".exe"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
cache: true
|
|
- name: build server + agent
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
CGO_ENABLED: "0"
|
|
run: |
|
|
mkdir -p bin
|
|
go build -trimpath -ldflags="-s -w" \
|
|
-o bin/restic-manager-server-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }} \
|
|
./cmd/server
|
|
go build -trimpath -ldflags="-s -w" \
|
|
-o bin/restic-manager-agent-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }} \
|
|
./cmd/agent
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: bin/*
|
|
retention-days: 7
|