-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework CI: Removed travis + gometalinter, added GitHub Actions + stat…
…iccheck (#82)
- Loading branch information
1 parent
590067b
commit e56a0c4
Showing
5 changed files
with
118 additions
and
65 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,104 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: "5 1 * * *" | ||
|
||
jobs: | ||
gofmt: | ||
name: go fmt (Go ${{ matrix.go }}) | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
go: [ '1.15', '1.14', '1.13' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
# Caching go modules to speed up the run | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run go fmt | ||
if: runner.os != 'Windows' | ||
run: diff -u <(echo -n) <(gofmt -d -s .) | ||
|
||
govet: | ||
name: go vet (Go ${{ matrix.go }}) | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
go: [ '1.15', '1.14', '1.13' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
# Caching go modules to speed up the run | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run go vet | ||
run: make vet | ||
|
||
staticcheck: | ||
name: staticcheck (Go ${{ matrix.go }}) | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
go: [ '1.15', '1.14', '1.13' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
# Caching go modules to speed up the run | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run staticcheck | ||
run: make staticcheck | ||
|
||
unittesting: | ||
name: unit testing (Go ${{ matrix.go }}) | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
go: [ '1.15', '1.14', '1.13' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
# Caching go modules to speed up the run | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run Unit tests. | ||
run: make test |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,26 +1,18 @@ | ||
.PHONY: fmt vet lint check test | ||
PACKAGES = $(shell go list ./...) | ||
PACKAGE_DIRS = $(shell go list -f '{{ .Dir }}' ./...) | ||
.DEFAULT_GOAL := help | ||
|
||
check: test vet lint | ||
.PHONY: help | ||
help: ## Outputs the help | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
test: | ||
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... | ||
.PHONY: test | ||
test: ## Runs all unit tests | ||
go test -v -race ./... | ||
|
||
vet: | ||
go vet $(PACKAGES) || (go clean $(PACKAGES); go vet $(PACKAGES)) | ||
.PHONY: vet | ||
vet: ## Runs go vet | ||
go vet ./... | ||
|
||
lint: | ||
gometalinter --config gometalinter.json ./... | ||
|
||
fmt: | ||
go fmt $(PACKAGES) | ||
goimports -w $(PACKAGE_DIRS) | ||
|
||
deps: | ||
go get -t -v ./... | ||
go get github.com/axw/gocov/gocov | ||
go get golang.org/x/tools/cmd/cover | ||
[ -f $(GOPATH)/bin/gometalinter ] || go get -u github.com/alecthomas/gometalinter | ||
[ -f $(GOPATH)/bin/goimports ] || go get golang.org/x/tools/cmd/goimports | ||
gometalinter --install | ||
.PHONY: staticcheck | ||
staticcheck: ## Runs static code analyzer staticcheck | ||
go get -u honnef.co/go/tools/cmd/staticcheck | ||
staticcheck ./... |
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
This file was deleted.
Oops, something went wrong.