From 3aa8d09b86565d2f4f8c291b1d7a2366c6e3afb2 Mon Sep 17 00:00:00 2001 From: ykim-1 Date: Tue, 7 May 2024 16:19:44 -0700 Subject: [PATCH 1/3] replace test execution handler with conditional --- .github/workflows/ci.yml | 41 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 636ffbe1b..1120c8d62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,42 +55,25 @@ jobs: - name: Install go-junit-report run: go install github.com/jstemmer/go-junit-report/v2@latest + - name: Set report filename + run: echo "REPORT_FILENAME=$(date +'%Y%m%d%H%M')_linodego_test_report.xml" >> $GITHUB_ENV + - name: Run tests and save test report run: | - timestamp=$(date +'%Y%m%d%H%M') - report_filename="${timestamp}_linodego_test_report.xml" - - if ! make test | go-junit-report -set-exit-code > "$report_filename"; then - echo "EXIT_STATUS=1" >> $GITHUB_ENV - fi - cat "$report_filename" + make test | go-junit-report -set-exit-code -iocopy -out $REPORT_FILENAME env: SKIP_LINT: 1 - - name: Add additional information to XML report - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: | - filename=$(ls | grep -E '^[0-9]{12}_linodego_test_report\.xml$') - python tod_scripts/add_to_xml_test_report.py \ - --branch_name "${GITHUB_REF#refs/*/}" \ - --gha_run_id "$GITHUB_RUN_ID" \ - --gha_run_number "$GITHUB_RUN_NUMBER" \ - --xmlfile "${filename}" - - name: Upload test results to bucket - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + if: always() env: LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }} LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} run: | - report_filename=$(ls | grep -E '^[0-9]{12}_linodego_test_report\.xml$') - python tod_scripts/test_report_upload_script.py "${report_filename}" - - - name: Test Execution Status Handler - run: | - if [[ "$EXIT_STATUS" != 0 ]]; then - echo "Test execution contains failure(s)" - exit $EXIT_STATUS - else - echo "Tests passed!" - fi + python tod_scripts/add_to_xml_test_report.py \ + --branch_name "${GITHUB_REF#refs/*/}" \ + --gha_run_id "$GITHUB_RUN_ID" \ + --gha_run_number "$GITHUB_RUN_NUMBER" \ + --xmlfile "$REPORT_FILENAME" + sync + python tod_scripts/test_report_upload_script.py "$REPORT_FILENAME" From e1608e8f0a58a140b26230d4c756273bfcfb2075 Mon Sep 17 00:00:00 2001 From: ykim-1 Date: Tue, 7 May 2024 16:46:28 -0700 Subject: [PATCH 2/3] reorder env --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1120c8d62..c5f94f3c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,9 +66,6 @@ jobs: - name: Upload test results to bucket if: always() - env: - LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }} - LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} run: | python tod_scripts/add_to_xml_test_report.py \ --branch_name "${GITHUB_REF#refs/*/}" \ @@ -77,3 +74,6 @@ jobs: --xmlfile "$REPORT_FILENAME" sync python tod_scripts/test_report_upload_script.py "$REPORT_FILENAME" + env: + LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }} + LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} From 1e53afc786ae52bd7efa939fc06e7f4f369ec087 Mon Sep 17 00:00:00 2001 From: ykim-1 Date: Tue, 7 May 2024 17:13:17 -0700 Subject: [PATCH 3/3] forgot rules of this repo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5f94f3c6..96bbce942 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: SKIP_LINT: 1 - name: Upload test results to bucket - if: always() + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && always() run: | python tod_scripts/add_to_xml_test_report.py \ --branch_name "${GITHUB_REF#refs/*/}" \