|
1 | 1 | name: reviewdog |
2 | 2 | on: |
3 | 3 | push: |
4 | | - branches: [main, master] |
| 4 | + branches: [ main, master ] |
5 | 5 | pull_request: |
6 | | - branches: [main, master] |
| 6 | + branches: [ main, master ] |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - golangci-lint: |
10 | | - name: runner / golangci-lint |
11 | | - runs-on: ubuntu-latest |
12 | | - steps: |
13 | | - - name: Check out code |
14 | | - uses: actions/checkout@v4 |
15 | | - |
16 | | - - name: Set up Go |
17 | | - uses: actions/setup-go@v4 |
18 | | - with: |
19 | | - go-version: '1.22' |
20 | | - cache: true |
21 | | - |
22 | | - - name: Install golangci-lint |
23 | | - run: | |
24 | | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 |
25 | | -
|
26 | | - - name: Install reviewdog |
27 | | - run: | |
28 | | - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b $(go env GOPATH)/bin |
29 | | -
|
30 | | - - name: Run golangci-lint with reviewdog |
31 | | - env: |
32 | | - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.github_token }} |
33 | | - run: | |
34 | | - $(go env GOPATH)/bin/golangci-lint run --no-config --disable-all --enable=gofmt,govet,errcheck | reviewdog -f=golangci-lint -reporter=github-pr-review -level=info |
35 | | -
|
36 | 9 | go-test: |
37 | 10 | name: runner / go test |
38 | 11 | runs-on: ubuntu-latest |
39 | 12 | steps: |
40 | 13 | - name: Check out code |
41 | 14 | uses: actions/checkout@v4 |
42 | | - |
| 15 | + |
43 | 16 | - name: Set up Go |
44 | 17 | uses: actions/setup-go@v4 |
45 | 18 | with: |
46 | | - go-version: "1.22" |
| 19 | + go-version: '1.22' |
47 | 20 | cache: true |
48 | | - |
| 21 | + |
49 | 22 | - name: Run tests |
50 | 23 | run: go test -v ./... |
51 | 24 |
|
52 | | - misspell: |
53 | | - name: runner / misspell |
| 25 | + format-check: |
| 26 | + name: runner / format check |
54 | 27 | runs-on: ubuntu-latest |
55 | 28 | steps: |
56 | 29 | - name: Check out code |
57 | 30 | uses: actions/checkout@v4 |
58 | | - |
| 31 | + |
59 | 32 | - name: Set up Go |
60 | 33 | uses: actions/setup-go@v4 |
61 | 34 | with: |
62 | 35 | go-version: '1.22' |
63 | 36 | cache: true |
64 | | - |
65 | | - - name: Install reviewdog and misspell |
66 | | - run: | |
67 | | - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b $(go env GOPATH)/bin |
68 | | - go install github.com/client9/misspell/cmd/misspell@latest |
69 | | -
|
70 | | - - name: Run misspell with reviewdog |
71 | | - env: |
72 | | - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.github_token }} |
| 37 | + |
| 38 | + - name: Check formatting |
73 | 39 | run: | |
74 | | - $(go env GOPATH)/bin/misspell -locale US . | $(go env GOPATH)/bin/reviewdog -f=misspell -reporter=github-pr-review -level=info |
| 40 | + gofmt -l . | grep -v vendor/ | tee /dev/stderr | (! grep .) |
0 commit comments