Fix multi-target tests #77
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: Continuous Integration | |
on: [push, pull_request] | |
env: | |
Configuration: Release | |
ContinuousIntegrationBuild: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_NOLOGO: true | |
jobs: | |
package: | |
strategy: | |
matrix: | |
os: [ macos-latest, ubuntu-latest, windows-latest ] | |
dotnet-version: ['3.1', '5.0', '6.0', '7.0', '8.0'] | |
exclude: | |
- os: macos-latest | |
dotnet-version: 3.1 | |
- os: macos-latest | |
dotnet-version: 5.0 | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
name: Build and run tests | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.dotnet-version }} | |
- name: Restore test project | |
run: dotnet restore --verbosity normal -p:TargetFramework=net${{ matrix.dotnet-version }} QrCodeGeneratorTest | |
- name: Restore library | |
run: dotnet restore --verbosity normal -p:TargetFramework=netstandard2.0 QrCodeGenerator | |
- name: Build library | |
run: dotnet build --configuration Release --no-restore --verbosity normal -p:TargetFramework=netstandard2.0 QrCodeGenerator | |
- name: Build test project | |
run: dotnet build --configuration Release --no-restore --verbosity normal -p:TargetFramework=net${{ matrix.dotnet-version }} QrCodeGeneratorTest | |
- name: Run tests | |
run: dotnet test --no-build --verbosity normal --logger:"html;LogFileName=../../TestResults-${{ matrix.os }}-dotnet_${{ matrix.dotnet-version }}.html" -P:TargetFramework=netnet${{ matrix.dotnet-version }} QrCodeGeneratorTest | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: TestResults-${{ matrix.os }}-dotnet_${{ matrix.dotnet-version }}.html | |
path: TestResults-${{ matrix.os }}-dotnet_${{ matrix.dotnet-version }}.html | |
- name: Create and validate NuGet package | |
run: dotnet pack --no-build --verbosity normal |