qsliu2017 commented on a change in pull request #2072:
URL: https://github.com/apache/apisix-dashboard/pull/2072#discussion_r690869840
##########
File path: .github/workflows/go-lint.yml
##########
@@ -3,37 +3,72 @@ on:
push:
branches:
- master
- paths-ignore:
- - 'docs/**'
- - 'web/**'
+ paths:
+ - 'api/**'
pull_request:
branches:
- master
- paths-ignore:
- - 'docs/**'
- - 'web/**'
+ paths:
+ - 'api/**'
jobs:
+ go-filter:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodule: true
+
+ - uses: ./.github/actions/paths-filter
+ id: changes
+ with:
+ filters: |
+ go:
+ - '**.go'
+ working-directory: 'api'
+ list-files: shell
+ outputs:
+ matches: ${{ steps.changes.outputs.go }}
+ files: ${{ steps.changes.outputs.go_files }}
+
golangci:
runs-on: ubuntu-latest
+ needs: go-filter
+ if: needs.go-filter.outputs.matches == 'true'
steps:
- uses: actions/checkout@v2
- - name: run lint
- run: make go-lint
+ - name: golangci-lint
+ uses: golangci/golangci-lint-action@v2
+ with:
+ version: latest
+ working-directory: api
+ args: --tests=false
+ only-new-issues: true
gofmt:
runs-on: ubuntu-latest
+ needs: go-filter
+ if: needs.go-filter.outputs.matches == 'true'
steps:
- uses: actions/checkout@v2
- name: setup go
uses: actions/setup-go@v1
with:
go-version: '1.13'
+
+ - uses: actions/cache@v2
+ with:
+ path: |
+ ~/.cache/go-build
+ ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: |
+ ${{ runner.os }}-go-
Review comment:
This stage caches go mod and build to speed up go, see
https://github.com/actions/cache/blob/main/examples.md#go---modules
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]