45 lines (38 loc) · 939 Bytes
/
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
name: Build Go
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- 1.18
- 1.19
steps:
- uses: actions/checkout@v3
- name: set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: check fmt
run: find . -name '*.go' | xargs gofmt -l | read && echo "Code differs from gofmt's style. Run 'gofmt -w .'" 1>&2 && exit 1 || true
- name: check go.mod
shell: bash
run: |
go mod tidy
git diff-index --quiet HEAD
- name: go test
run: go test ./...
-
name: cross build with goreleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: build --rm-dist --snapshot