From 781b363aac854c63845248188632f3a200d05ce5 Mon Sep 17 00:00:00 2001 From: dhuangnm <74931910+dhuangnm@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:58:40 -0400 Subject: [PATCH] fix reporting and manual run issues (#241) (#243) Co-authored-by: dhuang --- .github/workflows/build-release.yml | 2 +- .github/workflows/result.xml.fail | 6 +++ .github/workflows/result.xml.success | 5 +++ .github/workflows/util.yml | 66 ++++++++++++---------------- 4 files changed, 41 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/result.xml.fail create mode 100644 .github/workflows/result.xml.success diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 66479aebfd26..865e3021d2f2 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -4,7 +4,7 @@ on: push: branches: - 'release/[0-9]+.[0-9]+' - workflow_dispatch: + workflow_dispatch: jobs: diff --git a/.github/workflows/result.xml.fail b/.github/workflows/result.xml.fail new file mode 100644 index 000000000000..948fd30902b4 --- /dev/null +++ b/.github/workflows/result.xml.fail @@ -0,0 +1,6 @@ + + + + + + diff --git a/.github/workflows/result.xml.success b/.github/workflows/result.xml.success new file mode 100644 index 000000000000..d7608df3006e --- /dev/null +++ b/.github/workflows/result.xml.success @@ -0,0 +1,5 @@ + + + + + diff --git a/.github/workflows/util.yml b/.github/workflows/util.yml index 0ba3917635cc..c35e625d8eb1 100644 --- a/.github/workflows/util.yml +++ b/.github/workflows/util.yml @@ -21,7 +21,7 @@ on: jobs: - BUILD: + BUILD_AND_REPORT: runs-on: ${{ inputs.runs_on }} outputs: status: ${{ steps.build.outputs.status }} @@ -71,11 +71,16 @@ jobs: aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/ if [ $? -eq 0 ]; then echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/" - echo "status=success" >> "$GITHUB_OUTPUT" else echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/" + exitCode=1 + fi + if [ ${exitCode} -eq 1 ]; then echo "status=failed" >> "$GITHUB_OUTPUT" - exit 1 + cp .github/workflows/result.xml.fail result.xml + else + echo "status=success" >> "$GITHUB_OUTPUT" + cp .github/workflows/result.xml.success result.xml fi oldDate=`date --date='-2 month' +%Y%m%d` oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"` @@ -86,40 +91,27 @@ jobs: aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl} done fi - - TESTMO: - if: success() || failure() - needs: BUILD - runs-on: ${{ inputs.runs_on }} - steps: - - - id: report - run: | - echo "node: $(node -v)" - echo "npm: $(npm -v)" - echo "Installing testmo cli..." - sudo npm install -g @testmo/testmo-cli - export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }} - TESTMO_URL="https://neuralmagic.testmo.net" - todaytime=`date +%Y%m%d` - name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${{ needs.BUILD.outputs.commitid }} RunID:${{ inputs.run_id }}" - echo "========== Build info ===========" - echo "name: ${name}" - echo "build status: ${{ needs.BUILD.outputs.status }}" - echo "${{ needs.BUILD.outputs.status }}" > result.xml - exit_code=1 - if [[ "${{ needs.BUILD.outputs.status }}" = "success" ]]; then - exit_code=0 - fi - echo "echo \"GHA job ${{ needs.BUILD.outputs.status }}: https://github.com/neuralmagic/${{ github.event.repository.name }}/actions/runs/${{ inputs.run_id }}\"; exit ${exit_code}" > result.sh - echo "========== Report to testmo ===========" - echo "testmo automation:run:submit \\" - echo " --instance ${TESTMO_URL} \\" - echo " --project-id ${{ inputs.testmo_project_id }} \\" - echo " --name ${name} \\" - echo " --source ${{ github.event.repository.name }} \\" - echo " --results result.xml" - testmo automation:run:submit \ + # TESTMO + echo "node: $(node -v)" + echo "npm: $(npm -v)" + echo "Installing testmo cli..." + sudo npm install -g @testmo/testmo-cli + export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }} + TESTMO_URL="https://neuralmagic.testmo.net" + todaytime=`date +%Y%m%d` + name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${GITHUB_SHA:0:7} RunID:${{ inputs.run_id }}" + echo "========== Build info ===========" + echo "name: ${name}" + echo "build: $GITHUB_OUTPUT" + echo "echo \"GHA job $GITHUB_OUTPUT: https://github.com/neuralmagic/${{ github.event.repository.name }}/actions/runs/${{ inputs.run_id }}\"; exit ${exitCode}" > result.sh + echo "========== Report to testmo ===========" + echo "testmo automation:run:submit \\" + echo " --instance ${TESTMO_URL} \\" + echo " --project-id ${{ inputs.testmo_project_id }} \\" + echo " --name ${name} \\" + echo " --source ${{ github.event.repository.name }} \\" + echo " --results result.xml" + testmo automation:run:submit \ --instance "${TESTMO_URL}" \ --project-id ${{ inputs.testmo_project_id }} \ --name "${name}" \