2021-02-18 09:57:19 +03:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-05-19 13:55:43 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2021-02-18 09:57:19 +03:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-05-19 13:55:43 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2021-02-18 09:57:19 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
GOPROXY: "https://proxy.golang.org"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Go-Test
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-05-19 13:55:43 +03:00
|
|
|
go: [1.15.x, 1.16.x]
|
2021-02-18 09:57:19 +03:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.os}}
|
|
|
|
steps:
|
|
|
|
- name: Installing Go
|
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Run unit tests
|
|
|
|
run: go test -race -coverprofile=coverage -covermode=atomic -v
|
|
|
|
- name: Upload code coverage report to Codecov
|
|
|
|
uses: codecov/codecov-action@v1.2.1
|
|
|
|
with:
|
|
|
|
file: ./coverage
|
|
|
|
flags: unittests
|
|
|
|
verbose: true
|
|
|
|
name: codecov-ants
|
|
|
|
- name: Print Go environment
|
|
|
|
id: vars
|
|
|
|
run: |
|
|
|
|
printf "Using go at: $(which go)\n"
|
|
|
|
printf "Go version: $(go version)\n"
|
|
|
|
printf "\n\nGo environment:\n\n"
|
|
|
|
go env
|
|
|
|
printf "\n\nSystem environment:\n\n"
|
|
|
|
env
|
|
|
|
# Calculate the short SHA1 hash of the git commit
|
|
|
|
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
|
|
|
|
echo "::set-output name=go_cache::$(go env GOCACHE)"
|
|
|
|
- name: Cache go modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.vars.outputs.go_cache }}
|
|
|
|
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-${{ matrix.go }}-go-ci
|