-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from nHapiNET/GitHubActionsCoverage
Add code coverage to the CI/CD, plus build status workflow for master
- Loading branch information
Showing
8 changed files
with
124 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Build Status | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build And Test | ||
runs-on: windows-2019 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 3.1.301 | ||
- name: Restore nHapi | ||
run: | | ||
dotnet restore nHapi.sln --configfile build\.nuget\NuGet.config | ||
dotnet restore Hl7Models.sln --configfile build\.nuget\NuGet.config | ||
- name: Build nHapi | ||
run: | | ||
dotnet build nHapi.sln -c Release --no-restore | ||
dotnet build Hl7Models.sln -c Release --no-restore | ||
- name: Run tests for all target frameworks | ||
run: | | ||
dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build | ||
dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f netcoreapp3.1 --no-restore --no-build | ||
dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build | ||
dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f netcoreapp3.1 --no-restore --no-build | ||
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build | ||
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --collect:"XPlat Code Coverage" --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f netcoreapp3.1 --no-restore --no-build | ||
- name: Convert trx to junit | ||
run: | | ||
dotnet tool install -g trx2junit | ||
trx2junit TestResults/*.trx | ||
- name: Upload Unit Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: unit-test-results | ||
path: TestResults\TestResults*.xml | ||
|
||
- name: Upload Code Coverage Report | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage-reports | ||
path: TestResults\*\coverage.cobertura.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Publish Code Coverage Results | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build Status", "Receive Pull Request"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
publish-test-results: | ||
runs-on: ubuntu-latest | ||
# the build-and-test job might be skipped, we don't need to run this job then | ||
if: > | ||
${{ ( github.event.workflow_run.event == 'pull_request' || | ||
github.event.workflow_run.event == 'push' ) && | ||
( github.event.workflow_run.conclusion == 'success' || | ||
github.event.workflow_run.conclusion == 'failure' ) }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: artifacts | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: Publish Code Coverage Results | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Publish Pull Request Test Results | |
|
||
on: | ||
workflow_run: | ||
workflows: ["Receive Pull Request"] | ||
workflows: ["Build Status", "Receive Pull Request"] | ||
types: | ||
- completed | ||
|
||
|
@@ -11,15 +11,21 @@ jobs: | |
runs-on: ubuntu-latest | ||
# the build-and-test job might be skipped, we don't need to run this job then | ||
if: > | ||
${{ github.event.workflow_run.event == 'pull_request' && | ||
${{ ( github.event.workflow_run.event == 'pull_request' || | ||
github.event.workflow_run.event == 'push' ) && | ||
( github.event.workflow_run.conclusion == 'success' || | ||
github.event.workflow_run.conclusion == 'failure' ) }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: artifacts | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: Publish Unit Test Results | ||
uses: EnricoMi/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters