-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_reports.sh
More file actions
38 lines (32 loc) · 778 Bytes
/
make_reports.sh
File metadata and controls
38 lines (32 loc) · 778 Bytes
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
#!/bin/bash
source ./venv/bin/activate || exit 1
dirs=(
"reports/coverage/html"
"reports/junit"
"reports/badges"
)
# Ensure required directories exist
for d in "${dirs[@]}"; do
if ! [ -d "$d" ]; then
mkdir -p "$d" || exit 2
fi
done
# Prune old HTML Reports
html_reports_dir="reports/coverage/html"
if [ -d "$html_reports_dir" ]; then
rm -rf "$html_reports_dir"
fi
pytest --cov \
--cov-report "xml:reports/coverage/coverage.xml" \
--cov-report "html:$html_reports_dir" \
--junitxml=reports/junit/junit.xml
# Print coverage to console.
coverage report -m
# Make badges
echo "Generating badges..."
{
genbadge tests &&
genbadge coverage &&
mv *".svg" "reports/badges/" &&
python3 generate_custom_badges.py
} || echo "Finished report generation with errors."