diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 636ffbe1b..96bbce942 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' + - name: Upload test results to bucket + if: github.ref == 'refs/heads/main' && github.event_name == 'push' && always() 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' + --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 }} - 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