From 7b594e3b2c1ba7674e5ab5846980169fe0ef430f Mon Sep 17 00:00:00 2001 From: ykim-1 Date: Mon, 27 Nov 2023 11:17:45 -0800 Subject: [PATCH 1/2] set report name in artifact --- .github/workflows/go-test-multiplatform.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go-test-multiplatform.yml b/.github/workflows/go-test-multiplatform.yml index 0916870a..fc5ff4e7 100644 --- a/.github/workflows/go-test-multiplatform.yml +++ b/.github/workflows/go-test-multiplatform.yml @@ -72,12 +72,14 @@ 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" @@ -86,7 +88,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: test-reports - path: ${{ github.workspace }}/${timestamp}_packer_test_report.xml + path: ${{ github.workspace }}/$REPORT_FILENAME - name: Test Execution Status Handler run: | From 3fd099b9104ba2a09341fe79d23af19f5ef45ca8 Mon Sep 17 00:00:00 2001 From: ykim-1 Date: Mon, 27 Nov 2023 12:40:06 -0800 Subject: [PATCH 2/2] update upload/download version, remove grep when getting xml file name --- .github/workflows/go-test-multiplatform.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/go-test-multiplatform.yml b/.github/workflows/go-test-multiplatform.yml index fc5ff4e7..a2da5d4f 100644 --- a/.github/workflows/go-test-multiplatform.yml +++ b/.github/workflows/go-test-multiplatform.yml @@ -82,10 +82,10 @@ jobs: 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 }}/$REPORT_FILENAME @@ -109,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 @@ -127,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 }}