go-test.yml 1.8 KB
Newer Older
web3-bot's avatar
web3-bot committed
1 2 3 4
# File managed by web3-bot. DO NOT EDIT.
# See https://github.com/protocol/.github/ for details.

on: [push, pull_request]
web3-bot's avatar
web3-bot committed
5
name: Go Test
web3-bot's avatar
web3-bot committed
6 7 8 9 10 11 12

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