diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml
index c23aa96ac..7f3b975a1 100644
--- a/.github/workflows/buildtest.yaml
+++ b/.github/workflows/buildtest.yaml
@@ -26,6 +26,43 @@ jobs:
run: dotnet build --configuration Release -v detailed
- name: Test
run: dotnet test /p:CollectCoverage=true /p:ExcludeByFile=\"**/KubernetesClient/generated/**/*.cs\" /p:CoverletOutputFormat="cobertura"
+
+ # Build and test netstandard2.0/2.1 version of library with .NET Core 6.0
+ netstandard:
+ runs-on: ubuntu-latest
+ name: Dotnet build
+ strategy:
+ matrix:
+ netstandard-version: [netstandard2.0, netstandard2.1]
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v2
+ with:
+ dotnet-version: |
+ 5.0.x
+ 6.0.x
+ # Build KubernetesClient with specific netstandard version
+ - name: Build libraries
+ run: |
+ dotnet build -f ${{ matrix.netstandard-version }} --configuration Debug -v minimal ./src/KubernetesClient/KubernetesClient.csproj
+ dotnet build -f netstandard2.0 --configuration Debug -v minimal ./tests/SkipTestLogger/SkipTestLogger.csproj
+ # Build KubernetesClient.Tests and E2E.Tests
+ - name: Build test projects with ${{ matrix.netstandard-version }} version of KubernetesClient
+ run: |
+ dotnet build --configuration Debug -v minimal --no-dependencies -p:KubernetesClientVersion="${{ matrix.netstandard-version }}" ./tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
+ dotnet build --configuration Debug -v minimal --no-dependencies -p:KubernetesClientVersion="${{ matrix.netstandard-version }}" ./tests/E2E.Tests/E2E.Tests.csproj
+ # Run compiled KubernetesClient.Tests and E2E.Tests
+ - name: Run test projects with ${{ matrix.netstandard-version }} version of KubernetesClient
+ run: |
+ # Run KubernetesClient.Tests.csproj
+ dotnet test ./tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj \
+ /p:CollectCoverage=true /p:ExcludeByFile=\"**/KubernetesClient/generated/**/*.cs\" /p:CoverletOutputFormat="cobertura" --no-build /p:KubernetesClientVersion="${{ matrix.netstandard-version }}"
+ # Run E2E.Tests.csproj
+ dotnet test ./tests/E2E.Tests/E2E.Tests.csproj \
+ /p:CollectCoverage=true /p:ExcludeByFile=\"**/KubernetesClient/generated/**/*.cs\" /p:CoverletOutputFormat="cobertura" --no-build /p:KubernetesClientVersion="${{ matrix.netstandard-version }}"
# Test code gen for visual studio compatibility >> https://github.com/kubernetes-client/csharp/pull/1008
codgen:
diff --git a/src/KubernetesClient/KubernetesClient.csproj b/src/KubernetesClient/KubernetesClient.csproj
index c6f2aa0be..be71ada18 100644
--- a/src/KubernetesClient/KubernetesClient.csproj
+++ b/src/KubernetesClient/KubernetesClient.csproj
@@ -1,29 +1,29 @@
-
- netstandard2.1;net5.0;net6.0
- k8s
-
+
+ netstandard2.0;netstandard2.1;net5.0;net6.0
+ k8s
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
diff --git a/tests/E2E.Tests/E2E.Tests.csproj b/tests/E2E.Tests/E2E.Tests.csproj
index 7b96f2206..980706483 100644
--- a/tests/E2E.Tests/E2E.Tests.csproj
+++ b/tests/E2E.Tests/E2E.Tests.csproj
@@ -1,33 +1,75 @@
-
- false
- true
- k8s.E2E
- netcoreapp3.1;net5.0;net6.0
-
+
+ false
+ true
+ k8s.E2E
+ net5.0;net6.0
+
-
+
-
-
+
+
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ KUBERNETESCLIENT_NETSTANDARD2_0
+
+
+
+
+
+
+
+
+
+
+ KUBERNETESCLIENT_NETSTANDARD2_1
+
+
+
+
diff --git a/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj b/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj
index 39ba130a5..d3d85fff0 100644
--- a/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj
+++ b/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj
@@ -1,28 +1,28 @@
-
- false
- k8s.Tests
- net6.0
- net6.0;net48
-
+
+ false
+ k8s.Tests
+ net6
+ net6;net48
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
- all
- runtime; build; native; contentfiles; analyzers
-
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
@@ -33,10 +33,11 @@
-
-
+
+
-
-
-
+
+
+
+
diff --git a/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj b/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
index 5bdaa967a..8e2d148ed 100644
--- a/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
+++ b/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
@@ -1,26 +1,26 @@
-
- false
- k8s.Tests
- netcoreapp3.1;net5.0;net6.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
+
+ false
+ k8s.Tests
+ net5.0;net6.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
@@ -31,21 +31,60 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+ KUBERNETESCLIENT_NETSTANDARD2_0
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ KUBERNETESCLIENT_NETSTANDARD2_1
+
+
+
+
diff --git a/tests/KubernetesClient.Tests/WatchTests.cs b/tests/KubernetesClient.Tests/WatchTests.cs
index bddf0c23c..3a859f0f8 100644
--- a/tests/KubernetesClient.Tests/WatchTests.cs
+++ b/tests/KubernetesClient.Tests/WatchTests.cs
@@ -1,3 +1,6 @@
+// Exclusion of watch tests on netstandard2.0 version of KubernetesClient because the feature is unsupported
+#if !KUBERNETESCLIENT_NETSTANDARD2_0
+
using k8s.Models;
using k8s.Tests.Mock;
using Microsoft.AspNetCore.Http;
@@ -741,3 +744,5 @@ public async Task MustHttp2VersionSet()
}
}
}
+
+#endif