Skip to content

Commit

Permalink
Add support for {PRE,POST}_TEST_HOOKs
Browse files Browse the repository at this point in the history
  • Loading branch information
stv0g committed Apr 20, 2023
1 parent 524a2c3 commit c590001
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test-wasm.reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ jobs:
- name: Run Tests
run: |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
GOOS=js GOARCH=wasm $GOPATH/bin/go test \
-coverprofile=cover.out -covermode=atomic \
GOOS=js GOARCH=wasm \
${GOPATH}/bin/go test \
-coverprofile=cover.out \
-covermode=atomic \
-exec="${GO_JS_WASM_EXEC}" \
-v ./...
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/test.reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,27 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }} # Avoid getting rate limited

- name: Run pre test hook
run: |
if [ -f .github/.ci.conf ]; && . .github/.ci.conf
[ -n "${PRE_TEST_HOOK}" ] && ${PRE_TEST_HOOK}
- name: Run test
run: |
TEST_BENCH_OPTION="-bench=."
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
[ -f .github/.ci.conf ] && . .github/.ci.conf
set -euo pipefail
go-acc -o cover.out ./... -- \
${TEST_BENCH_OPTION} \
-json \
-v -race 2>&1 | grep -v '^go: downloading' | tee /tmp/gotest.log | gotestfmt
- name: Run post test hook
run: |
[ -f .github/.ci.conf ] && . .github/.ci.conf
[ -n "${POST_TEST_HOOK}" ] && ${POST_TEST_HOOK}
- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
Expand All @@ -60,11 +70,6 @@ jobs:
path: /tmp/gotest.log
if-no-files-found: error

- name: Run TEST_HOOK
run: |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi
if [ -n "${TEST_HOOK}" ]; then ${TEST_HOOK}; fi
- uses: codecov/codecov-action@v3
with:
name: codecov-umbrella
Expand Down

0 comments on commit c590001

Please sign in to comment.