2019-11-21 09:50:27 +00:00
|
|
|
name: Go
|
2020-03-16 15:43:48 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
paths-ignore:
|
|
|
|
- '*.md'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
paths-ignore:
|
|
|
|
- '*.md'
|
2019-11-21 09:50:27 +00:00
|
|
|
jobs:
|
|
|
|
|
|
|
|
test:
|
|
|
|
name: test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-03-16 15:37:57 +00:00
|
|
|
go: [ '1.12.x', '1.13.x', '1.14.x']
|
2019-11-21 09:50:27 +00:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
2020-03-16 15:43:48 +00:00
|
|
|
id: go
|
2019-11-21 09:50:27 +00:00
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
2020-03-16 15:43:48 +00:00
|
|
|
uses: actions/checkout@v2
|
2019-11-21 09:50:27 +00:00
|
|
|
|
|
|
|
- name: Set GOPATH
|
|
|
|
# temporary fix
|
|
|
|
# see https://github.com/actions/setup-go/issues/14
|
|
|
|
run: |
|
|
|
|
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
|
|
|
|
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
|
|
|
|
shell: bash
|
|
|
|
|
2020-03-16 15:43:48 +00:00
|
|
|
- uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
2019-11-21 09:50:27 +00:00
|
|
|
- name: Get dependencies
|
|
|
|
run: |
|
|
|
|
go get -u -v golang.org/x/lint/golint
|
|
|
|
go mod tidy -v
|
|
|
|
|
|
|
|
- name: Linter
|
|
|
|
run: golint -set_exit_status ./...
|
|
|
|
|
|
|
|
- name: Tests
|
|
|
|
run: go test -coverprofile=coverage.txt -covermode=atomic ./...
|
|
|
|
|
|
|
|
- name: Codecov
|
2019-11-21 11:09:44 +00:00
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
2019-11-21 09:50:27 +00:00
|
|
|
run: bash <(curl -s https://codecov.io/bash)
|