-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github action for checking pull requests
- Loading branch information
Showing
2 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: lint-and-test | ||
|
||
on: | ||
pull_request: {} | ||
|
||
jobs: | ||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cache go-build and mod | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build/ | ||
~/go/pkg/mod/ | ||
key: go-${{ hashFiles('go.sum') }} | ||
restore-keys: | | ||
go- | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- name: Unit test | ||
run: | | ||
PATH=$PATH:$(go env GOPATH)/bin make build | ||
PATH=$PATH:$(go env GOPATH)/bin make test | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cache go-build and mod | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/go-build/ | ||
~/go/pkg/mod/ | ||
key: go-${{ hashFiles('go.sum') }} | ||
restore-keys: | | ||
go- | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18.x | ||
- name: Install goimports | ||
run: | | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
- name: Setup lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.47.2 | ||
- name: Lint | ||
run: | | ||
PATH=$PATH:$(go env GOPATH)/bin make check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters