-
Notifications
You must be signed in to change notification settings - Fork 91
82 lines (81 loc) · 2.94 KB
/
reviewdog.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
name: "ReviewDog workflow"
on:
pull_request:
jobs:
# Blocking Errors Section
reviewdog-errors:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/[email protected]
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
run: sudo apt-get -y -q install libboost-math-dev
- name: Install specific golang
uses: actions/[email protected]
with:
go-version: '1.20.14'
- name: reviewdog-golangci-lint
uses: reviewdog/[email protected]
with:
golangci_lint_version: "v1.53.2"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-review"
tool_name: "Lint Errors"
level: "error"
fail_on_error: true
# Non-Blocking Warnings Section
reviewdog-warnings:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/[email protected]
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
run: sudo apt-get -y -q install libboost-math-dev
- name: Install specific golang
uses: actions/[email protected]
with:
go-version: '1.20.14'
- name: Add bin to PATH
run: |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
- name: Create folders for golangci-lint
run: mkdir -p cicdtmp/golangci-lint
- name: Check if custom golangci-lint is already built
id: cache-golangci-lint
uses: actions/[email protected]
with:
path: cicdtmp/golangci-lint/golangci-lint-cgo
key: cicd-golangci-lint-cgo-v0.0.2
- name: Build custom golangci-lint with CGO_ENABLED
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.53.2
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.14.1/install.sh | sh -s
reviewdog --version
- name: Run golangci-lint with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
./cicdtmp/golangci-lint/golangci-lint-cgo run
--out-format line-number
-c .golangci-warnings.yml
--allow-parallel-runners
| reviewdog
-f=golangci-lint
-name="Lint Warnings"
-reporter=github-check
-filter-mode=added
-fail-on-error=false
-level=warning