From 14e232eb99d06e25438d64dd7096c7e38087615b Mon Sep 17 00:00:00 2001 From: Akash Chetty Date: Wed, 17 May 2023 21:48:53 +0530 Subject: [PATCH] chore: coverage for tests --- .github/workflows/tests.yaml | 29 +++++++++++++++++++++++++++++ Makefile | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1938c89fbd..97c17deb4b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -94,6 +94,11 @@ jobs: SNOWFLAKE_RBAC_INTEGRATION_TEST_CREDENTIALS: ${{ secrets.SNOWFLAKE_RBAC_INTEGRATION_TEST_CREDENTIALS }} RSERVER_WAREHOUSE_POSTGRES_USE_LEGACY: ${{ matrix.useLegacy }} RSERVER_WAREHOUSE_DELTALAKE_USE_NATIVE: ${{ matrix.useNative }} + - name: Upload coverage report + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.destination }} + path: coverage.txt unit: name: Unit @@ -117,6 +122,30 @@ jobs: TEST_S3_DATALAKE_CREDENTIALS: ${{ secrets.TEST_S3_DATALAKE_CREDENTIALS }} BIGQUERY_INTEGRATION_TEST_CREDENTIALS: ${{ secrets.BIGQUERY_INTEGRATION_TEST_CREDENTIALS }} run: make test + - name: Upload coverage report + uses: actions/upload-artifact@v3 + with: + name: unit + path: coverage.txt + + coverage: + needs: [warehouse-integration, unit] + runs-on: 'ubuntu-20.04' + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '~1.20.3' + check-latest: true + - name: Download coverage reports + uses: actions/download-artifact@v3 + - name: Merge Coverage + run: | + go install github.com/wadey/gocovmerge@latest + gocovmerge */coverage.txt > coverage.txt - uses: codecov/codecov-action@v3 with: fail_ci_if_error: true + files: ./coverage.txt diff --git a/Makefile b/Makefile index f0892ac339..95c7a49c26 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,10 @@ test: install-tools test-run test-teardown test-run: ## Run all unit tests ifeq ($(filter 1,$(debug) $(RUNNER_DEBUG)),) $(eval TEST_CMD = SLOW=0 gotestsum --format pkgname-and-test-fails --) - $(eval TEST_OPTIONS = -p=1 -v -failfast -shuffle=on -coverprofile=profile.out -covermode=count -coverpkg=./... -vet=all --timeout=15m) + $(eval TEST_OPTIONS = -p=1 -v -failfast -shuffle=on -coverprofile=profile.out -covermode=atomic -coverpkg=./... -vet=all --timeout=15m) else $(eval TEST_CMD = SLOW=0 go test) - $(eval TEST_OPTIONS = -p=1 -v -failfast -shuffle=on -coverprofile=profile.out -covermode=count -coverpkg=./... -vet=all --timeout=15m) + $(eval TEST_OPTIONS = -p=1 -v -failfast -shuffle=on -coverprofile=profile.out -covermode=atomic -coverpkg=./... -vet=all --timeout=15m) endif ifdef package $(TEST_CMD) $(TEST_OPTIONS) $(package) && touch $(TESTFILE) || true