Skip to content

Commit

Permalink
Upload coverage report to coveralls.io (#367)
Browse files Browse the repository at this point in the history
* - Upload coverage report to coveralls.io

* - Fix env var for coveralls

* - Use coveralls GitHub Action rather than coveralls dotnet tool

* - Remove HTML report upload
- Add Coveralls badge to README.md
- Only run coverage on pushes to master

* - Remove coveralls Makefile option
  • Loading branch information
nwithan8 authored Nov 4, 2022
1 parent bf1f3ec commit 368e9d8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ jobs:
run: make scan
# TODO: In the future, we can collect the output logs by enabling Code Scanning and using the pre-built GitHub Action: https://github.com/marketplace/actions/securitycodescan
# https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#uploading-a-code-scanning-analysis-with-github-actions
coverage:
if: github.ref == 'refs/heads/master'
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Set up dotnet tools and dependencies
run: make install
- name: Generate coverage report
run: make coverage
- name: Upload lcov coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
path-to-lcov: coveragereport/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
NET_Tests:
# derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h
runs-on: windows-2022
Expand Down
14 changes: 0 additions & 14 deletions EasyPost.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@
"Microsoft.TestPlatform.TestHost": "17.3.0"
}
},
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.2, )",
"resolved": "1.0.2",
"contentHash": "5/cSEVld+px/CuRrbohO/djfg6++eR6zGpy88MgqloXvkj//WXWpFZyu/OpkXPN0u5m+dN/EVwLNYFUxD4h2+A==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.2"
}
},
"Microsoft.VisualStudio.TestPlatform.ObjectModel": {
"type": "Direct",
"requested": "[14.0.0, 15.0.0)",
Expand Down Expand Up @@ -152,11 +143,6 @@
"resolved": "1.1.0",
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
},
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
"type": "Transitive",
"resolved": "1.0.2",
"contentHash": "8shzGaD5pZi4npuJYCM3de6pl0zlefcbyTIvXIiCdsTqauZ7lAhdaJVtJSqlhYid9VosFAOygBykoJ1SEOlGWA=="
},
"Microsoft.TestPlatform.ObjectModel": {
"type": "Transitive",
"resolved": "17.3.0",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ test-fw:
uninstall-scanner:
dotnet tool uninstall security-scan

.PHONY: help build build-test-fw build-prod clean format install-cert install-tools install lint lint-scripts pre-release publish-all publish release restore scan setup-win setup-unix sign test test-fw uninstall-scanner
.PHONY: help build build-test-fw build-prod clean coverage format install-cert install-tools install lint lint-scripts pre-release publish-all publish release restore scan setup-win setup-unix sign test test-fw uninstall-scanner
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# EasyPost .Net Client Library

[![CI](https://github.com/EasyPost/easypost-csharp/workflows/CI/badge.svg)](https://github.com/EasyPost/easypost-csharp/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/EasyPost/easypost-csharp/badge.svg?branch=master)](https://coveralls.io/github/EasyPost/easypost-csharp?branch=master)
[![NuGet version](https://badge.fury.io/nu/EasyPost-Official.svg)](https://badge.fury.io/nu/EasyPost-Official)

EasyPost, the simple shipping solution. You can sign up for an account at <https://easypost.com>.
Expand Down
4 changes: 4 additions & 0 deletions generate_test_reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ for req in "$@"; do
fi
done

# Generate Cobertura report for each test project
test_folder="EasyPost.Tests"
cd "$test_folder" || exit
dotnet test --collect:"XPlat Code Coverage"

# Generate HTML and lcov report
reportgenerator -reports:TestResults/*/coverage.cobertura.xml -targetdir:../coveragereport -reporttypes:Html
reportgenerator -reports:TestResults/*/coverage.cobertura.xml -targetdir:../coveragereport -reporttypes:lcov

0 comments on commit 368e9d8

Please sign in to comment.