xfy 8953c0c85a
Some checks failed
CI / Lint (push) Failing after 1m30s
CI / Test (push) Failing after 2m22s
CI / Build (push) Has been skipped
ci: replace golangci-lint with go vet
golangci-lint v2 install via 'go install' is too heavy for CI
(compiles from source, needs lots of memory and time).
Use go vet as lightweight alternative for now.
2026-06-12 16:33:56 +08:00

79 lines
1.8 KiB
YAML

name: CI
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
permissions:
contents: read
env:
GO_MIRROR: https://mirrors.aliyun.com/golang
GOPROXY: https://goproxy.cn,direct
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
run: |
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
curl -sL "${GO_MIRROR}/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
echo "/usr/local/go/bin" >> $GITHUB_PATH
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- 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 vet
run: go vet ./...
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go
run: |
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
curl -sL "${GO_MIRROR}/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
echo "/usr/local/go/bin" >> $GITHUB_PATH
- 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
- name: Install Go
run: |
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
curl -sL "${GO_MIRROR}/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
echo "/usr/local/go/bin" >> $GITHUB_PATH
- name: Build
run: make build
- name: Verify binary
run: ./bin/lolly --help