@@ -2,7 +2,7 @@ on: pull_request
22name : pull_request
33jobs :
44 staticcheck :
5- runs-on : ubuntu-22.04-16core
5+ runs-on : ubuntu-latest
66 steps :
77 - name : checkout code
88 uses : actions/checkout@v4
@@ -38,10 +38,10 @@ jobs:
3838
3939 test :
4040 runs-on : ubuntu-22.04-16core
41- needs :
42- - staticcheck
4341 permissions :
4442 pull-requests : write
43+ outputs :
44+ failures : ${{ steps.generate-job-summary.outputs.failures }}
4545 steps :
4646 - name : checkout code
4747 uses : actions/checkout@v4
@@ -65,20 +65,29 @@ jobs:
6565 - name : Run tests
6666 run : |
6767 set -euo pipefail
68- go test -json -v -short -timeout=30m ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
69- go test -json -v -tags=purego -timeout=30m ./... 2>&1 | tee -a /tmp/gotest.log | gotestfmt
70- go test -json -v -race -timeout=30m ./ecc/bn254/... 2>&1 | tee -a /tmp/gotest.log | gotestfmt
71- GOARCH=386 go test -json -short -v -timeout=30m ./ecc/bn254/... 2>&1 | tee -a /tmp/gotest.log | gotestfmt
68+ go test -json -v -short -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee /tmp/gotest.log
69+ go test -json -v -tags=purego -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
70+ go test -json -v -race -timeout=30m ./ecc/bn254/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
71+ GOARCH=386 go test -json -short -v -timeout=30m ./ecc/bn254/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log
7272
7373 - name : Generate job summary
74+ id : generate-job-summary
75+ if : ${{ always() }}
7476 run : |
75- cat /tmp/gotest.log | node .github/parse-tests.js > /tmp/gotest.md
76- cat /tmp/gotest.md > $GITHUB_STEP_SUMMARY
77+ if [ -s /tmp/gotest.log ]; then
78+ cat /tmp/gotest.log > $GITHUB_STEP_SUMMARY
79+ echo "failures=$(cat /tmp/gotest.log | node .github/parse-tests.js)" > $GITHUB_OUTPUT
80+ else
81+ echo "## Success ✅" > $GITHUB_STEP_SUMMARY
82+ echo "failures=" > $GITHUB_OUTPUT
83+ fi
7784
85+ # if we failed a test, we want to comment on the PR with the log
7886 - name : PR comment with file
87+ if : ${{ failure() }}
7988 uses : thollander/actions-comment-pull-request@v2
8089 with :
81- filePath : /tmp/gotest.md
90+ filePath : /tmp/gotest.log
8291
8392 slack-workflow-status-failed :
8493 if : failure()
99108 "status": "FAIL",
100109 "title": "${{ github.event.pull_request.title }}",
101110 "pr": "${{ github.event.pull_request.head.ref }}",
102- "failed_step_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/"
111+ "failed_step_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/",
112+ "message": "${{ needs.test.outputs.failures }}"
103113 }
104114 env :
105115 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
0 commit comments