|
| 1 | +name: "[metro-vision-ai-app-recipe] Sanity Workflow" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # allows manual trigger |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: "Branch to run job on" |
| 8 | + required: false |
| 9 | + default: "main" |
| 10 | + |
| 11 | + workflow_call: # allows being called from another workflow |
| 12 | + inputs: |
| 13 | + branch: |
| 14 | + description: "Branch to run job on" |
| 15 | + required: false |
| 16 | + type: string |
| 17 | + |
| 18 | +jobs: |
| 19 | + sanity: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + contents: read |
| 23 | + packages: write |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - ubuntu_version: ubuntu22 |
| 29 | + steps: |
| 30 | + - name: Determine branch |
| 31 | + id: get_branch |
| 32 | + run: | |
| 33 | + if [ -n "${{ inputs.branch }}" ]; then |
| 34 | + echo "branch=${{ inputs.branch }}" >> $GITHUB_OUTPUT |
| 35 | + elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then |
| 36 | + echo "branch=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT |
| 37 | + else |
| 38 | + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT |
| 39 | + fi |
| 40 | + - name: Check out edge-ai-suites repository |
| 41 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2 |
| 42 | + with: |
| 43 | + persist-credentials: false |
| 44 | + path: edge-ai-suites-repo |
| 45 | + ref: ${{ steps.get_branch.outputs.branch }} |
| 46 | + - name: Set up Python |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: '3.10' |
| 50 | + - name: Log in to GitHub Container Registry |
| 51 | + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #3.4.0 |
| 52 | + with: |
| 53 | + registry: ghcr.io |
| 54 | + username: ${{ github.actor }} |
| 55 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + - name: Sanity Test |
| 57 | + run: | |
| 58 | + sudo apt-get update |
| 59 | + sudo pip install robotframework |
| 60 | + lspci | grep -i vga |
| 61 | + sudo apt install -y python3-nose libxml2-utils vlc |
| 62 | + sudo pip install selenium |
| 63 | + cd edge-ai-suites-repo/metro-ai-suite/metro-vision-ai-app-recipe/test-suite/robot_files |
| 64 | + robot test.robot || true & |
| 65 | + sleep 480 |
| 66 | + docker logs dlstreamer-pipeline-server >> dlsps_logs.txt & |
| 67 | + wait |
| 68 | + mkdir -p /tmp/test_results |
| 69 | + cp -r report.html log.html output.xml dlsps_logs.txt /tmp/test_results/ |
| 70 | + passed=$(xmllint --xpath "//return/status[@status='PASS']" ./output.xml | wc -l) || true |
| 71 | + failed=$(xmllint --xpath "//return/status[@status='FAIL']" ./output.xml | wc -l) || true |
| 72 | + not_run=$(xmllint --xpath "//return/status[@status='NOT RUN']" ./output.xml | wc -l) || true |
| 73 | + total=$((passed + failed + not_run)) |
| 74 | + echo "### Sanity Test Summary" >> $GITHUB_STEP_SUMMARY |
| 75 | + echo "- Total: $total" >> $GITHUB_STEP_SUMMARY |
| 76 | + echo "- ✅ Passed: $passed" >> $GITHUB_STEP_SUMMARY |
| 77 | + echo "- ❌ Failed: $failed" >> $GITHUB_STEP_SUMMARY |
| 78 | + echo "- ⏭️ Not Run: $not_run" >> $GITHUB_STEP_SUMMARY |
| 79 | + echo "- 📄 [Full Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY |
| 80 | + - name: Helm Sanity Test |
| 81 | + run: | |
| 82 | + sudo apt-get update |
| 83 | + sudo pip install robotframework |
| 84 | + lspci | grep -i vga |
| 85 | + sudo apt install -y python3-nose libxml2-utils vlc |
| 86 | + cd edge-ai-suites-repo/metro-ai-suite/metro-vision-ai-app-recipe/test-suite/robot_files |
| 87 | + robot test_helm.robot || true & |
| 88 | + sleep 480 |
| 89 | + docker logs dlstreamer-pipeline-server >> dlsps_logs.txt & |
| 90 | + wait |
| 91 | + mkdir -p /tmp/test_results/Helm |
| 92 | + cp -r report.html log.html output.xml dlsps_logs.txt /tmp/test_results/Helm |
| 93 | + passed=$(xmllint --xpath "//return/status[@status='PASS']" ./output.xml | wc -l) || true |
| 94 | + failed=$(xmllint --xpath "//return/status[@status='FAIL']" ./output.xml | wc -l) || true |
| 95 | + not_run=$(xmllint --xpath "//return/status[@status='NOT RUN']" ./output.xml | wc -l) || true |
| 96 | + total=$((passed + failed + not_run)) |
| 97 | + echo "### Sanity Test Summary" >> $GITHUB_STEP_SUMMARY |
| 98 | + echo "- Total: $total" >> $GITHUB_STEP_SUMMARY |
| 99 | + echo "- ✅ Passed: $passed" >> $GITHUB_STEP_SUMMARY |
| 100 | + echo "- ❌ Failed: $failed" >> $GITHUB_STEP_SUMMARY |
| 101 | + echo "- ⏭️ Not Run: $not_run" >> $GITHUB_STEP_SUMMARY |
| 102 | + echo "- 📄 [Full Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY |
| 103 | + - name: Upload Scan artifact to Github |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: Sanity_Reports |
| 107 | + path: /tmp/test_results/* |
| 108 | + - name: Clean up |
| 109 | + if: always() |
| 110 | + run: | |
| 111 | + sudo rm -rf edge-ai-suites-repo |
| 112 | + if [ -n "$(docker images -aq)" ]; then |
| 113 | + docker rmi -f $(docker images -aq) || true |
| 114 | + fi |
| 115 | + sudo rm -rf /tmp/test_results/* |
| 116 | +
|
| 117 | +
|
| 118 | +
|
0 commit comments