|
1 | 1 | name: Receive Pull Request |
2 | 2 |
|
3 | 3 | on: [pull_request] |
4 | | - |
| 4 | +env: |
| 5 | + DOTNET_VERSION: '6.0.x' |
5 | 6 | jobs: |
6 | | - build-and-test-windows: |
7 | | - name: Build And Test |
8 | | - runs-on: windows-2019 |
9 | | - |
| 7 | + build-and-test: |
| 8 | + name: Build And Test ${{matrix.os}} |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + os: [ubuntu-latest, windows-latest, macOS-latest] |
10 | 13 | steps: |
11 | 14 | - uses: actions/checkout@v2 |
12 | 15 |
|
13 | 16 | - name: Setup .NET Core |
14 | 17 | uses: actions/setup-dotnet@v1 |
15 | 18 | with: |
16 | | - dotnet-version: 6.0.101 |
17 | | - - name: Restore nHapi |
| 19 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 20 | + |
| 21 | + - name: Restore nHapi (Windows) |
| 22 | + if: matrix.os == 'windows-latest' |
18 | 23 | run: | |
19 | 24 | dotnet restore nHapi.sln --configfile build\.nuget\NuGet.config |
20 | 25 |
|
| 26 | + - name: Restore nHapi (Non-Windows) |
| 27 | + if: matrix.os != 'windows-latest' |
| 28 | + run: | |
| 29 | + dotnet restore nHapi.sln --configfile build/.nuget/NuGet.config |
| 30 | +
|
21 | 31 | - name: Build nHapi |
22 | 32 | run: | |
23 | 33 | dotnet build nHapi.sln -c Release --no-restore |
24 | 34 |
|
25 | | - - name: Run tests for all target frameworks |
| 35 | + - name: Run tests for all target frameworks (Windows) |
| 36 | + if: matrix.os == 'windows-latest' |
| 37 | + run: | |
| 38 | + dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build |
| 39 | + dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net6.0 --no-restore --no-build |
| 40 | + dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net6.0 --no-restore --no-build |
| 41 | + dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build |
| 42 | + dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net6.0 --no-restore --no-build |
| 43 | +
|
| 44 | + - name: Run tests for all target frameworks (Non-Windows) |
| 45 | + if: matrix.os != 'windows-latest' |
26 | 46 | run: | |
27 | | - dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build |
28 | | - dotnet test tests\NHapi.Base.NUnit\NHapi.Base.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net6.0 --no-restore --no-build |
29 | | - dotnet test tests\NHapi.NUnit.SourceGeneration\NHapi.NUnit.SourceGeneration.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net6.0 --no-restore --no-build |
30 | | - dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net461 --no-restore --no-build |
31 | | - dotnet test tests\NHapi.NUnit\NHapi.NUnit.csproj --logger "trx;LogFilePrefix=TestResults" -r TestResults -c Release -f net6.0 --no-restore --no-build |
| 47 | + dotnet test tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build |
| 48 | + dotnet test tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build |
| 49 | + dotnet test tests/NHapi.NUnit/NHapi.NUnit.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build |
32 | 50 |
|
33 | 51 | - name: Convert trx to junit |
34 | | - if: ${{ success() || failure() }} |
| 52 | + if: (success() || failure()) && matrix.os == 'windows-latest' |
35 | 53 | run: | |
36 | 54 | dotnet tool install -g trx2junit |
37 | 55 | trx2junit TestResults/*.trx |
38 | 56 |
|
39 | 57 | - name: Upload Unit Test Results |
40 | | - if: always() |
| 58 | + if: always() && matrix.os == 'windows-latest' |
41 | 59 | uses: actions/upload-artifact@v2 |
42 | 60 | with: |
43 | 61 | name: unit-test-results |
44 | 62 | path: TestResults\TestResults*.xml |
45 | 63 |
|
46 | | - build-and-test-linux: |
47 | | - name: Build And Test Linux |
48 | | - runs-on: ubuntu-latest |
49 | | - |
50 | | - steps: |
51 | | - - uses: actions/checkout@v2 |
52 | | - |
53 | | - - name: Setup .NET Core |
54 | | - uses: actions/setup-dotnet@v1 |
55 | | - with: |
56 | | - dotnet-version: 6.0.101 |
57 | | - |
58 | | - - name: Restore nHapi |
59 | | - run: | |
60 | | - dotnet restore nHapi.sln --configfile build/.nuget/NuGet.config |
61 | | -
|
62 | | - - name: Build nHapi |
63 | | - run: | |
64 | | - dotnet build nHapi.sln -c Release --no-restore |
65 | | -
|
66 | | - - name: Run tests for all target frameworks |
67 | | - run: | |
68 | | - dotnet test tests/NHapi.Base.NUnit/NHapi.Base.NUnit.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build |
69 | | - dotnet test tests/NHapi.NUnit.SourceGeneration/NHapi.NUnit.SourceGeneration.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build |
70 | | - dotnet test tests/NHapi.NUnit/NHapi.NUnit.csproj --collect:"XPlat Code Coverage" -r TestResults -c Release -f net6.0 --no-restore --no-build |
71 | | -
|
72 | 64 | - name: Upload Code Coverage Report |
73 | | - if: always() |
| 65 | + if: always() && matrix.os == 'ubuntu-latest' |
74 | 66 | uses: actions/upload-artifact@v2 |
75 | 67 | with: |
76 | 68 | name: coverage-reports |
|
0 commit comments