diff --git a/.github/scripts/update-testdata-targetframework.ps1 b/.github/scripts/update-testdata-targetframework.ps1 index 67f6ef00c..c37fdbf55 100644 --- a/.github/scripts/update-testdata-targetframework.ps1 +++ b/.github/scripts/update-testdata-targetframework.ps1 @@ -3,7 +3,7 @@ param() $ErrorActionPreference = 'Stop' Write-Host "Creating global.json to enforce .NET 8 for MSBuild" -$globalJson = '{"sdk":{"version":"8.0.0","rollForward":"latestFeature"}}' +$globalJson = '{"sdk":{"version":"8.0.100","rollForward":"latestFeature"}}' [System.IO.File]::WriteAllText('global.json', $globalJson, [System.Text.Encoding]::UTF8) Write-Host "Searching for project files under Tests/TestData..." diff --git a/.github/workflows/dotnet-tests.yml b/.github/workflows/dotnet-tests.yml index 0fe9bc6f9..685c387d6 100644 --- a/.github/workflows/dotnet-tests.yml +++ b/.github/workflows/dotnet-tests.yml @@ -6,9 +6,6 @@ on: runs-on: required: true type: string - vs-version: - required: true - type: string dotnet-version: required: true type: string @@ -16,6 +13,9 @@ on: jobs: test: runs-on: ${{ inputs.runs-on }} + env: + # Tests only need the matching target framework; the slnf also builds the Web project, which needs node + TestFramework: net${{ inputs.dotnet-version == '8.0.x' && '8.0' || '10.0' }} steps: - uses: actions/checkout@v4 @@ -24,24 +24,17 @@ jobs: with: dotnet-version: ${{ inputs.dotnet-version }} - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 - with: - vs-version: ${{ inputs.vs-version }} + - name: Log .NET version + run: dotnet --info + # Build with the newest SDK (the projects also target net10.0); only the test run is pinned to SDK 8 - name: Build - run: dotnet build DotNetBuildable.slnf /p:Configuration=Release + run: dotnet build Tests/Tests.csproj -c Release -f ${{ env.TestFramework }} - name: Create global.json to enforce .NET 8 for MSBuild and update Tests/TestData projects if: inputs.dotnet-version == '8.0.x' shell: pwsh run: ./.github/scripts/update-testdata-targetframework.ps1 - - name: Log MSBuild version - run: msbuild -version - - - name: Log .NET version - run: dotnet --info - - name: Execute unit tests - run: dotnet test Tests/Tests.csproj -c Release --framework net${{ inputs.dotnet-version == '8.0.x' && '8.0' || '10.0' }} --no-build + run: dotnet test Tests/Tests.csproj -c Release -f ${{ env.TestFramework }} --no-build diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c7dd3661f..bfd8057cc 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -72,16 +72,14 @@ jobs: name: ICSharpCode.CodeConverter.Func.${{ env.BuildVersion }}.zip path: Func/bin/${{ env.BuildTarget }}/publish/ - test-vs2022: + test-windows-latest: uses: ./.github/workflows/dotnet-tests.yml with: - runs-on: windows-2022 - vs-version: '[17.0,18.0)' - dotnet-version: 8.0.x + runs-on: windows-latest + dotnet-version: 10.0.x - test-vs2026: + test-linux-previous: uses: ./.github/workflows/dotnet-tests.yml with: - runs-on: windows-2025-vs2026 - vs-version: '[18.0,)' - dotnet-version: 10.0.x + runs-on: ubuntu-latest + dotnet-version: 8.0.x