Skip to content

Commit 64a0bfa

Browse files
authored
Update the .NET TFMs for Npgsql 8 (#4878)
- Remove netcoreapp3.1 and net5.0 (out of support) - Add net8.0 - Upgrade DeveloperBuild to net8.0
1 parent 63f31bc commit 64a0bfa

23 files changed

Lines changed: 80 additions & 78 deletions

File tree

.devcontainer/docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ version: '3'
22

33
services:
44
npgsql-dev:
5-
image: mcr.microsoft.com/dotnet/sdk:7.0
5+
# Source for tags: https://mcr.microsoft.com/v2/dotnet/sdk/tags/list
6+
image: mcr.microsoft.com/dotnet/sdk:8.0.100-preview.1
67
volumes:
78
- ..:/workspace:cached
89
tty: true

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
dotnet_sdk_version: '7.0.100'
13+
dotnet_sdk_version: '8.0.100-preview.1.23115.2'
1414
postgis_version: 3
1515
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
1616
# Windows comes with PG pre-installed, and defines the PGPASSWORD environment variable. Remove it as it interferes
@@ -27,24 +27,24 @@ jobs:
2727
os: [ubuntu-22.04, windows-2022]
2828
pg_major: [15, 14, 13, 12, 11, 10]
2929
config: [Release]
30-
test_tfm: [net7.0]
30+
test_tfm: [net8.0]
3131
include:
3232
- os: ubuntu-22.04
3333
pg_major: 15
3434
config: Debug
35-
test_tfm: net7.0
35+
test_tfm: net8.0
3636
- os: ubuntu-22.04
3737
pg_major: 15
3838
config: Release
3939
test_tfm: netcoreapp3.1
4040
- os: macos-12
4141
pg_major: 14
4242
config: Release
43-
test_tfm: net7.0
43+
test_tfm: net8.0
4444
# - os: ubuntu-22.04
4545
# pg_major: 15
4646
# config: Release
47-
# test_tfm: net7.0
47+
# test_tfm: net8.0
4848
# pg_prerelease: 'PG Prerelease'
4949

5050
outputs:

.github/workflows/codeql-analysis.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on:
2626
schedule:
2727
- cron: '21 0 * * 4'
2828

29+
env:
30+
dotnet_sdk_version: '8.0.100-preview.1.23115.2'
31+
2932
jobs:
3033
analyze:
3134
name: Analyze
@@ -56,10 +59,18 @@ jobs:
5659
# Prefix the list here with "+" to use these queries and those in the config file.
5760
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5861

62+
- name: Setup .NET Core SDK
63+
uses: actions/setup-dotnet@v3.0.3
64+
with:
65+
dotnet-version: ${{ env.dotnet_sdk_version }}
66+
67+
- name: Build
68+
run: dotnet build -c Release
69+
5970
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6071
# If this step fails, then you should remove it and run the build manually (see below)
61-
- name: Autobuild
62-
uses: github/codeql-action/autobuild@v2
72+
#- name: Autobuild
73+
# uses: github/codeql-action/autobuild@v2
6374

6475
# ℹ️ Command-line programs to run using the OS shell.
6576
# 📚 https://git.io/JvXDl

.github/workflows/native-aot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
dotnet_sdk_version: '7.0.102'
13+
dotnet_sdk_version: '8.0.100-preview.1.23115.2'
1414
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
1515

1616
jobs:
@@ -46,7 +46,7 @@ jobs:
4646
shell: bash
4747

4848
- name: Build
49-
run: dotnet publish test/Npgsql.NativeAotTests/Npgsql.NativeAotTests.csproj -r linux-x64 -c Release -f net7.0
49+
run: dotnet publish test/Npgsql.NativeAotTests/Npgsql.NativeAotTests.csproj -r linux-x64 -c Release -f net8.0
5050
shell: bash
5151

5252
# Uncomment the following to SSH into the agent running the build (https://github.com/mxschmitt/action-tmate)
@@ -61,19 +61,19 @@ jobs:
6161
sudo -u postgres psql -c "CREATE DATABASE npgsql_tests OWNER npgsql_tests"
6262
6363
- name: Run
64-
run: test/Npgsql.NativeAotTests/bin/Release/net7.0/linux-x64/native/Npgsql.NativeAotTests
64+
run: test/Npgsql.NativeAotTests/bin/Release/net8.0/linux-x64/native/Npgsql.NativeAotTests
6565

6666
- name: Write binary size to summary
6767
run: |
68-
size="$(ls -l test/Npgsql.NativeAotTests/bin/Release/net7.0/linux-x64/native/Npgsql.NativeAotTests | cut -d ' ' -f 5)"
68+
size="$(ls -l test/Npgsql.NativeAotTests/bin/Release/net8.0/linux-x64/native/Npgsql.NativeAotTests | cut -d ' ' -f 5)"
6969
echo "Binary size is $size bytes ($((size / (1024 * 1024))) mb)" >> $GITHUB_STEP_SUMMARY
7070
7171
- name: Dump mstat
72-
run: dotnet run --project test/MStatDumper/MStatDumper.csproj -c release -- "test/Npgsql.NativeAotTests/obj/Release/net7.0/linux-x64/native/Npgsql.NativeAotTests.mstat" md >> $GITHUB_STEP_SUMMARY
72+
run: dotnet run --project test/MStatDumper/MStatDumper.csproj -c release -f net8.0 -- "test/Npgsql.NativeAotTests/obj/Release/net8.0/linux-x64/native/Npgsql.NativeAotTests.mstat" md >> $GITHUB_STEP_SUMMARY
7373

7474
- name: Assert binary size
7575
run: |
76-
size="$(ls -l test/Npgsql.NativeAotTests/bin/Release/net7.0/linux-x64/native/Npgsql.NativeAotTests | cut -d ' ' -f 5)"
76+
size="$(ls -l test/Npgsql.NativeAotTests/bin/Release/net8.0/linux-x64/native/Npgsql.NativeAotTests | cut -d ' ' -f 5)"
7777
echo "Binary size is $size bytes ($((size / (1024 * 1024))) mb)"
7878
7979
if (( size > 36700160 )); then

.github/workflows/rich-code-nav.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- '*'
1010

1111
env:
12-
dotnet_sdk_version: '7.0.100'
12+
dotnet_sdk_version: '8.0.100-preview.1.23115.2'
1313
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
1414

1515
jobs:

Directory.Packages.props

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
<Project>
22
<ItemGroup>
33
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
4-
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
54
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
65
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
76

8-
<PackageVersion Include="System.Text.Json" Version="7.0.2" />
9-
<PackageVersion Include="System.Threading.Channels" Version="7.0.0" />
10-
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
11-
<PackageVersion Include="System.Collections.Immutable" Version="7.0.0" />
12-
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.0" />
137
<PackageVersion Include="OpenTelemetry.API" Version="1.3.2" />
148
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
159

@@ -45,4 +39,20 @@
4539
<!-- NativeAOT -->
4640
<PackageVersion Include="Mono.Cecil" Version="0.11.4" />
4741
</ItemGroup>
42+
43+
<!-- Compatibility -->
44+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
45+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
46+
</ItemGroup>
47+
48+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' ">
49+
<PackageVersion Include="System.Text.Json" Version="7.0.2" />
50+
<PackageVersion Include="System.Threading.Channels" Version="7.0.0" />
51+
<PackageVersion Include="System.Collections.Immutable" Version="7.0.0" />
52+
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.0" />
53+
</ItemGroup>
54+
55+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net6.0' ">
56+
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
57+
</ItemGroup>
4858
</Project>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "7.0.100",
3+
"version": "8.0.100",
44
"rollForward": "latestMajor",
55
"allowPrerelease": "true"
66
}

src/Npgsql.DependencyInjection/Npgsql.DependencyInjection.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<PropertyGroup>
44
<Authors>Shay Rojansky</Authors>
55
<!-- DbDataSource was introduced to .NET in net7.0. Before that Npgsql has its own built-in copy. -->
6-
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>
7-
<TargetFrameworks Condition="'$(DeveloperBuild)' == 'True'">net7.0</TargetFrameworks>
6+
<TargetFrameworks Condition="'$(DeveloperBuild)' != 'True'">netstandard2.0;net7.0</TargetFrameworks>
7+
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
88
<PackageTags>npgsql;postgresql;postgres;ado;ado.net;database;sql;di;dependency injection</PackageTags>
99
<PackageReadmeFile>README.md</PackageReadmeFile>
1010
</PropertyGroup>

src/Npgsql.GeoJSON/Npgsql.GeoJSON.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Description>GeoJSON plugin for Npgsql, allowing mapping of PostGIS geometry types to GeoJSON types.</Description>
55
<PackageTags>npgsql;postgresql;postgres;postgis;geojson;spatial;ado;ado.net;database;sql</PackageTags>
66
<TargetFramework>netstandard2.0</TargetFramework>
7-
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net7.0</TargetFramework>
7+
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
88
</PropertyGroup>
99

1010
<ItemGroup>

src/Npgsql.Json.NET/Npgsql.Json.NET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Description>Json.NET plugin for Npgsql, allowing transparent serialization/deserialization of JSON objects directly to and from the database.</Description>
55
<PackageTags>npgsql;postgresql;json;postgres;ado;ado.net;database;sql</PackageTags>
66
<TargetFramework>netstandard2.0</TargetFramework>
7-
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net7.0</TargetFramework>
7+
<TargetFramework Condition="'$(DeveloperBuild)' == 'True'">net8.0</TargetFramework>
88
</PropertyGroup>
99

1010
<ItemGroup>

0 commit comments

Comments
 (0)