From d97f32e5f06d189cf9d643a9869fb39af6680a14 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Wed, 16 Sep 2020 10:31:14 +0100 Subject: [PATCH] pipe go test -race output into tparse (#7309) --- .github/workflows/test.yml | 74 +++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf862c928..9529f6243 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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/setup-go@v2.1.2 + - name: install tparse + run: | + export GO111MODULE="on" && go get github.com/mfridman/tparse@v0.8.3 + - uses: actions/cache@v2.1.1 + with: + path: ~/go/bin + key: ${{ runner.os }}-go-tparse-binary + test-cosmovisor: runs-on: ubuntu-latest steps: @@ -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 @@ -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 @@ -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 @@ -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/cache@v2.1.1 + 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: