121 lines
2.4 KiB
YAML
121 lines
2.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
|
|
build:
|
|
name: Build & Vet
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Build
|
|
run: go build ./cmd/...
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run tests
|
|
run: go test -race -count=1 ./...
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Install staticcheck
|
|
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
|
- name: Run staticcheck
|
|
run: staticcheck ./...
|
|
|
|
- name: Check formatting
|
|
run: |
|
|
UNFORMATTED=$(gofmt -l .)
|
|
if [ -n "$UNFORMATTED" ]; then
|
|
echo "Files not formatted:"
|
|
echo "$UNFORMATTED"
|
|
exit 1
|
|
fi
|
|
|
|
goreleaser-check:
|
|
name: GoReleaser Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Install GoReleaser
|
|
uses: goreleaser/goreleaser-action@v6
|
|
with:
|
|
install-only: true
|
|
|
|
- name: Validate config
|
|
run: goreleaser check
|
|
|
|
- name: Dry run
|
|
run: goreleaser build --snapshot --clean
|
|
|
|
release:
|
|
name: Build & Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run tests
|
|
run: go test -race -count=1 ./...
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v6
|
|
with:
|
|
args: release --clean
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.TOKEN_GITEA }}
|