Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 9 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The secrets of this repo is only available to main branch, hence above checks are required to get the workflow to pass on open PRs against main

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