Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set report name in artifact #3

Merged
merged 2 commits into from
Nov 27, 2023
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
22 changes: 11 additions & 11 deletions .github/workflows/go-test-multiplatform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,23 @@ jobs:
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@latest

- name: Set report filename
id: set-report-filename
run: echo "REPORT_FILENAME=$(date +'%Y%m%d%H%M')_packer_test_report.xml" >> $GITHUB_ENV

- name: Run integration tests
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_packer_test_report.xml"
echo "Testing with Go ${{ needs.get-go-version.outputs.go-version }}"
if ! go test -race -count 1 ./... -timeout=3m | go-junit-report -set-exit-code > "$report_filename"; then
if ! go test -race -count 1 ./... -timeout=3m | go-junit-report -set-exit-code > "$REPORT_FILENAME"; then
echo "EXIT_STATUS=1" >> $GITHUB_ENV
fi
cat "$report_filename"
cat "$REPORT_FILENAME"

- name: Upload test report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test-reports
path: ${{ github.workspace }}/${timestamp}_packer_test_report.xml
path: ${{ github.workspace }}/$REPORT_FILENAME

- name: Test Execution Status Handler
run: |
Expand All @@ -107,7 +109,7 @@ jobs:

# Download the artifact generated by the 'linux-go-tests' job
- name: Download test report
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: test-reports

Expand All @@ -125,18 +127,16 @@ jobs:
# Add additional information to XML report
- name: Add additional information to XML report
run: |
filename=$(ls test-reports | grep -E '^[0-9]{12}_packer_test_report\.xml$')
python scripts/add_to_xml_test_report.py \
--branch_name "${{ env.RELEASE_VERSION }}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
--xmlfile "test-reports/${filename}"
--xmlfile "test-reports/$REPORT_FILENAME"

# Upload test results to the bucket
- name: Upload test results to bucket
run: |
report_filename=$(ls test-reports | grep -E '^[0-9]{12}_packer_test_report\.xml$')
python3 scripts/test_report_upload_script.py "test-reports/${report_filename}"
python3 scripts/test_report_upload_script.py "test-reports/$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 }}
Expand Down
Loading