.NET #21
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: PowerMate | |
runs-on: windows-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v3.3.0 | |
- name: Initialize test reporting | |
uses: testspace-com/setup-testspace@v1.0.5 | |
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 | |
run: | | |
dotnet test --no-build --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings Tests/Tests.runsettings --logger "trx;LogFileName=TestResults.xml" | |
Out-File -InputObject "TEST_EXIT_CODE=$LASTEXITCODE" -FilePath $env:GITHUB_ENV -Append -Encoding UTF8 | |
Copy-Item Tests/TestResults/*/coverage.info Tests/TestResults -ErrorAction Continue | |
exit 0 | |
- name: Upload test report | |
run: testspace Tests/TestResults/TestResults.xml | |
- name: Upload coverage | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: Tests/TestResults/coverage.info | |
- name: Stop if tests failed | |
run: exit $env:TEST_EXIT_CODE | |
- name: Pack | |
run: dotnet pack ${{ env.ProjectName }} --no-build --configuration Release --verbosity normal | |
- name: Upload package | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: ${{ env.ProjectName }}.nupkg | |
path: ${{ env.ProjectName }}/bin/Release/*.*nupkg | |
- name: Publish demos | |
run: | | |
dotnet publish PowerMateVolume -c Release --self-contained false -p:PublishSingleFile=true -r win10-x64 | |
dotnet publish Demo -c Release --self-contained false -p:PublishSingleFile=true -r win10-x64 | |
dotnet publish Demo -c Release --self-contained false -p:PublishSingleFile=true -r win10-arm64 | |
dotnet publish Demo -c Release --self-contained false -p:PublishSingleFile=true -r osx-x64 | |
dotnet publish Demo -c Release --self-contained false -p:PublishSingleFile=true -r osx-arm64 | |
New-Item -Name Demo/bin/Release/upload/Windows -Type Directory -ErrorAction SilentlyContinue | |
New-Item -Name Demo/bin/Release/upload/MacOS -Type Directory -ErrorAction SilentlyContinue | |
Copy-Item PowerMateVolume/bin/Release/net7.0-windows/win10-x64/publish/PowerMateVolume.exe Demo/bin/Release/upload/Windows/PowerMateVolume.exe | |
Copy-Item Demo/bin/Release/net7.0/win10-x64/publish/Demo.exe Demo/bin/Release/upload/Windows/Demo-x64.exe | |
Copy-Item Demo/bin/Release/net7.0/win10-arm64/publish/Demo.exe Demo/bin/Release/upload/Windows/Demo-ARM64.exe | |
Copy-Item Demo/bin/Release/net7.0/osx-x64/publish/Demo Demo/bin/Release/upload/MacOS/Demo-x64 | |
Copy-Item Demo/bin/Release/net7.0/osx-arm64/publish/Demo Demo/bin/Release/upload/MacOS/Demo-ARM64 | |
- name: Upload demos | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: Demos | |
path: Demo/bin/Release/upload/ |