2020-01-29 05:24:22 +02:00
|
|
|
name: Run Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-12 10:57:58 +02:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2020-11-11 11:19:05 +02:00
|
|
|
- 'go.*'
|
|
|
|
- '_fixture/**'
|
|
|
|
- '.github/**'
|
2020-12-01 07:06:31 +02:00
|
|
|
- 'codecov.yml'
|
2020-01-29 05:24:22 +02:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-12 10:57:58 +02:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
2020-11-11 11:19:05 +02:00
|
|
|
- 'go.*'
|
|
|
|
- '_fixture/**'
|
|
|
|
- '.github/**'
|
2020-12-01 07:06:31 +02:00
|
|
|
- 'codecov.yml'
|
2020-01-29 05:24:22 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2020-11-20 13:41:08 +02:00
|
|
|
go: [1.12, 1.13, 1.14, 1.15]
|
2020-01-29 05:24:22 +02:00
|
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Set GOPATH and PATH
|
|
|
|
run: |
|
2020-11-20 06:44:00 +02:00
|
|
|
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
|
|
|
|
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
|
2020-01-29 05:24:22 +02:00
|
|
|
shell: bash
|
|
|
|
|
2020-11-20 06:44:00 +02:00
|
|
|
- name: Set build variables
|
|
|
|
run: |
|
|
|
|
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
|
|
|
|
echo "GO111MODULE=on" >> $GITHUB_ENV
|
|
|
|
|
2020-01-29 05:24:22 +02:00
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
run: go get -v golang.org/x/lint/golint
|
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
run: |
|
|
|
|
golint -set_exit_status ./...
|
|
|
|
go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
if: success() && matrix.go == 1.13 && matrix.os == 'ubuntu-latest'
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
token:
|
|
|
|
fail_ci_if_error: false
|
2020-11-23 07:11:17 +02:00
|
|
|
benchmark:
|
|
|
|
needs: test
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
go: [1.15]
|
|
|
|
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Set GOPATH and PATH
|
|
|
|
run: |
|
|
|
|
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
|
|
|
|
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Set build variables
|
|
|
|
run: |
|
|
|
|
echo "GOPROXY=https://proxy.golang.org" >> $GITHUB_ENV
|
|
|
|
echo "GO111MODULE=on" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Checkout Code (Previous)
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: ${{ github.base_ref }}
|
|
|
|
path: previous
|
|
|
|
|
|
|
|
- name: Checkout Code (New)
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: new
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
run: go get -v golang.org/x/perf/cmd/benchstat
|
|
|
|
|
|
|
|
- name: Run Benchmark (Previous)
|
|
|
|
run: |
|
|
|
|
cd previous
|
2020-12-01 06:39:06 +02:00
|
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
2020-11-23 07:11:17 +02:00
|
|
|
|
|
|
|
- name: Run Benchmark (New)
|
|
|
|
run: |
|
|
|
|
cd new
|
2020-12-01 06:39:06 +02:00
|
|
|
go test -run="-" -bench=".*" -count=8 ./... > benchmark.txt
|
2020-11-23 07:11:17 +02:00
|
|
|
|
|
|
|
- name: Run Benchstat
|
|
|
|
run: |
|
|
|
|
benchstat previous/benchmark.txt new/benchmark.txt
|