name: Tests on: push: branches: - master pull_request: branches: - master env: GO111MODULE: on GOPROXY: "https://proxy.golang.org" jobs: test: name: Go-Test strategy: fail-fast: false matrix: go: [1.14.x, 1.15.x] 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