Skip to content

Commit afab492

Browse files
committed
add .github/workflows/go-test.yml
1 parent 956e49a commit afab492

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/go-test.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
unit:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ "ubuntu", "windows", "macos" ]
12+
go: [ "1.15.x", "1.16.x" ]
13+
runs-on: ${{ matrix.os }}-latest
14+
name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }})
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-go@v2
18+
with:
19+
go-version: ${{ matrix.go }}
20+
- name: Go information
21+
run: |
22+
go version
23+
go env
24+
- name: Run tests
25+
run: go test -v -coverprofile coverage.txt ./...
26+
- name: Run tests (32 bit)
27+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
28+
env:
29+
GOARCH: 386
30+
run: go test -v ./...
31+
- name: Run tests with race detector
32+
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
33+
run: go test -v -race ./...
34+
- name: Check if codecov.yml exists # only upload to Codecov if there's a codecov.yml
35+
id: check_codecov
36+
uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 # v1.0.1
37+
with:
38+
files: "codecov.yml"
39+
- name: Upload coverage to Codecov
40+
if: steps.check_codecov.outputs.files_exists == 'true'
41+
uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1
42+
with:
43+
file: coverage.txt
44+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

0 commit comments

Comments
 (0)