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

Commit 1e16957

Browse files
dhuangnmdhuang
andauthored
fix issues for reporting and manual run (#288) (#289)
* fix reporting and manual run issues * add files * fix another bug --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local>
1 parent cb3e6f4 commit 1e16957

File tree

4 files changed

+41
-39
lines changed

4 files changed

+41
-39
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: 29 additions & 38 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 }}
@@ -77,11 +77,16 @@ jobs:
7777
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
7878
if [ $? -eq 0 ]; then
7979
echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
80-
echo "status=success" >> "$GITHUB_OUTPUT"
8180
else
8281
echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
82+
exitCode=1
83+
fi
84+
if [ ${exitCode} -eq 1 ]; then
8385
echo "status=failed" >> "$GITHUB_OUTPUT"
84-
exit 1
86+
cp .github/workflows/result.xml.fail result.xml
87+
else
88+
echo "status=success" >> "$GITHUB_OUTPUT"
89+
cp .github/workflows/result.xml.success result.xml
8590
fi
8691
oldDate=`date --date='-2 month' +%Y%m%d`
8792
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
@@ -92,44 +97,30 @@ jobs:
9297
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl}
9398
done
9499
fi
95-
96-
TESTMO:
97-
if: success() || failure()
98-
needs: BUILD
99-
runs-on: ${{ inputs.runs_on }}
100-
steps:
101-
102-
- id: report
103-
run: |
104-
echo "node: $(node -v)"
105-
echo "npm: $(npm -v)"
106-
echo "Installing testmo cli..."
107-
sudo npm install -g @testmo/testmo-cli
108-
export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
109-
TESTMO_URL="https://neuralmagic.testmo.net"
110-
todaytime=`date +%Y%m%d`
111-
name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${{ needs.BUILD.outputs.commitid }} RunID:${{ inputs.run_id }}"
112-
echo "========== Build info ==========="
113-
echo "name: ${name}"
114-
echo "build status: ${{ needs.BUILD.outputs.status }}"
115-
echo "<status>${{ needs.BUILD.outputs.status }}</status>" > result.xml
116-
exit_code=1
117-
if [[ "${{ needs.BUILD.outputs.status }}" = "success" ]]; then
118-
exit_code=0
119-
fi
120-
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
121-
echo "========== Report to testmo ==========="
122-
echo "testmo automation:run:submit \\"
123-
echo " --instance ${TESTMO_URL} \\"
124-
echo " --project-id ${{ inputs.testmo_project_id }} \\"
125-
echo " --name ${name} \\"
126-
echo " --source ${{ github.event.repository.name }} \\"
127-
echo " --results result.xml"
128-
testmo automation:run:submit \
100+
# TESTMO
101+
echo "node: $(node -v)"
102+
echo "npm: $(npm -v)"
103+
echo "Installing testmo cli..."
104+
sudo npm install -g @testmo/testmo-cli
105+
export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
106+
TESTMO_URL="https://neuralmagic.testmo.net"
107+
todaytime=`date +%Y%m%d`
108+
name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${GITHUB_SHA:0:7} RunID:${{ inputs.run_id }}"
109+
echo "========== Build info ==========="
110+
echo "name: ${name}"
111+
echo "build: $GITHUB_OUTPUT"
112+
echo "echo \"GHA job $GITHUB_OUTPUT: https://github.com/neuralmagic/${{ github.event.repository.name }}/actions/runs/${{ inputs.run_id }}\"; exit ${exitCode}" > result.sh
113+
echo "========== Report to testmo ==========="
114+
echo "testmo automation:run:submit \\"
115+
echo " --instance ${TESTMO_URL} \\"
116+
echo " --project-id ${{ inputs.testmo_project_id }} \\"
117+
echo " --name ${name} \\"
118+
echo " --source ${{ github.event.repository.name }} \\"
119+
echo " --results result.xml"
120+
testmo automation:run:submit \
129121
--instance "${TESTMO_URL}" \
130122
--project-id ${{ inputs.testmo_project_id }} \
131123
--name "${name}" \
132124
--source "${{ github.event.repository.name }}" \
133125
--results result.xml \
134126
-- bash result.sh
135-

0 commit comments

Comments
 (0)