Skip to content

Commit

Permalink
Add support for net9.0 (#16573)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Antoine Griffard <[email protected]>
  • Loading branch information
sebastienros and agriffard authored Dec 4, 2024
1 parent de0346f commit ef644be
Show file tree
Hide file tree
Showing 29 changed files with 163 additions and 99 deletions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/targetframeworks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Change target frameworks
about: Update supported TFMs
title: 'Change target frameworks'
labels:
assignees: ''
---

- [ ] Update `global.json` to the required SDK version.
Use the minimal SDK version required, the `rollForward` rule will pick the latest version available on the machine. It's up to the user to update their SDK to the version they want in case there is an update and we don't want to force them into a newer version in case they can't install it.
- [ ] Update `src/OrchardCore.Build/TargetFrameworks.props`.
- [ ] Add a custom `AspNetCorePackagesVersion` for each TFM in `Directory.Packages.props`
- [ ] Update all `uses: actions/setup-dotnet` tasks to the required SDK version.
- [ ] Update all `dotnet publish`, `dotnet build` and `dotnet test` calls to the latest TFM, if specified.
- [ ] Update all `tasks.json` files to target the latest TFM
- [ ] Update the list of template **choices** (see the `template.json` files).
- [ ] Update docker file base images.
- [ ] Update documentation pages specifying a TFM (search for `<TargetFramework>`).
- [ ] Add a note about the supported .NET versions to the upcoming release notes.
10 changes: 5 additions & 5 deletions .github/workflows/functional_all_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- uses: actions/setup-node@v4
with:
node-version: "15"
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/mac_unit_test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
name: Unit Tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Build and test
run: |
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true
dotnet build -c Release /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true
dotnet test -c Release --no-restore --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
4 changes: 2 additions & 2 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
node-version: "15"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Build
# See pr_ci.yml for the reason why we disable NuGet audit warnings.
run: |
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true /p:NuGetAudit=false
dotnet build -c Release /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true /p:NuGetAudit=false
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
node-version: "15"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Build
# We disable NuGet audit warnings, see https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1901-nu1904.
# Security issues being discovered in NuGet packages we use can happen at any time, and thus all our CI builds that
# treat warnings as errors could break anytime, without us changing the code. This prevents that. Treating them as
# warnings and other better approaches don't work, see https://github.com/OrchardCMS/OrchardCore/pull/16317.
run: |
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true /p:NuGetAudit=false
dotnet build -c Release /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true /p:NuGetAudit=false
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/preview_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
- uses: actions/setup-dotnet@v4
if: steps.check-publish.outputs.should-publish == 'true'
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Set build number
if: steps.check-publish.outputs.should-publish == 'true'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV
- name: Build
if: steps.check-publish.outputs.should-publish == 'true'
# See pr_ci.yml for the reason why we disable NuGet audit warnings.
run: |
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true /p:NuGetAudit=false
dotnet build -c Release /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true /p:NuGetAudit=false
- name: Unit Tests
if: steps.check-publish.outputs.should-publish == 'true'
run: |
Expand Down Expand Up @@ -76,6 +76,6 @@ jobs:
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false
$output = [System.IO.Path]::GetFullPath("./.build/release")
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net9.0
docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push .
docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push .
6 changes: 3 additions & 3 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
node-version: "15"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: '9.0.x'
- name: Set build number
if: matrix.os == 'ubuntu-latest'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 15471 ))" >> $GITHUB_ENV
- name: Build
# NuGetAudit is intentionally not disabled here like it is for other CI builds, because we need to address any
# vulnerable packages before releasing a new version.
run: |
dotnet build -c Release -warnaserror /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true -p:Version=${{ steps.get_version.outputs.VERSION }}
dotnet build -c Release /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true -p:Version=${{ steps.get_version.outputs.VERSION }}
- name: Unit Tests
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
Expand Down Expand Up @@ -82,6 +82,6 @@ jobs:
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false
$output = [System.IO.Path]::GetFullPath("./.build/release")
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0
dotnet publish -c Release --property:PublishDir=$output --no-build --framework net9.0
docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:latest -t orchardproject/orchardcore-cms-linux:${{ steps.get_version.outputs.VERSION }} --push .
docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:latest -t orchardproject/orchardcore-cms-windows:${{ steps.get_version.outputs.VERSION }} --push .
22 changes: 11 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console debug) - net8.0",
"name": ".NET Core Launch (console debug) - net9.0",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "dotnet build (debug) - net8.0",
"program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Debug/net8.0/OrchardCore.Cms.Web.dll",
"preLaunchTask": "dotnet build (debug) - net9.0",
"program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Debug/net9.0/OrchardCore.Cms.Web.dll",
"args": [],
"cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
"env": {
Expand All @@ -15,12 +15,12 @@
"stopAtEntry": false
},
{
"name": ".NET Core Launch (web debug) - net8.0",
"name": ".NET Core Launch (web debug) - net9.0",
"type": "coreclr",
"request": "launch",
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "dotnet build (debug) - net8.0",
"program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Debug/net8.0/OrchardCore.Cms.Web.dll",
"preLaunchTask": "dotnet build (debug) - net9.0",
"program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Debug/net9.0/OrchardCore.Cms.Web.dll",
"args": [],
"cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
"env": {
Expand All @@ -33,11 +33,11 @@
}
},
{
"name": ".NET Core Launch (web release) - net8.0",
"name": ".NET Core Launch (web release) - net9.0",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "dotnet build (release) - net8.0",
"program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Release/net8.0/OrchardCore.Cms.Web.dll",
"preLaunchTask": "dotnet build (release) - net9.0",
"program": "${workspaceRoot}/src/OrchardCore.Cms.Web/bin/Release/net9.0/OrchardCore.Cms.Web.dll",
"args": [],
"cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web",
"env": {
Expand All @@ -50,10 +50,10 @@
}
},
{
"name": ".NET Core Launch (web debug) - dotnet watch - net8.0",
"name": ".NET Core Launch (web debug) - dotnet watch - net9.0",
"type": "dotnetwatchattach",
"request": "launch",
"task": "dotnet watch - net8.0",
"task": "dotnet watch - net9.0",
"program": "OrchardCore.Cms.Web.exe",
"args": {
"env": {
Expand Down
42 changes: 21 additions & 21 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
},
"tasks": [
{
"label": "dotnet watch - net8.0",
"label": "dotnet watch - net9.0",
"type": "process",
"command": "dotnet",
"args": [
"watch",
"run",
"${workspaceRoot}/src/OrchardCore.Cms.Web",
"-f",
"net8.0"
"net9.0"
],
"options": {
"cwd": "${workspaceRoot}/src/OrchardCore.Cms.Web"
Expand All @@ -48,7 +48,7 @@
"--project",
"${workspaceRoot}\\src\\OrchardCore.Cms.Web\\OrchardCore.Cms.Web.csproj",
"-f",
"net8.0"
"net9.0"
]
},
{
Expand Down Expand Up @@ -89,7 +89,7 @@
]
},
{
"label": "dotnet build (debug) - net8.0",
"label": "dotnet build (debug) - net9.0",
"type": "shell",
"command": "dotnet",
"args": [
Expand All @@ -98,12 +98,12 @@
"-c",
"Debug",
"-f",
"net8.0"
"net9.0"
],
"problemMatcher": "$msCompile"
},
{
"label": "dotnet build (release) - net8.0",
"label": "dotnet build (release) - net9.0",
"type": "shell",
"command": "dotnet",
"args": [
Expand All @@ -112,12 +112,12 @@
"-c",
"Release",
"-f",
"net8.0"
"net9.0"
],
"problemMatcher": "$msCompile"
},
{
"label": "dotnet rebuild (debug) - net8.0",
"label": "dotnet rebuild (debug) - net9.0",
"type": "shell",
"command": "dotnet",
"args": [
Expand All @@ -127,12 +127,12 @@
"-c",
"Debug",
"-f",
"net8.0"
"net9.0"
],
"problemMatcher": "$msCompile"
},
{
"label": "dotnet rebuild (release) - net8.0",
"label": "dotnet rebuild (release) - net9.0",
"type": "shell",
"command": "dotnet",
"args": [
Expand All @@ -142,7 +142,7 @@
"-c",
"Release",
"-f",
"net8.0"
"net9.0"
],
"problemMatcher": "$msCompile"
},
Expand All @@ -163,7 +163,7 @@
]
},
{
"label": "dotnet publish (self-contained) - release - net8.0",
"label": "dotnet publish (self-contained) - release - net9.0",
"type": "shell",
"command": "dotnet",
"windows": {
Expand All @@ -177,7 +177,7 @@
"win-x64",
"--self-contained",
"--framework",
"net8.0",
"net9.0",
"--output",
".\\.build\\release"
]
Expand All @@ -191,14 +191,14 @@
"linux-x64",
"--self-contained",
"--framework",
"net8.0",
"net9.0",
"--output",
"./.build/release"
],
"problemMatcher": "$msCompile"
},
{
"label": "dotnet publish (framework dependent) - release - net8.0",
"label": "dotnet publish (framework dependent) - release - net9.0",
"type": "shell",
"command": "dotnet",
"windows": {
Expand All @@ -213,7 +213,7 @@
"--self-contained",
"false",
"--framework",
"net8.0",
"net9.0",
"--output",
".\\.build\\release"
]
Expand All @@ -228,24 +228,24 @@
"--self-contained",
"false",
"--framework",
"net8.0",
"net9.0",
"--output",
"./.build/release"
],
"problemMatcher": "$msCompile"
},
{
"label": "tasks: dotnet publish release (self-contained) - net8.0",
"label": "tasks: dotnet publish release (self-contained) - net9.0",
"dependsOn": [
"cleanup publish folder",
"dotnet publish (self-contained) - net8.0"
"dotnet publish (self-contained) - net9.0"
]
},
{
"label": "tasks: dotnet publish release (framework dependent) - net8.0",
"label": "tasks: dotnet publish release (framework dependent) - net9.0",
"dependsOn": [
"cleanup publish folder",
"dotnet publish (framework dependent) - net8.0"
"dotnet publish (framework dependent) - net9.0"
]
},
{
Expand Down
Loading

0 comments on commit ef644be

Please sign in to comment.