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

Cherry-pick: fix issues for reporting and manual run (#382) #383

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- 'release/[0-9]+.[0-9]+'
workflow_dispatch:
workflow_dispatch:

jobs:

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/result.xml.fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="BuildStatus" tests="1" failures="1" errors="1">
<testcase name="BuildStatus">
<failure message="build failed" type="Error"/>
</testcase>
</testsuite>
5 changes: 5 additions & 0 deletions .github/workflows/result.xml.success
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="BuildStatus" tests="1" failures="0" errors="0">
<testcase name="BuildStatus">
</testcase>
</testsuite>
70 changes: 31 additions & 39 deletions .github/workflows/util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:

jobs:

BUILD:
BUILD_AND_REPORT:
runs-on: ${{ inputs.runs_on }}
outputs:
status: ${{ steps.build.outputs.status }}
Expand Down Expand Up @@ -61,22 +61,27 @@ jobs:
echo "=========== Build status ==========="
if [[ "${status}" = "FAILED" ]]; then
echo "${{ github.event.repository.name }} build failed"
echo "status=failed" >> "$GITHUB_OUTPUT"
exit 1
exitCode=1
else
echo "${{ github.event.repository.name }} build success"
exitCode=0
fi
echo "=========== Generated build ==========="
ls dist/
echo "=========== Copy build to S3 ==========="
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
if [ $? -eq 0 ]; then
echo "ok: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
echo "status=success" >> "$GITHUB_OUTPUT"
else
echo "failed: copied to s3://nm-github-actions/${{ github.event.repository.name }}/"
exitCode=1
fi
if [ ${exitCode} -eq 1 ]; then
echo "status=failed" >> "$GITHUB_OUTPUT"
exit 1
cp .github/workflows/result.xml.fail result.xml
else
echo "status=success" >> "$GITHUB_OUTPUT"
cp .github/workflows/result.xml.success result.xml
fi
oldDate=`date --date='-2 month' +%Y%m%d`
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
Expand All @@ -87,40 +92,27 @@ jobs:
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl}
done
fi

TESTMO:
if: success() || failure()
needs: BUILD
runs-on: ${{ inputs.runs_on }}
steps:

- id: report
run: |
echo "node: $(node -v)"
echo "npm: $(npm -v)"
echo "Installing testmo cli..."
sudo npm install -g @testmo/testmo-cli
export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
TESTMO_URL="https://neuralmagic.testmo.net"
todaytime=`date +%Y%m%d`
name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${{ needs.BUILD.outputs.commitid }} RunID:${{ inputs.run_id }}"
echo "========== Build info ==========="
echo "name: ${name}"
echo "build status: ${{ needs.BUILD.outputs.status }}"
echo "<status>${{ needs.BUILD.outputs.status }}</status>" > result.xml
exit_code=1
if [[ "${{ needs.BUILD.outputs.status }}" = "success" ]]; then
exit_code=0
fi
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
echo "========== Report to testmo ==========="
echo "testmo automation:run:submit \\"
echo " --instance ${TESTMO_URL} \\"
echo " --project-id ${{ inputs.testmo_project_id }} \\"
echo " --name ${name} \\"
echo " --source ${{ github.event.repository.name }} \\"
echo " --results result.xml"
testmo automation:run:submit \
# TESTMO
echo "node: $(node -v)"
echo "npm: $(npm -v)"
echo "Installing testmo cli..."
sudo npm install -g @testmo/testmo-cli
export TESTMO_TOKEN=${{ secrets.TESTMO_TEST_TOKEN }}
TESTMO_URL="https://neuralmagic.testmo.net"
todaytime=`date +%Y%m%d`
name="${{ github.event.repository.name }} ${{ inputs.build_type }} ${todaytime} ${GITHUB_SHA:0:7} RunID:${{ inputs.run_id }}"
echo "========== Build info ==========="
echo "name: ${name}"
echo "build: $GITHUB_OUTPUT"
echo "echo \"GHA job $GITHUB_OUTPUT: https://github.com/neuralmagic/${{ github.event.repository.name }}/actions/runs/${{ inputs.run_id }}\"; exit ${exitCode}" > result.sh
echo "========== Report to testmo ==========="
echo "testmo automation:run:submit \\"
echo " --instance ${TESTMO_URL} \\"
echo " --project-id ${{ inputs.testmo_project_id }} \\"
echo " --name ${name} \\"
echo " --source ${{ github.event.repository.name }} \\"
echo " --results result.xml"
testmo automation:run:submit \
--instance "${TESTMO_URL}" \
--project-id ${{ inputs.testmo_project_id }} \
--name "${name}" \
Expand Down