forked from mirror/ants
71 lines
1.7 KiB
YAML
71 lines
1.7 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '**.md'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- '**.md'
|
|
|
|
env:
|
|
GO111MODULE: on
|
|
GOPROXY: "https://proxy.golang.org"
|
|
|
|
jobs:
|
|
test:
|
|
name: Go-Test
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
go: [1.15.x, 1.16.x]
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os}}
|
|
steps:
|
|
- name: Installing Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- 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 }}
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ matrix.go }}-go-ci
|
|
|
|
- name: Run unit tests
|
|
run: go test -race -coverprofile=coverage -covermode=atomic -v
|
|
|
|
- name: Upload code coverage report to Codecov
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
file: ./coverage
|
|
flags: unittests
|
|
verbose: true
|
|
name: codecov-ants
|
|
|