Files
onvif-go/.github/workflows/coverage.yml
T

43 lines
1.2 KiB
YAML

name: Additional Coverage Reports
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master, main]
jobs:
# Generate additional coverage analysis if CI passed
coverage-analysis:
name: Coverage Analysis
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Check coverage percentage
run: |
if [ -f coverage.out ]; then
coverage=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
echo "Coverage: $coverage%"
# Set threshold to 40%
if (( $(echo "$coverage < 40" | bc -l) )); then
echo "⚠️ Coverage below 40% threshold: $coverage%"
else
echo "✅ Coverage above threshold: $coverage%"
fi
fi
- name: Upload coverage badge
continue-on-error: true
run: |
# Optional: Update badges or notifications
echo "Coverage analysis complete"