Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit 80e65d4

Browse files
committed
add .github/workflows/go-test.yml
1 parent 59bcf8b commit 80e65d4

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/go-test.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
name: Go Test
6+
7+
jobs:
8+
unit:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ "ubuntu", "windows", "macos" ]
13+
go: [ "1.16.x", "1.17.x" ]
14+
env:
15+
COVERAGES: ""
16+
runs-on: ${{ matrix.os }}-latest
17+
name: ${{ matrix.os}} (go ${{ matrix.go }})
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
submodules: recursive
22+
- uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go }}
25+
- name: Go information
26+
run: |
27+
go version
28+
go env
29+
- name: Run repo-specific setup
30+
uses: ./.github/actions/go-test-setup
31+
if: hashFiles('./.github/actions/go-test-setup') != ''
32+
- name: Run tests
33+
uses: protocol/[email protected]
34+
with:
35+
run: go test -v -coverprofile module-coverage.txt ./...
36+
- name: Run tests (32 bit)
37+
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
38+
uses: protocol/[email protected]
39+
env:
40+
GOARCH: 386
41+
with:
42+
run: go test -v ./...
43+
- name: Run tests with race detector
44+
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
45+
uses: protocol/[email protected]
46+
with:
47+
run: go test -v -race ./...
48+
- name: Collect coverage files
49+
shell: bash
50+
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
51+
- name: Upload coverage to Codecov
52+
uses: codecov/codecov-action@51d810878be5422784e86451c0e7c14e5860ec47 # v2.0.2
53+
with:
54+
files: '${{ env.COVERAGES }}'
55+
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

0 commit comments

Comments
 (0)