add support for .net 9 #499
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: "Main workflow" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
framework: [net6.0, net8.0, net9.0] | |
include: | |
- framework: net6.0 | |
dotnetVersion: "6.0.x" | |
- framework: net8.0 | |
dotnetVersion: "8.0.x" | |
- framework: net9.0 | |
dotnetVersion: "9.0.x" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet 6.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup dotnet 8.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup dotnet 9.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: browser-actions/setup-chrome@latest | |
- name: restore | |
run: dotnet restore | |
- name: build | |
run: dotnet build --configuration Release --no-restore | |
- name: test | |
run: dotnet test --configuration Release -f ${{ matrix.framework }} --no-restore | |
test_windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
framework: [net6.0, net8.0, net472, net9.0] | |
include: | |
- framework: net6.0 | |
dotnetVersion: "6.0.x" | |
- framework: net8.0 | |
dotnetVersion: "8.0.x" | |
- framework: net9.0 | |
dotnetVersion: "9.0.x" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet 6.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Setup dotnet 8.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup dotnet 9.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: nuget/setup-nuget@v2 | |
- run: nuget restore NuGetUtility.sln | |
- uses: browser-actions/setup-chrome@latest | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: build | |
run: msbuild -t:rebuild -property:Configuration=TestWindows | |
- name: test | |
uses: josepho0918/vstest-action@main | |
with: | |
testAssembly: "NuGetUtility.Test.dll" | |
searchFolder: "tests/NuGetUtility.Test/bin/TestWindows/${{ matrix.framework }}/" | |
runInParallel: true | |
check_licenses: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
framework: [net6.0, net8.0, net9.0] | |
project: [App, Tests, ProjectWithReferenceContainingLicenseExpression] | |
include: | |
- framework: net6.0 | |
dotnetVersion: "6.0.x" | |
- framework: net8.0 | |
dotnetVersion: "8.0.x" | |
- framework: net9.0 | |
dotnetVersion: "9.0.x" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup dotnet ${{ matrix.dotnetVersion }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.dotnetVersion }} | |
- name: restore | |
run: dotnet restore NuGetUtility.sln -p:TargetFramework=${{ matrix.framework }} | |
- name: build | |
run: dotnet publish ./src/NuGetLicenseCore/NuGetLicenseCore.csproj --configuration Release -o ./release -f ${{ matrix.framework }} --no-restore | |
- name: check | |
run: dotnet ./release/NuGetLicenseCore.dll -ji ./.github/workflows/assets/${{ matrix.project }}/projectsToCheck.json -t -a ./.github/workflows/assets/${{ matrix.project }}/allowedLicenses.json -o JsonPretty -override ./.github/workflows/assets/${{ matrix.project }}/overwritePackageInformation.json -ignore ./.github/workflows/assets/${{ matrix.project }}/ignorePackages.json -mapping ./.github/workflows/assets/${{ matrix.project }}/urlToLicenseMapping.json -d ./licenses/${{ matrix.project }}/${{ matrix.framework }} | |
- name: show downloaded licenses | |
shell: pwsh | |
run: | | |
foreach($file in Get-ChildItem -Path ./licenses/${{ matrix.project }}/${{ matrix.framework }}) | |
{ | |
Write-Host ::group::$file | |
Get-Content $file.FullName | |
Write-Host ::endgroup:: | |
} | |
check_licenses_net472: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
project: [App, Tests, ProjectWithReferenceContainingLicenseExpression] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup dotnet 9.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: nuget/setup-nuget@v2 | |
- run: nuget restore NuGetUtility.sln | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: fully qualify release path | |
id: release_path | |
shell: pwsh | |
run: | | |
$path = [System.IO.Path]::GetFullPath("./release"); | |
echo "publish to path: $path" | |
echo "path=$path" >> $env:GITHUB_OUTPUT | |
- name: build | |
run: msbuild ./src/NuGetLicenseFramework/NuGetLicenseFramework.csproj /t:Publish /p:configuration=Release /p:PublishDir=${{ steps.release_path.outputs.path }} /p:TargetFramework=net472 | |
- name: check | |
run: ${{ steps.release_path.outputs.path }}/NuGetLicenseFramework.exe -ji ./.github/workflows/assets/${{ matrix.project }}/projectsToCheck.json -t -a ./.github/workflows/assets/${{ matrix.project }}/allowedLicenses.json -o JsonPretty -override ./.github/workflows/assets/${{ matrix.project }}/overwritePackageInformation.json -ignore ./.github/workflows/assets/${{ matrix.project }}/ignorePackages.json -mapping ./.github/workflows/assets/${{ matrix.project }}/urlToLicenseMapping.json -d ./licenses/${{ matrix.project }} | |
- name: show downloaded licenses | |
shell: pwsh | |
run: | | |
foreach($file in Get-ChildItem -Path ./licenses/${{ matrix.project }}) | |
{ | |
Write-Host ::group::$file | |
Get-Content $file.FullName | |
Write-Host ::endgroup:: | |
} | |
check_version_command: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
framework: [net6.0, net8.0, net9.0] | |
include: | |
- framework: net6.0 | |
dotnetVersion: "6.0.x" | |
- framework: net8.0 | |
dotnetVersion: "8.0.x" | |
- framework: net9.0 | |
dotnetVersion: "9.0.x" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup dotnet ${{ matrix.dotnetVersion }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.dotnetVersion }} | |
- name: restore | |
run: dotnet restore NuGetUtility.sln -p:TargetFramework=${{ matrix.framework }} | |
- uses: paulhatch/[email protected] | |
id: version | |
name: version | |
with: | |
tag_prefix: "v" | |
version_format: "${major}.${minor}.${patch}-test${increment}" | |
- name: build | |
run: dotnet publish ./src/NuGetLicenseCore/NuGetLicenseCore.csproj --configuration Release -o ./release -f ${{ matrix.framework }} --no-restore -p:Version=${{ steps.version.outputs.version }} | |
- name: check app version | |
shell: pwsh | |
run: | | |
$cmdOutput = dotnet ./release/NuGetLicenseCore.dll --version | Out-String | |
if(!($cmdOutput.Trim() -like '${{ steps.version.outputs.version }}')) { | |
Write-Host Versions do not match: read $cmdOutput, expected ${{ steps.version.outputs.version }} | |
exit 1; | |
} | |
check_version_command_net472: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup dotnet 9.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- uses: nuget/setup-nuget@v2 | |
- run: nuget restore NuGetUtility.sln | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: fully qualify release path | |
id: release_path | |
shell: pwsh | |
run: | | |
$path = [System.IO.Path]::GetFullPath("./release"); | |
echo "publish to path: $path" | |
echo "path=$path" >> $env:GITHUB_OUTPUT | |
- uses: paulhatch/[email protected] | |
id: version | |
name: version | |
with: | |
tag_prefix: "v" | |
version_format: "${major}.${minor}.${patch}-test${increment}" | |
- name: build | |
run: msbuild ./src/NuGetLicenseFramework/NuGetLicenseFramework.csproj /t:Publish /p:configuration=Release /p:PublishDir=${{ steps.release_path.outputs.path }} /p:Version=${{ steps.version.outputs.version }} /p:TargetFramework=net472 | |
- name: check app version | |
shell: pwsh | |
run: | | |
$cmdOutput = ${{ steps.release_path.outputs.path }}/NuGetLicenseFramework.exe --version | Out-String | |
if(!($cmdOutput.Trim() -like '${{ steps.version.outputs.version }}')) { | |
Write-Host Versions do not match: read $cmdOutput, expected ${{ steps.version.outputs.version }} | |
exit 1; | |
} |