Skip to content

[industrial-edge-insights-vision] Sanity Workflow #12

[industrial-edge-insights-vision] Sanity Workflow

[industrial-edge-insights-vision] Sanity Workflow #12

name: "[industrial-edge-insights-vision] 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
env:
INPUT_BRANCH: ${{ inputs.branch }}
EVENT_INPUTS_BRANCH: ${{ github.event.inputs.branch }}
REF_NAME: ${{ github.ref_name }}
run: |
if [ -n "$INPUT_BRANCH" ]; then
echo "branch=$INPUT_BRANCH" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "branch=$EVENT_INPUTS_BRANCH" >> $GITHUB_OUTPUT
else
echo "branch=$REF_NAME" >> $GITHUB_OUTPUT
fi
- name: Check out edge-ai-suites repository
uses: actions/checkout@v4 # v6.0.1
with:
persist-credentials: false
path: edge-ai-suites-repo
ref: ${{ steps.get_branch.outputs.branch }}
- name: Set up Python
uses: actions/setup-python@v4 #v5.3.0
with:
python-version: '3.10'
- name: Install Robot Framework with pip (cached)
run: pip3 install robotframework selenium PyYAML requests
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y python3-nose libxml2-utils vlc
- 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: Sanity Test
run: |
cd edge-ai-suites-repo/manufacturing-ai-suite/industrial-edge-insights-vision/tests/robot_files
robot test.robot || true
mkdir -p /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
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
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
with:
name: Sanity_Reports
path: /tmp/test_results/*
- name: Clean up
if: always()
run: |
sudo rm -rf /tmp/test_results/*