Skip to content

Commit

Permalink
👷 ci: move the go code check to alone action script
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jan 6, 2024
1 parent d5e63f5 commit e30e012
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/codecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CodeCheck
on:
pull_request:
paths:
- 'go.mod'
- '**.go'
- '**.yml'
push:
paths:
- '**.go'
- 'go.mod'
- '**.yml'

jobs:

test:
name: Static check and lint check
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Go Faster
uses: WillAbides/setup-go-faster@v1.13.0
timeout-minutes: 3
with:
go-version: "1.21"

- name: Revive lint check
uses: docker://morphy/revive-action:v2.5.5
with:
# Exclude patterns, separated by semicolons (optional)
exclude: "./_examples/...;./testdata/..."

- name: Run static check
uses: reviewdog/action-staticcheck@v1
if: ${{ github.event_name == 'pull_request'}}
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-check
# Report all results. [added,diff_context,file,nofilter].
filter_mode: added
# Exit with 1 when it find at least one finding.
fail_on_error: true
18 changes: 0 additions & 18 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ jobs:
with:
go-version: ${{ matrix.go_version }}

- name: Revive check
uses: morphy2k/revive-action@v2.5.5
with:
# Exclude patterns, separated by semicolons (optional)
exclude: "./testdata/..."

- name: Run static check
uses: reviewdog/action-staticcheck@v1
if: ${{ github.event_name == 'pull_request'}}
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-check
# Report all results. [added,diff_context,file,nofilter].
filter_mode: added
# Exit with 1 when it find at least one finding.
fail_on_error: true

- name: Run unit tests
# run: go test -v -cover ./...
# must add " for profile.cov on windows OS
Expand Down

0 comments on commit e30e012

Please sign in to comment.