-
Notifications
You must be signed in to change notification settings - Fork 113
101 lines (95 loc) · 3.94 KB
/
dlsps_sanity_test.yaml
File metadata and controls
101 lines (95 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: "[DLSPS] PR Sanity workflow"
run-name: "[DLSPS] PR Sanity workflow (by @${{ github.actor }} via ${{ github.event_name }})"
on:
workflow_call:
workflow_dispatch:
permissions: {}
jobs:
sanity:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- ubuntu_version: ubuntu22
steps:
- name: Check out edge-ai-libraries repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
path: edge-ai-libraries-repo
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.10'
- name: Log in to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Sanity Test
run: |
sudo apt-get update
sudo pip install robotframework
sudo apt install -y python3-nose libxml2-utils vlc
cd edge-ai-libraries-repo/microservices/dlstreamer-pipeline-server/tests/scripts/utils/
chmod a+x stream_rtsp.sh
ip_addr=`hostname -I | awk '{print $1}'`
echo "starting rtsp servers"
echo $ip_addr
./stream_rtsp.sh start 10 `pwd`/../../../resources/videos/warehouse.avi $ip_addr
sleep 10
cd ${{github.workspace}}
cd edge-ai-libraries-repo/microservices/dlstreamer-pipeline-server/tests/scripts/robot_files
robot test_main_sanity.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))
executed=$((passed + failed))
pass_rate="N/A"
execution_rate="N/A"
if [ "$executed" -gt 0 ]; then
pass_rate=$(awk -v p="$passed" -v e="$executed" 'BEGIN { printf "%.2f%%", (p / e) * 100 }')
fi
if [ "$total" -gt 0 ]; then
execution_rate=$(awk -v e="$executed" -v t="$total" 'BEGIN { printf "%.2f%%", (e / t) * 100 }')
fi
echo "### Sanity Test Summary" >> $GITHUB_STEP_SUMMARY
echo "- Total: $total" >> $GITHUB_STEP_SUMMARY
if [ "$passed" -gt 0 ]; then
echo "- ✅ Passed: $passed" >> $GITHUB_STEP_SUMMARY
fi
if [ "$failed" -gt 0 ]; then
echo "- ❌ Failed: $failed" >> $GITHUB_STEP_SUMMARY
fi
if [ "$not_run" -gt 0 ]; then
echo "- ⏭️ Not Run: $not_run" >> $GITHUB_STEP_SUMMARY
fi
echo "Pass Rate: $pass_rate" >> $GITHUB_STEP_SUMMARY
echo "Execution Rate: $execution_rate" >> $GITHUB_STEP_SUMMARY
echo "📄 [Full Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
echo "stopping rtsp servers"
cd ${{github.workspace}}
cd edge-ai-libraries-repo/microservices/dlstreamer-pipeline-server/tests/scripts/utils/
cp -r cvlc_* /tmp/test_results/
./stream_rtsp.sh stop
- name: Upload Scan artifact to Github
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: DLSPS_Sanity-tests-reports
path: /tmp/test_results/*
- name: Clean up
if: always()
run: |
sudo rm -rf edge-ai-libraries-repo
if [ -n "$(docker images -aq)" ]; then
docker rmi -f $(docker images -aq) || true
fi
sudo rm -rf /tmp/test_results/*