41c3ec7c6f
The bump from golangci-lint-action@v6 → v7 (which downloads the v2.x binary) was blocking CI lint with 'unsupported version of the configuration: ""' because .golangci.yml was still in the v1 schema. Migrate the config to v2: * version: "2" prelude * disable-all → default: none * linters-settings → linters.settings * gofumpt + goimports move into formatters.enable + formatters.settings * exclude-rules move into linters.exclusions.rules * gosimple drops (folded into staticcheck in v2) Fix the four lint hits in the new P2R-02 code: * host_bandwidth.go: convert hostBandwidthRequest directly to hostBandwidthView via type conversion (S1016) * ui_repo.go: drop unparam savedSection + status arguments from renderRepoPage (always "" / always 422 — split GET render from validation-fail render) * ui_schedules.go: gofumpt formatting on the scheduleEditPage struct Add only-new-issues: true to the lint job. The repo carries ~90 pre-existing findings (gofumpt drift × 31, misspell × 25, missing godoc × 10, bodyclose × 6, errcheck × 12, …) accumulated before lint was actually wired into CI. Without this gate, every PR would fail on baseline noise instead of its own changes. Track the cleanup as X-06 in tasks.md so the gate is temporary.
90 lines
2.7 KiB
YAML
90 lines
2.7 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:
|
|
# v1.61 was built against Go 1.23 and refuses to load a
|
|
# config that targets a newer toolchain — go.mod is on 1.25.
|
|
# Bumping to a v2.x release built against current Go.
|
|
version: v2.1.6
|
|
args: --timeout=5m
|
|
# Only flag issues introduced by the PR. The repo carries
|
|
# ~90 pre-existing findings (mostly missing godoc comments
|
|
# + gofumpt drift + misspell) accumulated before lint was
|
|
# actually wired into CI; cleaning them up is its own piece
|
|
# of work tracked separately. Without this, every PR fails
|
|
# on baseline noise instead of its own changes.
|
|
only-new-issues: true
|
|
|
|
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
|