From c590001e9d305271404620e5c58dfb7db7335a13 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 19 Apr 2023 16:45:30 +0200 Subject: [PATCH] Add support for {PRE,POST}_TEST_HOOKs --- .github/workflows/test-wasm.reusable.yml | 6 ++++-- .github/workflows/test.reusable.yml | 17 +++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-wasm.reusable.yml b/.github/workflows/test-wasm.reusable.yml index 0a6a7a6..14e50aa 100644 --- a/.github/workflows/test-wasm.reusable.yml +++ b/.github/workflows/test-wasm.reusable.yml @@ -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 ./... diff --git a/.github/workflows/test.reusable.yml b/.github/workflows/test.reusable.yml index b67341a..b02f9c2 100644 --- a/.github/workflows/test.reusable.yml +++ b/.github/workflows/test.reusable.yml @@ -41,10 +41,15 @@ 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 ./... -- \ @@ -52,6 +57,11 @@ jobs: -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() @@ -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