xfy 39ff086236
Some checks failed
CI / Test (push) Failing after 24s
CI / Build (push) Has been skipped
ci: consolidate all steps into single step per job
GITHUB_PATH does not reliably update PATH for subsequent steps in
Gitea Actions. Put Go install + all checks in one step with explicit
PATH export. Simplify to 2 jobs: test + build.
2026-06-12 17:00:09 +08:00

69 lines
1.7 KiB
YAML

name: CI
on:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Go and run checks
run: |
export PATH="/usr/local/go/bin:$(go env GOPATH 2>/dev/null || echo /root/go)/bin:$PATH"
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
if ! command -v go &>/dev/null; then
curl -sL "https://mirrors.aliyun.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
fi
export GOPROXY=https://goproxy.cn,direct
echo "=== Go Version ==="
go version
echo "=== Check Formatting ==="
go install mvdan.cc/gofumpt@latest
output=$(gofumpt -l .)
if [ -n "$output" ]; then
echo "Files need formatting:"
echo "$output"
exit 1
fi
echo "Formatting OK"
echo "=== Go Vet ==="
go vet ./...
echo "Vet OK"
echo "=== Unit Tests ==="
go test -race -count=1 ./internal/...
build:
name: Build
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go and build
run: |
export PATH="/usr/local/go/bin:$PATH"
GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
if ! command -v go &>/dev/null; then
curl -sL "https://mirrors.aliyun.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xzf -
fi
export GOPROXY=https://goproxy.cn,direct
make build
./bin/lolly --help