-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee69b36
commit 31168de
Showing
5 changed files
with
87 additions
and
36 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 |
---|---|---|
@@ -1,37 +1,80 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
on: [push, pull_request] | ||
name: test and build | ||
jobs: | ||
|
||
build: | ||
name: Build | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: Install golangci-lint | ||
run: | | ||
go get github.com/golangci/golangci-lint/cmd/golangci-lint | ||
- name: Run linters | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin && golangci-lint --tests=false -E bodyclose,misspell,gocyclo,dupl,gofmt,golint,unconvert,depguard,gocritic,funlen,interfacer run | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get dependencies | ||
run: | | ||
go get -v -t -d ./... | ||
if [ -f Gopkg.toml ]; then | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
dep ensure | ||
fi | ||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.12.x, 1.13.x] | ||
platform: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Install Go | ||
if: success() | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: Run tests | ||
run: go test -v -covermode=count | ||
|
||
- name: Build | ||
run: go build -v . | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
if: success() | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: Calc coverage | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
go test -v -covermode=count -coverprofile=coverage.out | ||
- name: Convert coverage to lcov | ||
uses: jandelgado/gcov2lcov-action@v1.0.0 | ||
with: | ||
infile: coverage.out | ||
outfile: coverage.lcov | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@v1.0.1 | ||
with: | ||
github-token: ${{ secrets.github_token }} | ||
path-to-lcov: coverage.lcov | ||
|
||
- name: Test | ||
run: go test -v . | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
- name: build | ||
run: | | ||
export GO111MODULE=on | ||
GOOS=linux GOARCH=amd64 go build -o bin/ci-test-linux-amd64 | ||
- name: upload artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: binaries | ||
path: bin/ |
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 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 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 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