Skip to content

Commit

Permalink
chore(ci): add code coverage support (#54)
Browse files Browse the repository at this point in the history
<!-- Thanks for opening a PR! Here are some quick tips:
If this is your first time contributing, [read our Contributing
Guidelines](https://github.com/openfga/.github/blob/main/CONTRIBUTING.md)
to learn how to create an acceptable PR for this repo.
By submitting a PR to this repository, you agree to the terms within the
[OpenFGA Code of
Conduct](https://github.com/openfga/.github/blob/main/CODE_OF_CONDUCT.md)

If your PR is under active development, please submit it as a "draft".
Once it's ready, open it up for review.
-->

<!-- Provide a brief summary of the changes -->

## Description
<!-- Provide a detailed description of the changes -->

This PR introduces Codecov to our CI for monitoring test coverage of
changes.

## References
<!-- Provide a list of any applicable references here (GitHub Issue,
[OpenFGA RFC](https://github.com/openfga/rfcs), other PRs, etc..) -->

## Review Checklist
- [x] I have clicked on ["allow edits by
maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
- [ ] I have added documentation for new/changed functionality in this
PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev)
[Provide a link to any relevant PRs in the references section above]
- [x] The correct base branch is being used, if not `main`
- [ ] I have added tests to validate that the change in functionality is
working as expected
  • Loading branch information
evansims authored Apr 4, 2024
2 parents 5509927 + b0d51c4 commit a5714e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage:
precision: 2
range: "60...80"
round: down
15 changes: 11 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ jobs:
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test --no-build --verbosity normal --collect "Code Coverage"

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 #v4.3.1
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.1
with:
name: nuget-package
path: src/OpenFga.Sdk/bin/Release/OpenFga.Sdk.*.nupkg

- name: Upload coverage to Codecov
uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: openfga/dotnet-sdk

publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -58,7 +65,7 @@ jobs:
- name: Build
run: dotnet build --no-restore --configuration Release

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 #v4.3.1
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.1
with:
name: nuget-package
path: src/OpenFga.Sdk/bin/Release/OpenFga.Sdk.*.nupkg
Expand All @@ -78,7 +85,7 @@ jobs:
with:
fetch-depth: 0

- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803
- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 # v3.0.1
with:
version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
env:
Expand Down
1 change: 1 addition & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.codecov.yml
.editorconfig
.fossa.yml
.github/CODEOWNERS
Expand Down

0 comments on commit a5714e8

Please sign in to comment.