Skip to content

Commit e30e012

Browse files
committed
👷 ci: move the go code check to alone action script
1 parent d5e63f5 commit e30e012

File tree

2 files changed

+46
-18
lines changed

2 files changed

+46
-18
lines changed

.github/workflows/codecheck.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CodeCheck
2+
on:
3+
pull_request:
4+
paths:
5+
- 'go.mod'
6+
- '**.go'
7+
- '**.yml'
8+
push:
9+
paths:
10+
- '**.go'
11+
- 'go.mod'
12+
- '**.yml'
13+
14+
jobs:
15+
16+
test:
17+
name: Static check and lint check
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Go Faster
25+
uses: WillAbides/[email protected]
26+
timeout-minutes: 3
27+
with:
28+
go-version: "1.21"
29+
30+
- name: Revive lint check
31+
uses: docker://morphy/revive-action:v2.5.5
32+
with:
33+
# Exclude patterns, separated by semicolons (optional)
34+
exclude: "./_examples/...;./testdata/..."
35+
36+
- name: Run static check
37+
uses: reviewdog/action-staticcheck@v1
38+
if: ${{ github.event_name == 'pull_request'}}
39+
with:
40+
github_token: ${{ secrets.github_token }}
41+
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
42+
reporter: github-pr-check
43+
# Report all results. [added,diff_context,file,nofilter].
44+
filter_mode: added
45+
# Exit with 1 when it find at least one finding.
46+
fail_on_error: true

.github/workflows/go.yml

-18
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,6 @@ jobs:
3030
with:
3131
go-version: ${{ matrix.go_version }}
3232

33-
- name: Revive check
34-
uses: morphy2k/[email protected]
35-
with:
36-
# Exclude patterns, separated by semicolons (optional)
37-
exclude: "./testdata/..."
38-
39-
- name: Run static check
40-
uses: reviewdog/action-staticcheck@v1
41-
if: ${{ github.event_name == 'pull_request'}}
42-
with:
43-
github_token: ${{ secrets.github_token }}
44-
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
45-
reporter: github-pr-check
46-
# Report all results. [added,diff_context,file,nofilter].
47-
filter_mode: added
48-
# Exit with 1 when it find at least one finding.
49-
fail_on_error: true
50-
5133
- name: Run unit tests
5234
# run: go test -v -cover ./...
5335
# must add " for profile.cov on windows OS

0 commit comments

Comments
 (0)