From b0c827fbd4d7e39e2b2f4f133759481e4530e955 Mon Sep 17 00:00:00 2001 From: BushraS-Protean Date: Tue, 11 Mar 2025 14:57:17 +0530 Subject: [PATCH] Update beckn_ci.yml checking entire directory --- .github/workflows/beckn_ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/beckn_ci.yml b/.github/workflows/beckn_ci.yml index 3b0e2e4..a260e39 100644 --- a/.github/workflows/beckn_ci.yml +++ b/.github/workflows/beckn_ci.yml @@ -34,14 +34,15 @@ jobs: run: | golangci-lint run ./... - # 5. Run unit tests with coverage recursively for all Go files ${{ env.APP_DIRECTORY }} + # 5. Run unit tests with coverage in the entire repository - name: Run unit tests with coverage run: | - # Run tests recursively for all Go files - go test -v -coverprofile=coverage.out ./... - - # Generate coverage report - go tool cover -func=coverage.out | tee coverage.txt + # Find all directories with Go test files and run `go test` on them + find ./ -type f -name '*_test.go' -exec dirname {} \; | sort -u | while read dir; do + echo "Running tests in $dir" + go test -v -coverprofile=coverage.out $dir + go tool cover -func=coverage.out | tee coverage.txt + done # 6. Check if coverage is >= 90%, but only check coverage if tests exist - name: Check coverage percentage