xfy c2fe40330b
Some checks failed
CI / Lint (push) Failing after 39s
CI / Test (push) Failing after 9m23s
CI / Build (push) Has been skipped
ci: add debug info to vet step
2026-06-12 16:51:08 +08:00

81 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
- 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: |
which go
go version
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