From 9a464d94562b5b26e7da058d578c490117bde00c Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Wed, 12 Jun 2024 11:28:49 -0700 Subject: [PATCH] Fix GHA upload-test-results (#6091) ## What changed? Separate test execution and test result upload. And check XML file exists. Previously introduced here https://github.com/temporalio/temporal/pull/6049 ## Why? make aborts execution when the previous target fails. Oops. ## How did you test it? Scenarios: - [x] no Buildkite secret set - [x] make target has test errors - [x] make target has no test errors - [x] make target aborts (no XML file written) ## Potential risks ## Documentation ## Is hotfix candidate? --- .github/workflows/run-tests.yml | 24 ++++++++++++++++++++---- develop/upload-test-results.sh | 25 +++++++++++++------------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index de18e73205..837df9644d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -90,7 +90,11 @@ jobs: - name: Run unit test timeout-minutes: 15 - run: make unit-test-coverage upload-test-results + run: make unit-test-coverage + + - name: Upload test results + if: ${{ !cancelled() }} + run: make upload-test-results integration-test: name: Integration test @@ -121,7 +125,11 @@ jobs: - name: Run integration test timeout-minutes: 15 - run: make integration-test-coverage upload-test-results + run: make integration-test-coverage + + - name: Upload test results + if: ${{ !cancelled() }} + run: make upload-test-results - name: Tear down docker compose if: ${{ always() }} @@ -190,7 +198,11 @@ jobs: - name: Run functional test timeout-minutes: 25 - run: make functional-test-coverage upload-test-results + run: make functional-test-coverage + + - name: Upload test results + if: ${{ !cancelled() }} + run: make upload-test-results - name: Tear down docker compose if: ${{ always() }} @@ -253,7 +265,11 @@ jobs: - name: Run functional test xdc timeout-minutes: 15 - run: make functional-test-xdc-coverage upload-test-results + run: make functional-test-xdc-coverage + + - name: Upload test results + if: ${{ !cancelled() }} + run: make upload-test-results - name: Tear down docker compose if: ${{ always() }} diff --git a/develop/upload-test-results.sh b/develop/upload-test-results.sh index 4162abdadf..47eec2b3f4 100644 --- a/develop/upload-test-results.sh +++ b/develop/upload-test-results.sh @@ -8,17 +8,18 @@ fi echo "uploading test results from $(pwd)" for file in *.junit.xml; do - echo "uploading ${file}" + [ -e "$file" ] || continue + echo "uploading ${file}" - curl -i -X POST \ - -H "Authorization: Token token=${BUILDKITE_ANALYTICS_TOKEN}" \ - -F "data=@${file}" \ - -F "format=junit" \ - -F "run_env[CI]=github_actions" \ - -F "run_env[key]=${GITHUB_ACTION}-${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ATTEMPT}" \ - -F "run_env[number]=${GITHUB_RUN_NUMBER}" \ - -F "run_env[branch]=${GITHUB_REF}" \ - -F "run_env[commit_sha]=${GITHUB_SHA}" \ - -F "run_env[url]=https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \ - https://analytics-api.buildkite.com/v1/uploads + curl -i -X POST \ + -H "Authorization: Token token=${BUILDKITE_ANALYTICS_TOKEN}" \ + -F "data=@${file}" \ + -F "format=junit" \ + -F "run_env[CI]=github_actions" \ + -F "run_env[key]=${GITHUB_ACTION}-${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ATTEMPT}" \ + -F "run_env[number]=${GITHUB_RUN_NUMBER}" \ + -F "run_env[branch]=${GITHUB_REF}" \ + -F "run_env[commit_sha]=${GITHUB_SHA}" \ + -F "run_env[url]=https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \ + https://analytics-api.buildkite.com/v1/uploads done \ No newline at end of file