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

Commit 90da138

Browse files
dhuangnmdhuang
andauthored
fix reporting and manual run issues (#241)
Co-authored-by: dhuang <[email protected]>
1 parent 3558e03 commit 90da138

File tree

4 files changed

+41
-38
lines changed

4 files changed

+41
-38
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>
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: 29 additions & 37 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 }}
@@ -71,11 +71,16 @@ jobs:
7171
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
7272
if [ $? -eq 0 ]; then
7373
echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
74-
echo "status=success" >> "$GITHUB_OUTPUT"
7574
else
7675
echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
76+
exitCode=1
77+
fi
78+
if [ ${exitCode} -eq 1 ]; then
7779
echo "status=failed" >> "$GITHUB_OUTPUT"
78-
exit 1
80+
cp .github/workflows/result.xml.fail result.xml
81+
else
82+
echo "status=success" >> "$GITHUB_OUTPUT"
83+
cp .github/workflows/result.xml.success result.xml
7984
fi
8085
oldDate=`date --date='-2 month' +%Y%m%d`
8186
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
@@ -86,40 +91,27 @@ jobs:
8691
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl}
8792
done
8893
fi
89-
90-
TESTMO:
91-
if: success() || failure()
92-
needs: BUILD
93-
runs-on: ${{ inputs.runs_on }}
94-
steps:
95-
96-
- id: report
97-
run: |
98-
echo "node: $(node -v)"
99-
echo "npm: $(npm -v)"
100-
echo "Installing testmo cli..."
101-
sudo npm install -g @testmo/testmo-cli
102-
export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
103-
TESTMO_URL="https://neuralmagic.testmo.net"
104-
todaytime=`date +%Y%m%d`
105-
name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${{ needs.BUILD.outputs.commitid }} RunID:${{ inputs.run_id }}"
106-
echo "========== Build info ==========="
107-
echo "name: ${name}"
108-
echo "build status: ${{ needs.BUILD.outputs.status }}"
109-
echo "<status>${{ needs.BUILD.outputs.status }}</status>" > result.xml
110-
exit_code=1
111-
if [[ "${{ needs.BUILD.outputs.status }}" = "success" ]]; then
112-
exit_code=0
113-
fi
114-
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
115-
echo "========== Report to testmo ==========="
116-
echo "testmo automation:run:submit \\"
117-
echo " --instance ${TESTMO_URL} \\"
118-
echo " --project-id ${{ inputs.testmo_project_id }} \\"
119-
echo " --name ${name} \\"
120-
echo " --source ${{ github.event.repository.name }} \\"
121-
echo " --results result.xml"
122-
testmo automation:run:submit \
94+
# TESTMO
95+
echo "node: $(node -v)"
96+
echo "npm: $(npm -v)"
97+
echo "Installing testmo cli..."
98+
sudo npm install -g @testmo/testmo-cli
99+
export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
100+
TESTMO_URL="https://neuralmagic.testmo.net"
101+
todaytime=`date +%Y%m%d`
102+
name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${GITHUB_SHA:0:7} RunID:${{ inputs.run_id }}"
103+
echo "========== Build info ==========="
104+
echo "name: ${name}"
105+
echo "build: $GITHUB_OUTPUT"
106+
echo "echo \"GHA job $GITHUB_OUTPUT: https://github.com/neuralmagic/${{ github.event.repository.name }}/actions/runs/${{ inputs.run_id }}\"; exit ${exitCode}" > result.sh
107+
echo "========== Report to testmo ==========="
108+
echo "testmo automation:run:submit \\"
109+
echo " --instance ${TESTMO_URL} \\"
110+
echo " --project-id ${{ inputs.testmo_project_id }} \\"
111+
echo " --name ${name} \\"
112+
echo " --source ${{ github.event.repository.name }} \\"
113+
echo " --results result.xml"
114+
testmo automation:run:submit \
123115
--instance "${TESTMO_URL}" \
124116
--project-id ${{ inputs.testmo_project_id }} \
125117
--name "${name}" \

0 commit comments

Comments
 (0)