diff --git a/.github/workflows/metro_vision_ai_app_recipe_pull_request.yaml b/.github/workflows/metro_vision_ai_app_recipe_pull_request.yaml index 997a3aafa..726a8ecce 100644 --- a/.github/workflows/metro_vision_ai_app_recipe_pull_request.yaml +++ b/.github/workflows/metro_vision_ai_app_recipe_pull_request.yaml @@ -146,4 +146,12 @@ jobs: uses: actions/upload-artifact@v4 with: name: Trivy Report - Config scan for Helm - path: metro-ai-suite/metro-vision-ai-app-recipe/trivy-helm.txt \ No newline at end of file + path: metro-ai-suite/metro-vision-ai-app-recipe/trivy-helm.txt + sanity: + uses: ./.github/workflows/metro_vision_ai_app_recipe_sanity.yaml + with: + branch: ${{ github.head_ref }} + secrets: inherit + permissions: + contents: read + packages: write \ No newline at end of file diff --git a/.github/workflows/metro_vision_ai_app_recipe_sanity.yaml b/.github/workflows/metro_vision_ai_app_recipe_sanity.yaml new file mode 100644 index 000000000..d19dc153c --- /dev/null +++ b/.github/workflows/metro_vision_ai_app_recipe_sanity.yaml @@ -0,0 +1,108 @@ +name: "[metro-vision-ai-app-recipe] Sanity Workflow" + +on: + workflow_dispatch: # allows manual trigger + inputs: + branch: + description: "Branch to run job on" + required: false + default: "main" + + workflow_call: # allows being called from another workflow + inputs: + branch: + description: "Branch to run job on" + required: false + type: string + +jobs: + sanity: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + include: + - ubuntu_version: ubuntu22 + steps: + - name: Determine branch + id: get_branch + run: | + if [ -n "${{ inputs.branch }}" ]; then + echo "branch=${{ inputs.branch }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "branch=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + - name: Check out edge-ai-suites repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2 + with: + persist-credentials: false + path: edge-ai-suites-repo + ref: ${{ steps.get_branch.outputs.branch }} + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Log in to GitHub Container Registry + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #3.4.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt install -y python3-nose + + - name: Sanity Test + run: | + sudo apt-get update + sudo apt install -y python3-nose libxml2-utils vlc + pip3 install --upgrade pip --force-reinstall + echo "upgrading setuptools" + python3 -m pip install --upgrade pip setuptools + echo "installing selenium" + pip3 install robotframework + pip3 install --force-reinstall selenium + python3 -c "from selenium import webdriver; print('OK')" + cd edge-ai-suites-repo/metro-ai-suite/metro-vision-ai-app-recipe/test-suite/robot_files + pwd + ls -al + python3 -m robot --version + echo "Attempting to run Robot Framework with verbose output..." + mkdir -p /tmp/test_results + python3 -m robot test.robot || true + ls -al /tmp/test_results + ls -al + cp -r report.html log.html output.xml /tmp/test_results/ + passed=$(xmllint --xpath "//return/status[@status='PASS']" ./output.xml | wc -l) || true + failed=$(xmllint --xpath "//return/status[@status='FAIL']" ./output.xml | wc -l) || true + not_run=$(xmllint --xpath "//return/status[@status='NOT RUN']" ./output.xml | wc -l) || true + total=$((passed + failed + not_run)) + echo "### Sanity Test Summary" >> $GITHUB_STEP_SUMMARY + echo "- Total: $total" >> $GITHUB_STEP_SUMMARY + echo "- ✅ Passed: $passed" >> $GITHUB_STEP_SUMMARY + echo "- ❌ Failed: $failed" >> $GITHUB_STEP_SUMMARY + echo "- ⏭️ Not Run: $not_run" >> $GITHUB_STEP_SUMMARY + echo "- 📄 [Full Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY + - name: Upload Scan artifact to Github + if: always() + uses: actions/upload-artifact@v4 + with: + name: Sanity_Reports + path: /tmp/test_results/* + - name: Clean up + if: always() + run: | + sudo rm -rf edge-ai-suites-repo + if [ -n "$(docker images -aq)" ]; then + docker rmi -f $(docker images -aq) || true + fi + sudo rm -rf /tmp/test_results/* + + + diff --git a/.github/workflows/spineapp_sanity.yaml b/.github/workflows/spineapp_sanity.yaml index 41a0bf56d..63cb001c1 100644 --- a/.github/workflows/spineapp_sanity.yaml +++ b/.github/workflows/spineapp_sanity.yaml @@ -57,15 +57,12 @@ jobs: run: | sudo apt-get update sudo pip install robotframework - lspci | grep -i vga sudo apt install -y python3-nose libxml2-utils vlc cd edge-ai-suites-repo/manufacturing-ai-suite/industrial-edge-insights-vision/tests/robot_files - robot test.robot || true & - sleep 480 - docker logs dlstreamer-pipeline-server >> dlsps_logs.txt & - wait + robot test.robot + mkdir -p /tmp/test_results - cp -r report.html log.html output.xml dlsps_logs.txt /tmp/test_results/ + cp -r report.html log.html output.xml /tmp/test_results/ passed=$(xmllint --xpath "//return/status[@status='PASS']" ./output.xml | wc -l) || true failed=$(xmllint --xpath "//return/status[@status='FAIL']" ./output.xml | wc -l) || true not_run=$(xmllint --xpath "//return/status[@status='NOT RUN']" ./output.xml | wc -l) || true diff --git a/manufacturing-ai-suite/industrial-edge-insights-vision/tests/common_library/utils.py b/manufacturing-ai-suite/industrial-edge-insights-vision/tests/common_library/utils.py index 199918cd3..786a9419b 100644 --- a/manufacturing-ai-suite/industrial-edge-insights-vision/tests/common_library/utils.py +++ b/manufacturing-ai-suite/industrial-edge-insights-vision/tests/common_library/utils.py @@ -61,7 +61,10 @@ def docker_compose_up(self, value): self._update_env_file({ "HOST_IP": hostIP, "MTX_WEBRTCICESERVERS2_0_USERNAME": "test1234", - "MTX_WEBRTCICESERVERS2_0_PASSWORD": "test1234" + "MTX_WEBRTCICESERVERS2_0_PASSWORD": "test1234", + "MR_PSQL_PASSWORD": "test1234", + "MR_MINIO_ACCESS_KEY": "test1234", + "MR_MINIO_SECRET_KEY": "test1234" }) # Run setup and start services diff --git a/metro-ai-suite/metro-vision-ai-app-recipe/test-suite/testfile.txt b/metro-ai-suite/metro-vision-ai-app-recipe/test-suite/testfile.txt new file mode 100644 index 000000000..7b6b7afd8 --- /dev/null +++ b/metro-ai-suite/metro-vision-ai-app-recipe/test-suite/testfile.txt @@ -0,0 +1 @@ +test file will be deleted. \ No newline at end of file