Skip to content

Commit

Permalink
pipe go test -race output into tparse (cosmos#7309)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Treglia authored Sep 16, 2020
1 parent 0d2599b commit d97f32e
Showing 1 changed file with 70 additions and 4 deletions.
74 changes: 70 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"

install-tparse:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: install tparse
run: |
export GO111MODULE="on" && go get github.com/mfridman/[email protected]
- uses: actions/[email protected]
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary

test-cosmovisor:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -224,8 +236,12 @@ jobs:
name: "${{ github.sha }}-aa"
if: "env.GIT_DIFF != ''"
- name: Run tests with race detector
run: cat xaa.txt | xargs go test -mod=readonly -timeout 15m -race -tags='cgo ledger test_ledger_mock'
run: cat xaa.txt | xargs go test -mod=readonly -json -timeout 15m -race -tags='cgo ledger test_ledger_mock' > xaa-race-output.txt
if: "env.GIT_DIFF != ''"
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-aa-race-output"
path: ./xaa-race-output.txt

test-race-2:
runs-on: ubuntu-latest
Expand All @@ -245,8 +261,12 @@ jobs:
name: "${{ github.sha }}-ab"
if: "env.GIT_DIFF != ''"
- name: Run tests with race detector
run: cat xab.txt | xargs go test -mod=readonly -timeout 15m -race -tags='cgo ledger test_ledger_mock'
run: cat xab.txt | xargs go test -mod=readonly -json -timeout 15m -race -tags='cgo ledger test_ledger_mock' > xab-race-output.txt
if: "env.GIT_DIFF != ''"
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-ab-race-output"
path: ./xab-race-output.txt

test-race-3:
runs-on: ubuntu-latest
Expand All @@ -266,8 +286,12 @@ jobs:
name: "${{ github.sha }}-ac"
if: "env.GIT_DIFF != ''"
- name: Run tests with race detector
run: cat xac.txt | xargs go test -mod=readonly -timeout 15m -race -tags='cgo ledger test_ledger_mock'
run: cat xac.txt | xargs go test -mod=readonly -json -timeout 15m -race -tags='cgo ledger test_ledger_mock' > xac-race-output.txt
if: "env.GIT_DIFF != ''"
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-ac-race-output"
path: ./xac-race-output.txt

test-race-4:
runs-on: ubuntu-latest
Expand All @@ -287,7 +311,49 @@ jobs:
name: "${{ github.sha }}-ad"
if: "env.GIT_DIFF != ''"
- name: Run tests with race detector
run: cat xad.txt | xargs go test -mod=readonly -timeout 15m -race -tags='cgo ledger test_ledger_mock'
run: cat xad.txt | xargs go test -mod=readonly -json -timeout 15m -race -tags='cgo ledger test_ledger_mock' > xad-race-output.txt
if: "env.GIT_DIFF != ''"
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-ad-race-output"
path: ./xad-race-output.txt

race-detector-report:
runs-on: ubuntu-latest
needs: [test-race-1, test-race-2, test-race-3, test-race-4, install-tparse]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
id: git_diff
with:
SUFFIX_FILTER: |
.go
.mod
.sum
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-aa-race-output"
if: "env.GIT_DIFF != ''"
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-ab-race-output"
if: "env.GIT_DIFF != ''"
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-ac-race-output"
if: "env.GIT_DIFF != ''"
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-ad-race-output"
if: "env.GIT_DIFF != ''"
- uses: actions/[email protected]
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
if: "env.GIT_DIFF != ''"
- name: Generate test report (go test -race)
run: cat xa*-race-output.txt | ~/go/bin/tparse
if: "env.GIT_DIFF != ''"

liveness-test:
Expand Down

0 comments on commit d97f32e

Please sign in to comment.