From f68651e1491d3fb5586587011300cc036f57c18b Mon Sep 17 00:00:00 2001 From: Ashwin Gopalsamy <47941624+ashwingopalsamy@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:28:45 +0530 Subject: [PATCH] config: add code-coverage support --- .github/workflows/go.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 730c96a..40399c6 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,9 +20,17 @@ jobs: uses: actions/setup-go@v4 with: go-version: '1.23' + + - name: Install dependencies + run: go mod tidy - - name: Build - run: go build -v ./... + - name: Run tests with coverage + run: go test -v -coverprofile=coverage.txt ./... - - name: Test - run: go test -v ./... + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.txt + flags: unittests + fail_ci_if_error: true