name: Tests on: push: branches: - master - dev - test 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.17.x, 1.18.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