From d3d2d63176323b2b89bbe40d4ad498ad164e518e Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 17 Nov 2022 15:05:58 -0500 Subject: [PATCH] feat(ci): add code coverage --- .github/workflows/build.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9fcf3fb2..53d504610 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,4 +9,21 @@ jobs: snapshot: uses: charmbracelet/meta/.github/workflows/snapshot.yml@main secrets: - goreleaser_key: ${{ secrets.GORELEASER_KEY }} \ No newline at end of file + goreleaser_key: ${{ secrets.GORELEASER_KEY }} + + coverage: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ^1 + + - name: Test + run: go test -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./... -timeout 5m + - uses: codecov/codecov-action@v3 + with: + file: ./coverage.txt \ No newline at end of file