Allow tests to build on demand to handle both x86 and x64 artifacts #5
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
name: .NET | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
env: | |
ProjectName: Bom.Squad | |
runs-on: windows-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v3 | |
- name: Initialize test reporting | |
uses: testspace-com/setup-testspace@v1 | |
with: | |
domain: ${{github.repository_owner}} | |
- name: Restore | |
run: dotnet restore --verbosity normal | |
- name: Build | |
run: dotnet build --no-restore --configuration Release --verbosity normal | |
- name: Test x64 | |
run: | | |
dotnet test --arch x64 --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings Test/Test.runsettings --logger "trx;LogFileName=TestResults-x64.xml" --logger "console;verbosity=detailed" | |
Out-File -InputObject "TEST_EXIT_CODE_X64=$LASTEXITCODE" -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 | |
Move-Item Test/TestResults/*/coverage.info Test/TestResults/coverage-x64.info -ErrorAction Continue | |
exit 0 | |
- name: Test x86 | |
run: | | |
dotnet test --arch x86 --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings Test/Test.runsettings --logger "trx;LogFileName=TestResults-x86.xml" --logger "console;verbosity=detailed" | |
Out-File -InputObject "TEST_EXIT_CODE_X86=$LASTEXITCODE" -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 | |
Move-Item Test/TestResults/*/coverage.info Test/TestResults/coverage-x86.info -ErrorAction Continue | |
exit 0 | |
- name: Upload test report | |
run: testspace Test/TestResults/TestResults*.xml | |
- name: Upload coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
files: Test/TestResults/coverage-x86.info Test/TestResults/coverage-x64.info | |
format: lcov | |
allow-empty: true | |
- name: Stop if x64 tests failed | |
run: exit $env:TEST_EXIT_CODE_X64 | |
- name: Stop if x86 tests failed | |
run: exit $env:TEST_EXIT_CODE_X86 | |
- name: Pack | |
run: dotnet pack ${{ env.ProjectName }} --no-build --configuration Release --verbosity normal | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ProjectName }}.nupkg | |
path: ${{ env.ProjectName }}/bin/Release/*.*nupkg |