Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create basic GitHub Actions for pull requests, partially addresses #124 #141

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/publish-pr-test-results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Pull Request Test Results

on:
workflow_run:
workflows: ["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.conclusion == 'success' ||
github.event.workflow_run.conclusion == 'failure' ) }}
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Publish Unit Test Results
uses: EnricoMi/[email protected]
with:
check_name: Unit Test Results
github_token: ${{ secrets.GITHUB_TOKEN }}
files: "**/*.xml"
report_individual_runs: true
check_run_annotations: all tests, skipped tests
43 changes: 43 additions & 0 deletions .github/workflows/receive-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Receive Pull Request

on: [pull_request]

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 --logger trx -r TestResults -c Release -f net461 --no-restore --no-build
dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger trx -r TestResults -c Release -f netcoreapp3.1 --no-restore --no-build
dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --logger trx -r TestResults -c Release -f net461 --no-restore --no-build
dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --logger trx -r TestResults -c Release -f netcoreapp3.1 --no-restore --no-build
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger trx -r TestResults -c Release -f net461 --no-restore --no-build
dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger trx -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/*.xml
3 changes: 3 additions & 0 deletions build/.nuget/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>