39 lines
782 B
YAML
39 lines
782 B
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
name: build / vet / test / race / fmt
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
cache: true
|
|
|
|
- name: gofmt 门禁(未格式化即失败)
|
|
run: |
|
|
unformatted=$(gofmt -l cmd/ internal/)
|
|
if [ -n "$unformatted" ]; then
|
|
echo "以下文件未通过 gofmt:"
|
|
echo "$unformatted"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build
|
|
run: go build ./...
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Test(含竞态检测)
|
|
run: go test -race ./... -count=1
|