Skip to content

Commit

Permalink
ci: integrate codecov (#25)
Browse files Browse the repository at this point in the history
* ci: add action for tests and coverage

which hopefully will run on every push and pr against main and uploads the coverage to codecov

* ci: add codecov token

* docs(readme): add codecov coverage badge
  • Loading branch information
wgnf authored Nov 2, 2021
1 parent 1ed4dad commit dc00e28
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
comment:
require_changes: true
coverage:
status:
project:
default:
target: 88.5% # the required coverage value
threshold: 0.1% # the leniency in hitting the target
patch:
default:
target: 100%
threshold: 10%
38 changes: 38 additions & 0 deletions .github/workflows/test-and-cover.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run Tests and Coverage

on:
push:
pull_request:
branches:
- main

jobs:
test-and-cover:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --no-restore --collect:"XPlat Code Coverage" --blame-hang --blame-hang-timeout 60s /property:GenerateFullPaths=true /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByAttribute='ExcludeFromCodeCoverage' /p:SkipAutoProps=true

- name: Coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.cobertura.xml
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

[![GitHub license](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Uses SemVer 2.0.0](https://img.shields.io/badge/Uses%20SemVer-2.0.0-green)](https://semver.org/spec/v2.0.0.html)
[![Latest Release](https://img.shields.io/github/v/release/OptiSchmopti/CsvProc9000?label=latest%20release&sort=semver)](https://github.com/OptiSchmopti/CsvProc9000/releases)
[![Latest Release](https://img.shields.io/github/v/release/OptiSchmopti/CsvProc9000?label=latest%20release&sort=semver)](https://github.com/OptiSchmopti/CsvProc9000/releases)
[![codecov](https://codecov.io/gh/OptiSchmopti/CsvProc9000/branch/main/graph/badge.svg?token=AL5PLYOWHU)](https://codecov.io/gh/OptiSchmopti/CsvProc9000)
[![GitHub stars](https://img.shields.io/github/stars/OptiSchmopti/CsvProc9000?style=social)](https://github.com/OptiSchmopti/CsvProc9000/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/OptiSchmopti/CsvProc9000?style=social)](https://github.com/OptiSchmopti/CsvProc9000/network/members)
[![GitHub watchers](https://img.shields.io/github/watchers/OptiSchmopti/CsvProc9000?style=social)](https://github.com/OptiSchmopti/CsvProc9000/watchers)
Expand Down

0 comments on commit dc00e28

Please sign in to comment.