Cleanup project files; configure Directory.Build.props #380
Workflow file for this run
This file contains hidden or 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: Build, test (Pull Request) | |
on: | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: pr-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Install additional .NET SDKs | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore NuGet Packages | |
run: dotnet restore | |
- name: Build library | |
run: dotnet build -c Debug --no-restore | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Compiled project | |
path: ${{ github.workspace }} | |
retention-days: 1 | |
test: | |
needs: build | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
dotnet-framework: | |
- { name: ".NET Framework 4.6.2", framework: "net462", coverage: false, no-build: true, sdk: "8.0.x" } | |
- { name: ".NET Core 2.1", framework: "netcoreapp2.1", coverage: true, no-build: false, sdk: "2.1.x" } | |
- { name: ".NET Core 3.1", framework: "netcoreapp3.1", coverage: true, no-build: true, sdk: "3.1.x" } | |
- { name: ".NET 5.0", framework: "net5.0", coverage: true, no-build: true, sdk: "5.0.x" } | |
- { name: ".NET 5.0 Windows", framework: "net5.0-windows", coverage: true, no-build: true, sdk: "5.0.x" } | |
- { name: ".NET 6.0", framework: "net6.0", coverage: true, no-build: true, sdk: "6.0.x" } | |
- { name: ".NET 6.0 Windows", framework: "net6.0-windows", coverage: true, no-build: true, sdk: "6.0.x" } | |
name: Test ${{ matrix.dotnet-framework.name }} | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: Compiled project | |
path: ${{ github.workspace }} | |
- name: Install .NET SDK ${{ matrix.dotnet-framework.sdk }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.dotnet-framework.sdk }} | |
- name: Run tests for ${{ matrix.dotnet-framework.name }} | |
working-directory: QRCoderTests | |
run: | | |
$coverage = if ("${{ matrix.dotnet-framework.coverage }}" -eq "true") { "/p:CollectCoverage=true /p:CoverletOutputFormat=opencover" } else { "" } | |
$noBuild = if ("${{ matrix.dotnet-framework.no-build }}" -eq "true") { "--no-build" } else { "" } | |
dotnet test -c Debug -f ${{ matrix.dotnet-framework.framework }} --nologo $noBuild $coverage | |
additional-tests: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Run trim analysis | |
working-directory: QRCoderTrimAnalysis | |
run: dotnet publish -c Release -o bin/publish | |
- name: Run API approval tests | |
working-directory: QRCoderApiTests | |
run: dotnet test -c Release --nologo |