From 021caf86061a9440ac29bdadf513235c03ffacaa Mon Sep 17 00:00:00 2001 From: Marin Nozhchev Date: Fri, 10 Jan 2025 18:14:09 +0200 Subject: [PATCH] tests: exclude generated code from coverage also try uploading the .html report for troublshooting coverall reports --- .github/workflows/ci.yml | 10 ++++++++-- .gitignore | 4 +++- Makefile | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df4b2f1..375ec4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,12 +24,18 @@ jobs: run: go build -v ./... - name: Test - run: go test -covermode atomic -coverprofile=covprofile -v -vet=all ./... + run: make test - name: Send coverage env: COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} - run: go run github.com/mattn/goveralls@latest -coverprofile=covprofile -service=github + run: go run github.com/mattn/goveralls@latest -coverprofile=covprofile -service=github + + - name: Archive code coverage results + uses: actions/upload-artifact@v4 + with: + name: code-coverage-report + path: coverage.html post-merge: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index a18ce6b..2a7a8d2 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,6 @@ _testmain.go *.test *.prof -vendor/ \ No newline at end of file +vendor/ +/coverage.html +/covprofile diff --git a/Makefile b/Makefile index b63e677..1da5add 100644 --- a/Makefile +++ b/Makefile @@ -14,3 +14,6 @@ usql: test-cli: usql ./usql -c "\drivers" | grep impala +test: + go test -covermode atomic -coverprofile=covprofile -v -vet=all `exec go list ./... | grep -v "./internal/generated"` + go tool cover -html=covprofile -o coverage.html \ No newline at end of file