2121
2222jobs :
2323
24- BUILD :
24+ BUILD_AND_REPORT :
2525 runs-on : ${{ inputs.runs_on }}
2626 outputs :
2727 status : ${{ steps.build.outputs.status }}
@@ -61,22 +61,27 @@ jobs:
6161 echo "=========== Build status ==========="
6262 if [[ "${status}" = "FAILED" ]]; then
6363 echo "${{ github.event.repository.name }} build failed"
64- echo "status=failed" >> "$GITHUB_OUTPUT"
65- exit 1
64+ exitCode=1
6665 else
6766 echo "${{ github.event.repository.name }} build success"
67+ exitCode=0
6868 fi
6969 echo "=========== Generated build ==========="
7070 ls dist/
7171 echo "=========== Copy build to S3 ==========="
7272 aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
7373 if [ $? -eq 0 ]; then
7474 echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
75- echo "status=success" >> "$GITHUB_OUTPUT"
7675 else
7776 echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
77+ exitCode=1
78+ fi
79+ if [ ${exitCode} -eq 1 ]; then
7880 echo "status=failed" >> "$GITHUB_OUTPUT"
79- exit 1
81+ cp .github/workflows/result.xml.fail result.xml
82+ else
83+ echo "status=success" >> "$GITHUB_OUTPUT"
84+ cp .github/workflows/result.xml.success result.xml
8085 fi
8186 oldDate=`date --date='-2 month' +%Y%m%d`
8287 oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
@@ -87,40 +92,27 @@ jobs:
8792 aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl}
8893 done
8994 fi
90-
91- TESTMO :
92- if : success() || failure()
93- needs : BUILD
94- runs-on : ${{ inputs.runs_on }}
95- steps :
96-
97- - id : report
98- run : |
99- echo "node: $(node -v)"
100- echo "npm: $(npm -v)"
101- echo "Installing testmo cli..."
102- sudo npm install -g @testmo/testmo-cli
103- export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
104- TESTMO_URL="https://neuralmagic.testmo.net"
105- todaytime=`date +%Y%m%d`
106- name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${{ needs.BUILD.outputs.commitid }} RunID:${{ inputs.run_id }}"
107- echo "========== Build info ==========="
108- echo "name: ${name}"
109- echo "build status: ${{ needs.BUILD.outputs.status }}"
110- echo "<status>${{ needs.BUILD.outputs.status }}</status>" > result.xml
111- exit_code=1
112- if [[ "${{ needs.BUILD.outputs.status }}" = "success" ]]; then
113- exit_code=0
114- fi
115- 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
116- echo "========== Report to testmo ==========="
117- echo "testmo automation:run:submit \\"
118- echo " --instance ${TESTMO_URL} \\"
119- echo " --project-id ${{ inputs.testmo_project_id }} \\"
120- echo " --name ${name} \\"
121- echo " --source ${{ github.event.repository.name }} \\"
122- echo " --results result.xml"
123- testmo automation:run:submit \
95+ # TESTMO
96+ echo "node: $(node -v)"
97+ echo "npm: $(npm -v)"
98+ echo "Installing testmo cli..."
99+ sudo npm install -g @testmo/testmo-cli
100+ export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
101+ TESTMO_URL="https://neuralmagic.testmo.net"
102+ todaytime=`date +%Y%m%d`
103+ name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${GITHUB_SHA:0:7} RunID:${{ inputs.run_id }}"
104+ echo "========== Build info ==========="
105+ echo "name: ${name}"
106+ echo "build: $GITHUB_OUTPUT"
107+ echo "echo \"GHA job $GITHUB_OUTPUT: https://github.com/neuralmagic/${{ github.event.repository.name }}/actions/runs/${{ inputs.run_id }}\"; exit ${exitCode}" > result.sh
108+ echo "========== Report to testmo ==========="
109+ echo "testmo automation:run:submit \\"
110+ echo " --instance ${TESTMO_URL} \\"
111+ echo " --project-id ${{ inputs.testmo_project_id }} \\"
112+ echo " --name ${name} \\"
113+ echo " --source ${{ github.event.repository.name }} \\"
114+ echo " --results result.xml"
115+ testmo automation:run:submit \
124116 --instance "${TESTMO_URL}" \
125117 --project-id ${{ inputs.testmo_project_id }} \
126118 --name "${name}" \
0 commit comments