ci: add Gitea Actions build/test workflow
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '**.go'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- 'Makefile'
|
||||
- '.gitea/workflows/ci.yml'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- '**.go'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
- 'Makefile'
|
||||
- '.gitea/workflows/ci.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: cpu
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
- name: Format check
|
||||
run: |
|
||||
unformatted=$(find . -name '*.go' -not -path '*/testdata/*' -print0 | xargs -0 gofmt -l)
|
||||
if [ -n "$unformatted" ]; then
|
||||
echo "gofmt needs to run on:"
|
||||
echo "$unformatted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
|
||||
- name: Static build
|
||||
run: CGO_ENABLED=0 go build -ldflags="-w -s" -o shush ./cmd/shush
|
||||
Reference in New Issue
Block a user