Skip to content

Commit 4aca88d

Browse files
authored
moved go linter workflow out of go.yml (#702)
* moved go linter workflow out of go.yml * added steps to setup go and format * added empty line at EOF * remove init and diff steps out of go.yml
1 parent 586dce9 commit 4aca88d

File tree

2 files changed

+42
-15
lines changed

2 files changed

+42
-15
lines changed

.github/workflows/go.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,8 @@ jobs:
3838
with:
3939
go-version-file: ${{ github.workspace }}/go.mod
4040

41-
- name: Initialize dependencies and linters
42-
run: make init
43-
44-
- name: Diff
45-
run: |
46-
make format
47-
git diff --exit-code
48-
4941
- name: Test
5042
run: |
5143
TEST_MONGODB_IMAGE=${{ matrix.image }} make test-cluster
5244
make test-race
5345
make test-cluster-clean
54-
55-
- name: Run checks/linters
56-
run: |
57-
# use GITHUB_TOKEN because only it has access to GitHub Checks API
58-
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
59-
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
60-
make check-license

.github/workflows/lint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Lint
2+
3+
on:
4+
schedule:
5+
# run every Sunday
6+
- cron: '0 13 * * 0'
7+
push:
8+
branches:
9+
- main
10+
- release-0.1x
11+
tags:
12+
- v[0-9]+.[0-9]+.[0-9]+*
13+
pull_request:
14+
15+
jobs:
16+
lint:
17+
name: Lint Check
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v3
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v4
27+
with:
28+
go-version-file: ${{ github.workspace }}/go.mod
29+
30+
- name: Initialize dependencies and linters
31+
run: make init
32+
33+
- name: Diff
34+
run: |
35+
make format
36+
git diff --exit-code
37+
- name: Run checks/linters
38+
run: |
39+
# use GITHUB_TOKEN because only it has access to GitHub Checks API
40+
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
41+
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
42+
make check-license

0 commit comments

Comments
 (0)