-
Notifications
You must be signed in to change notification settings - Fork 103
142 lines (135 loc) · 3.99 KB
/
lint.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Lint
# **What it does**: Runs go linter when go files have been modified
# and proto linters when proto files have been modified.
#
# **Why we have it**: Ensures all go files and proto files are
# properly formatted according to lint configuration files.
#
# **What does it impact**: Code quality.
on:
pull_request:
push:
branches:
- main
- release/v*
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
golangci:
runs-on: ubuntu-latest
permissions:
pull-requests: read # for technote-space/get-diff-action to get git reference
strategy:
matrix:
module: ["app", "types", "x/data", "x/ecocredit", "x/intertx"]
steps:
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
id: git-diff-app
with:
PATTERNS: |
app/**/**.go
go.mod
go.sum
if: matrix.module == 'app'
- uses: technote-space/get-diff-action@v6
id: git-diff-types
with:
PATTERNS: |
types/**/**.go
types/go.mod
types/go.sum
if: matrix.module == 'types'
- uses: technote-space/get-diff-action@v6
id: git-diff-data
with:
PATTERNS: |
x/data/**/**.go
x/data/go.mod
x/data/go.sum
if: matrix.module == 'x/data'
- uses: technote-space/get-diff-action@v6
id: git-diff-ecocredit
with:
PATTERNS: |
x/ecocredit/**/**.go
x/ecocredit/go.mod
x/ecocredit/go.sum
if: matrix.module == 'x/ecocredit'
- uses: technote-space/get-diff-action@v6
id: git-diff-intertx
with:
PATTERNS: |
x/intertx/**/**.go
x/intertx/go.mod
x/intertx/go.sum
if: matrix.module == 'x/intertx'
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
if: env.GIT_DIFF
- uses: golangci/golangci-lint-action@v3
with:
version: v1.55
working-directory: "."
if: steps.git-diff-app.outputs.diff
- uses: golangci/golangci-lint-action@v3
with:
version: v1.55
working-directory: "types"
if: steps.git-diff-types.outputs.diff
- uses: golangci/golangci-lint-action@v3
with:
version: v1.55
working-directory: "x/data"
if: steps.git-diff-data.outputs.diff
- uses: golangci/golangci-lint-action@v3
with:
version: v1.55
working-directory: "x/ecocredit"
if: steps.git-diff-ecocredit.outputs.diff
- uses: golangci/golangci-lint-action@v3
with:
version: v1.55
working-directory: "x/intertx"
if: steps.git-diff-intertx.outputs.diff
buf-lint:
runs-on: ubuntu-latest
permissions:
pull-requests: read # for technote-space/get-diff-action to get git reference
steps:
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
id: git-diff-proto
with:
PATTERNS: |
**/**.proto
- uses: bufbuild/buf-setup-action@v1
if: steps.git-diff-proto.outputs.diff
- uses: bufbuild/buf-lint-action@v1
with:
input: 'proto'
if: steps.git-diff-proto.outputs.diff
protolint:
runs-on: ubuntu-latest
permissions:
pull-requests: read # for technote-space/get-diff-action to get git reference
steps:
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
id: git-diff-proto
with:
PATTERNS: |
**/**.proto
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
if: steps.git-diff-proto.outputs.diff
- name: Run protolint
run: |
go install github.com/yoheimuta/protolint/cmd/protolint@latest
protolint .
if: steps.git-diff-proto.outputs.diff