Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit f269c02

Browse files
dhuangnmdhuang
andauthored
fix issues for reporting and manual run (#382) (#383)
* fix issues for reporting and manual run * debug * more debugging * debugging * debugging * try fix * fix * fix and clean up * update name * minor fix --------- Co-authored-by: dhuang <[email protected]>
1 parent e9ad485 commit f269c02

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

.github/workflows/build-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- 'release/[0-9]+.[0-9]+'
7-
workflow_dispatch:
7+
workflow_dispatch:
88

99
jobs:
1010

.github/workflows/result.xml.fail

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuite name="BuildStatus" tests="1" failures="1" errors="1">
3+
<testcase name="BuildStatus">
4+
<failure message="build failed" type="Error"/>
5+
</testcase>
6+
</testsuite>

.github/workflows/result.xml.success

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuite name="BuildStatus" tests="1" failures="0" errors="0">
3+
<testcase name="BuildStatus">
4+
</testcase>
5+
</testsuite>

.github/workflows/util.yml

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121

2222
jobs:
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

Comments
 (0)