From 54fc1c175a3ff8949eb830a2e9895d00be054e9b Mon Sep 17 00:00:00 2001 From: kevkevinpal Date: Fri, 6 Dec 2024 11:47:00 -0500 Subject: [PATCH] feat: modfied action to take log and save it when error --- .github/workflows/prjob_tests.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prjob_tests.yml b/.github/workflows/prjob_tests.yml index 37e30b96e..68ea43369 100644 --- a/.github/workflows/prjob_tests.yml +++ b/.github/workflows/prjob_tests.yml @@ -39,7 +39,21 @@ jobs: run: go get golang.org/x/tools/cmd/cover - name: Tests - run: sudo V2_BOT_URL=http://localhost:3005 V2_BOT_TOKEN=xyzxyzxyz go test ./... -race -v -coverprofile=coverage.out && ./cover-check.sh coverage.out 8.4 + run: | + sudo V2_BOT_URL=http://localhost:3005 V2_BOT_TOKEN=xyzxyzxyz go test ./... -race -v -coverprofile=coverage.out > test_output.log 2>&1 + ./cover-check.sh coverage.out 8.4 + if [ -f "test_output.log" ]; then + sudo cat test_output.log + else + echo "Log file not found!" + fi + + - name: Upload test log + uses: actions/upload-artifact@v3 + if: failure() + with: + name: test-logs + path: test_output.log - name: Droping DB with docker compose run: docker compose -f ./docker/testdb-docker-compose.yml -p test_db down