🐛 fix: extract BDD coverage directly from test output instead of file
This commit is contained in:
@@ -194,24 +194,17 @@ jobs:
|
|||||||
export DLC_DATABASE_PASSWORD=postgres
|
export DLC_DATABASE_PASSWORD=postgres
|
||||||
export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test
|
export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test
|
||||||
export DLC_DATABASE_SSL_MODE=disable
|
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
|
# Extract BDD coverage percentage directly from test output
|
||||||
ls -la coverage.out || echo "ERROR: coverage.out not found"
|
BDD_COVERAGE=$(echo "$test_output" | grep "coverage:" | grep -oP '\d+\.\d+' | head -1)
|
||||||
|
if [ -z "$BDD_COVERAGE" ]; then
|
||||||
# Generate BDD coverage report
|
echo "ERROR: Could not extract BDD coverage from test output"
|
||||||
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
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "BDD Coverage: ${BDD_COVERAGE}%"
|
||||||
|
|
||||||
# Update BDD coverage badge
|
# Update BDD coverage badge
|
||||||
export PACKAGES_TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
export PACKAGES_TOKEN="${{ secrets.PACKAGES_TOKEN }}"
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Run tests with proper coverage measurement
|
# Run tests with proper coverage measurement
|
||||||
test_output=$(go test ./features/... -v -cover -coverpkg=./... -coverprofile=coverage.out 2>&1)
|
test_output=$(go test ./features/... -v -cover -coverpkg=./... 2>&1)
|
||||||
test_exit_code=$?
|
test_exit_code=$?
|
||||||
|
|
||||||
echo "$test_output"
|
echo "$test_output"
|
||||||
|
|||||||
Reference in New Issue
Block a user