Build app project, not entire solution, because we're specifying a RID #4
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: DryerDuty | |
TargetPlatform: linux-arm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v3.5.2 | |
- name: Initialize test reporting | |
uses: testspace-com/setup-testspace@v1 | |
with: | |
domain: ${{ github.repository_owner }} | |
- name: Restore | |
run: dotnet restore --locked-mode --verbosity normal | |
- name: Build | |
run: dotnet build ${{ env.ProjectName }} --no-restore --configuration Release --runtime ${{ env.TargetPlatform }} --no-self-contained --verbosity normal | |
- name: Test | |
shell: bash | |
run: | | |
dotnet test --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings Tests/Tests.runsettings --logger "trx;LogFileName=TestResults.xml" | |
echo "TEST_EXIT_CODE=$?" >> $GITHUB_ENV | |
cp Tests/TestResults/*/coverage.info Tests/TestResults | |
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: Publish | |
run: dotnet publish ${{ env.ProjectName }} --no-build --configuration Release -p:PublishSingleFile=true --runtime ${{ env.TargetPlatform }} --no-self-contained | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: ${{ env.ProjectName }} | |
path: | | |
${{ env.ProjectName }}/bin/Release/net7.0/${{ env.TargetPlatform }}/publish/${{ env.ProjectName }} | |
${{ env.ProjectName }}/bin/Release/net7.0/${{ env.TargetPlatform }}/publish/appsettings.json | |
${{ env.ProjectName }}/bin/Release/net7.0/${{ env.TargetPlatform }}/publish/*.service | |
${{ env.ProjectName }}/bin/Release/net7.0/${{ env.TargetPlatform }}/publish/*.so | |
if-no-files-found: error |