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 }}
@@ -61,22 +61,27 @@ jobs:
61
61
echo "=========== Build status ==========="
62
62
if [[ "${status}" = "FAILED" ]]; then
63
63
echo "${{ github.event.repository.name }} build failed"
64
- echo "status=failed" >> "$GITHUB_OUTPUT"
65
- exit 1
64
+ exitCode=1
66
65
else
67
66
echo "${{ github.event.repository.name }} build success"
67
+ exitCode=0
68
68
fi
69
69
echo "=========== Generated build ==========="
70
70
ls dist/
71
71
echo "=========== Copy build to S3 ==========="
72
72
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
73
73
if [ $? -eq 0 ]; then
74
74
echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
75
- echo "status=success" >> "$GITHUB_OUTPUT"
76
75
else
77
76
echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
77
+ exitCode=1
78
+ fi
79
+ if [ ${exitCode} -eq 1 ]; then
78
80
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
80
85
fi
81
86
oldDate=`date --date='-2 month' +%Y%m%d`
82
87
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
@@ -87,40 +92,27 @@ jobs:
87
92
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl}
88
93
done
89
94
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 \
124
116
--instance "${TESTMO_URL}" \
125
117
--project-id ${{ inputs.testmo_project_id }} \
126
118
--name "${name}" \
0 commit comments