📊 feat: add separate BDD and unit test coverage badges to distinguish test coverage types
This commit is contained in:
@@ -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 ./...
|
||||
|
||||
Reference in New Issue
Block a user