🐛 fix: extract BDD coverage directly from test output instead of file

This commit is contained in:
2026-04-08 13:48:06 +02:00
parent 6c86c6dd04
commit f47094cbba
2 changed files with 9 additions and 16 deletions

View File

@@ -194,24 +194,17 @@ jobs:
export DLC_DATABASE_PASSWORD=postgres
export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test
export DLC_DATABASE_SSL_MODE=disable
./scripts/run-bdd-tests.sh
# Run BDD tests and capture output
test_output=$(./scripts/run-bdd-tests.sh 2>&1)
echo "$test_output"
# Debug: Check if coverage file exists
ls -la coverage.out || echo "ERROR: coverage.out not found"
# Generate BDD coverage report
if [ -f "coverage.out" ]; then
go tool cover -func=coverage.out > bdd_coverage.txt
# Extract BDD coverage percentage
BDD_COVERAGE=$(grep "total:" bdd_coverage.txt | grep -oP '\d+\.\d+' | head -1)
echo "BDD Coverage: ${BDD_COVERAGE}%"
else
echo "ERROR: coverage.out file not found after BDD tests"
# Try to find any coverage files
find . -name "*.out" -o -name "coverage*" | head -10
# Extract BDD coverage percentage directly from test output
BDD_COVERAGE=$(echo "$test_output" | grep "coverage:" | grep -oP '\d+\.\d+' | head -1)
if [ -z "$BDD_COVERAGE" ]; then
echo "ERROR: Could not extract BDD coverage from test output"
exit 1
fi
echo "BDD Coverage: ${BDD_COVERAGE}%"
# Update BDD coverage badge
export PACKAGES_TOKEN="${{ secrets.PACKAGES_TOKEN }}"