From e30e012910c431e54e446dbdd258600dd1e17099 Mon Sep 17 00:00:00 2001 From: Inhere Date: Sat, 6 Jan 2024 18:00:26 +0800 Subject: [PATCH] :construction_worker: ci: move the go code check to alone action script --- .github/workflows/codecheck.yml | 46 +++++++++++++++++++++++++++++++++ .github/workflows/go.yml | 18 ------------- 2 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/codecheck.yml diff --git a/.github/workflows/codecheck.yml b/.github/workflows/codecheck.yml new file mode 100644 index 0000000..cac8e66 --- /dev/null +++ b/.github/workflows/codecheck.yml @@ -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 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 49d089b..6efb84e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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