From d9734f1da5da7f0308ee52ccebc3efdd88dc10df Mon Sep 17 00:00:00 2001 From: Souma <101255979+5ouma@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:09:04 +0900 Subject: [PATCH] ci(test): Visualize code coverage (#109) Upload to Codecov and add comments to PRs. --- .github/README.md | 1 + .github/workflows/test.yml | 9 +++++++-- .gitignore | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/README.md b/.github/README.md index d986d19..6c7a05c 100644 --- a/.github/README.md +++ b/.github/README.md @@ -17,6 +17,7 @@ [![Test](https://img.shields.io/github/actions/workflow/status/5ouma/mli/test.yml?label=test&style=flat-square)](https://github.com/5ouma/mli/actions/workflows/test.yml) [![Release](https://img.shields.io/github/actions/workflow/status/5ouma/mli/release.yml?label=release&style=flat-square)](https://github.com/5ouma/mli/actions/workflows/release.yml) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/5ouma/mli/main.svg?style=flat-square)](https://results.pre-commit.ci/latest/github/5ouma/mli/main) +[![codecov](https://codecov.io/gh/5ouma/mli/graph/badge.svg?token=GHN8H6W1LZ)](https://codecov.io/gh/5ouma/mli) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c20b77..96c4a08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,5 +32,10 @@ jobs: - name: ๐Ÿ“Š Static Analysis run: go vet -v ./... - - name: ๐Ÿงช Test Packages - run: go test -v -race ./... + - name: ๐Ÿงช Run Tests + run: go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic + + - name: โ˜‚๏ธ Upload Coverage + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index b4efb70..9ee6649 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -mli -dist/ +/mli +/dist/ +/coverage.txt