📊 feat: add separate BDD and unit test coverage badges to distinguish test coverage types
Some checks failed
CI/CD Pipeline / Build Docker Cache (push) Successful in 9s
CI/CD Pipeline / CI Pipeline (push) Failing after 4m22s

This commit is contained in:
2026-04-08 13:05:06 +02:00
parent 7416d5f1c3
commit f5e35464b9
2 changed files with 44 additions and 12 deletions

View File

@@ -183,9 +183,9 @@ jobs:
exit 1
fi
- name: Run BDD tests with strict validation
- name: Run BDD tests with strict validation and coverage
run: |
echo "Running BDD tests with strict validation..."
echo "Running BDD tests with strict validation and coverage..."
# Use the run-bdd-tests.sh script which fails on undefined/pending steps
# In CI environment, PostgreSQL is already running as a service
export DLC_DATABASE_HOST=postgres
@@ -195,6 +195,15 @@ jobs:
export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test
export DLC_DATABASE_SSL_MODE=disable
./scripts/run-bdd-tests.sh
# Extract BDD coverage percentage
BDD_COVERAGE=$(grep "coverage:" <<< "$test_output" | grep -oP '\d+\.\d+' | head -1)
echo "BDD Coverage: ${BDD_COVERAGE}%"
# Update BDD coverage badge
export PACKAGES_TOKEN="${{ secrets.PACKAGES_TOKEN }}"
export GITHUB_REF_NAME="${{ github.ref_name }}"
./scripts/ci-update-coverage-badge.sh "$BDD_COVERAGE" "bdd"
- name: Run unit tests with coverage
run: |
@@ -202,14 +211,14 @@ jobs:
# Run unit tests excluding BDD tests (already run above)
go test ./pkg/... ./cmd/... -coverprofile=coverage.out -v && go tool cover -func=coverage.out > coverage.txt
# Extract coverage percentage
COVERAGE=$(grep "total:" coverage.txt | grep -oP '\d+\.\d+' | head -1)
echo "Coverage: ${COVERAGE}%"
# Extract unit test coverage percentage
UNIT_COVERAGE=$(grep "total:" coverage.txt | grep -oP '\d+\.\d+' | head -1)
echo "Unit Coverage: ${UNIT_COVERAGE}%"
# Update coverage badge using script
# Update unit test coverage badge
export PACKAGES_TOKEN="${{ secrets.PACKAGES_TOKEN }}"
export GITHUB_REF_NAME="${{ github.ref_name }}"
./scripts/ci-update-coverage-badge.sh "$COVERAGE"
./scripts/ci-update-coverage-badge.sh "$UNIT_COVERAGE" "unit"
- name: Run go fmt
run: go fmt ./...