-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (69 loc) · 1.8 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Go
on:
push:
branches: [ main, 1.x ]
tags: [ 'v*.*.*' ]
paths-ignore:
- 'docs/**'
pull_request:
branches: [ main, 1.x ]
paths-ignore:
- 'docs/**'
jobs:
test-build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@main
- name: Set up Go
uses: actions/setup-go@main
with:
go-version: 1.21
- name: Run generators
run: go generate ./...
- name: Vet
run: go vet ./...
- name: Build
run: go build -ldflags="-s -w" -o build/shipshape . && ls -lh build/shipshape
- name: List check types
run: ./build/shipshape config list-checks
- name: Test
run: go test -v -race ./... -coverprofile=build/coverage.out
- uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: build/coverage.out
- name: Upload test coverage
uses: actions/upload-artifact@main
with:
name: build
path: build
if: github.ref_name == 'main'
publish-binary:
needs: test-build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@main
with:
go-version: 1.21
- name: Fetch all tags
run: git fetch --force --tags
if: startsWith(github.ref_name, 'v')
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@master
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
if: startsWith(github.ref_name, 'v')
publish-docker:
needs:
- test-build
- publish-binary
uses: ./.github/workflows/docker-publish.yml