21
21
22
22
jobs :
23
23
24
- BUILD :
24
+ BUILD_AND_REPORT :
25
25
runs-on : ${{ inputs.runs_on }}
26
26
outputs :
27
27
status : ${{ steps.build.outputs.status }}
@@ -77,11 +77,16 @@ jobs:
77
77
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
78
78
if [ $? -eq 0 ]; then
79
79
echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
80
- echo "status=success" >> "$GITHUB_OUTPUT"
81
80
else
82
81
echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
82
+ exitCode=1
83
+ fi
84
+ if [ ${exitCode} -eq 1 ]; then
83
85
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
85
90
fi
86
91
oldDate=`date --date='-2 month' +%Y%m%d`
87
92
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
@@ -92,44 +97,30 @@ jobs:
92
97
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl}
93
98
done
94
99
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 \
129
121
--instance "${TESTMO_URL}" \
130
122
--project-id ${{ inputs.testmo_project_id }} \
131
123
--name "${name}" \
132
124
--source "${{ github.event.repository.name }}" \
133
125
--results result.xml \
134
126
-- bash result.sh
135
-
0 commit comments