From 105d9666f21950790bb46613c32412a1196d6bba Mon Sep 17 00:00:00 2001 From: web3-bot Date: Mon, 29 Mar 2021 14:30:03 +0000 Subject: [PATCH] add .github/workflows/go-test.yml --- .github/workflows/go-test.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/go-test.yml diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 0000000..1bd78a7 --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,44 @@ +# File managed by web3-bot. DO NOT EDIT. +# See https://github.com/protocol/.github/ for details. + +on: [push, pull_request] + +jobs: + unit: + strategy: + fail-fast: false + matrix: + os: [ "ubuntu", "windows", "macos" ] + go: [ "1.15.x", "1.16.x" ] + runs-on: ${{ matrix.os }}-latest + name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }}) + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + - name: Go information + run: | + go version + go env + - name: Run tests + run: go test -v -coverprofile coverage.txt ./... + - name: Run tests (32 bit) + if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX. + env: + GOARCH: 386 + run: go test -v ./... + - name: Run tests with race detector + if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow + run: go test -v -race ./... + - name: Check if codecov.yml exists # only upload to Codecov if there's a codecov.yml + id: check_codecov + uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 # v1.0.1 + with: + files: "codecov.yml" + - name: Upload coverage to Codecov + if: steps.check_codecov.outputs.files_exists == 'true' + uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1 + with: + file: coverage.txt + env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}