xfy ff602ee183
Some checks failed
CI / Lint (push) Failing after 40s
CI / Test (push) Failing after 3m57s
CI / Build (push) Has been skipped
CI / Docker (push) Has been skipped
ci: install gofumpt and golangci-lint in same step to fix PATH
Previous attempts failed because go install puts binaries in GOPATH/bin
which may not be in PATH for subsequent steps. Combine into fewer steps.
2026-06-12 15:29:32 +08:00

86 lines
1.6 KiB
YAML

name: CI
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Check formatting
run: |
go install mvdan.cc/gofumpt@latest
output=$(gofumpt -l .)
if [ -n "$output" ]; then
echo "Files need formatting:"
echo "$output"
exit 1
fi
- name: Run lint
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
golangci-lint run ./...
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run unit tests
run: go test -race -count=1 ./internal/...
build:
name: Build
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build
run: make build
- name: Verify binary
run: ./bin/lolly --help
docker:
name: Docker
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: docker build -t lolly:latest .