-
Notifications
You must be signed in to change notification settings - Fork 20
62 lines (51 loc) · 1.31 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
name: build
on:
push:
branches:
- master
- main
tags:
- 'v*'
pull_request:
jobs:
test-build:
name: Test & Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '>=1.19.0'
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Run go mod tidy
run: |
set -e
go mod tidy
output=$(git status -s)
if [ -z "${output}" ]; then
exit 0
fi
echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.'
echo 'Running `go mod tidy` on this CI test yields with the following changes:'
echo "$output"
exit 1
- name: Test
run: |
go test -race ./...
- name: Lint
uses: dominikh/[email protected]
with:
version: "2022.1.1"
install-go: false
- name: Build
run: go build ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
# only release on tags
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.FAILLINT_ACTIONS_BOT_TOKEN }}