-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (39 loc) · 1.05 KB
/
code-quality.yaml
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
name: Code Quality
on: [pull_request]
jobs:
formatting:
name: go fmt
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get dependencies
run: go mod download
- name: Formatting
run: diff <(gofmt -d ./...) <(echo -n)
generate:
name: go generate
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get dependencies
run: go mod download
- name: stringer
run: go get golang.org/x/tools/cmd/stringer
- name: go generate
run: go generate
- name: validate generated code
run: git diff --exit-code -- . ':(exclude)go.sum' ':(exclude)go.mod'