From 22196cd0ec6cb321f28521df4d9cd3f97269d216 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 31 Dec 2024 09:06:40 +0100 Subject: [PATCH] Support .NET 9 (#281) --- Dockerfile | 4 ++-- .../Exercism.TestRunner.CSharp.csproj | 4 ++-- tests/AdditionalFiles/Fake.csproj | 2 +- tests/AllTestsWithTask/Fake.csproj | 2 +- tests/CompileErrorWithoutLocation/Fake.csproj | 2 +- tests/DifferentTypesOfTests/Fake.csproj | 2 +- tests/DotnetEightProject/.meta/config.json | 7 +++++++ tests/DotnetEightProject/Fake.cs | 4 ++++ tests/DotnetEightProject/Fake.csproj | 18 ++++++++++++++++++ tests/DotnetEightProject/FakeTests.cs | 6 ++++++ tests/DotnetEightProject/expected_results.json | 11 +++++++++++ tests/DownloadedSolution/Fake.csproj | 2 +- tests/EditorFiles/Fake.csproj | 2 +- tests/MultipleCompileErrors/Fake.csproj | 2 +- .../Fake.csproj | 2 +- tests/MultipleTestsWithAllPasses/Fake.csproj | 2 +- .../MultipleTestsWithMultipleFails/Fake.csproj | 2 +- tests/MultipleTestsWithSingleFail/Fake.csproj | 2 +- tests/MultipleTestsWithTestOutput/Fake.csproj | 2 +- .../Fake.csproj | 2 +- tests/NoTasks/Fake.csproj | 2 +- tests/NoTests/Fake.csproj | 2 +- tests/NotImplemented/Fake.csproj | 2 +- tests/SingleCompileError/Fake.csproj | 2 +- tests/SingleTestThatFails/Fake.csproj | 2 +- tests/SingleTestThatPasses/Fake.csproj | 2 +- .../Foo.csproj | 2 +- tests/SomeTestsWithTask/Fake.csproj | 2 +- tests/TestsInDifferentFormats/Fake.csproj | 2 +- tests/UseCultureAttribute/Fake.csproj | 2 +- tests/UseTimeZones/Fake.csproj | 2 +- tests/WithConstructor/Fake.csproj | 2 +- tests/WithDisposable/Fake.csproj | 2 +- tests/WithExample/Fake.csproj | 2 +- tests/WithNonTestClasses/Fake.csproj | 2 +- tests/WithPrivateDisposableClasses/Fake.csproj | 2 +- 36 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 tests/DotnetEightProject/.meta/config.json create mode 100644 tests/DotnetEightProject/Fake.cs create mode 100644 tests/DotnetEightProject/Fake.csproj create mode 100644 tests/DotnetEightProject/FakeTests.cs create mode 100644 tests/DotnetEightProject/expected_results.json diff --git a/Dockerfile b/Dockerfile index 1f79c8c..7b34324 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0.402-alpine3.19-amd64 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine3.20-amd64 AS build WORKDIR /app # Copy csproj and restore as distinct layers @@ -10,7 +10,7 @@ COPY src/Exercism.TestRunner.CSharp/ ./ RUN dotnet publish -r linux-musl-x64 -c Release -o /opt/test-runner --no-restore --self-contained true # Build runtime image -FROM mcr.microsoft.com/dotnet/runtime:8.0.8-alpine3.19-amd64 AS runtime +FROM mcr.microsoft.com/dotnet/runtime:9.0-alpine3.20-amd64 AS runtime # Enable globalization as some exercises use it ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false diff --git a/src/Exercism.TestRunner.CSharp/Exercism.TestRunner.CSharp.csproj b/src/Exercism.TestRunner.CSharp/Exercism.TestRunner.CSharp.csproj index c91cfb3..a88239f 100644 --- a/src/Exercism.TestRunner.CSharp/Exercism.TestRunner.CSharp.csproj +++ b/src/Exercism.TestRunner.CSharp/Exercism.TestRunner.CSharp.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 Exe true @@ -10,7 +10,7 @@ - + diff --git a/tests/AdditionalFiles/Fake.csproj b/tests/AdditionalFiles/Fake.csproj index a55016c..7396cca 100644 --- a/tests/AdditionalFiles/Fake.csproj +++ b/tests/AdditionalFiles/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/AllTestsWithTask/Fake.csproj b/tests/AllTestsWithTask/Fake.csproj index a55016c..7396cca 100644 --- a/tests/AllTestsWithTask/Fake.csproj +++ b/tests/AllTestsWithTask/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/CompileErrorWithoutLocation/Fake.csproj b/tests/CompileErrorWithoutLocation/Fake.csproj index a55016c..7396cca 100644 --- a/tests/CompileErrorWithoutLocation/Fake.csproj +++ b/tests/CompileErrorWithoutLocation/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/DifferentTypesOfTests/Fake.csproj b/tests/DifferentTypesOfTests/Fake.csproj index e455b70..1813498 100644 --- a/tests/DifferentTypesOfTests/Fake.csproj +++ b/tests/DifferentTypesOfTests/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/DotnetEightProject/.meta/config.json b/tests/DotnetEightProject/.meta/config.json new file mode 100644 index 0000000..328f3a2 --- /dev/null +++ b/tests/DotnetEightProject/.meta/config.json @@ -0,0 +1,7 @@ +{ + "files": { + "solution": ["Fake.cs"], + "test": ["FakeTests.cs"], + "example": [".meta/Example.cs"] + } +} \ No newline at end of file diff --git a/tests/DotnetEightProject/Fake.cs b/tests/DotnetEightProject/Fake.cs new file mode 100644 index 0000000..bfbf44e --- /dev/null +++ b/tests/DotnetEightProject/Fake.cs @@ -0,0 +1,4 @@ +public static class Fake +{ + public static int Add(int x, int y) => x + y; +} \ No newline at end of file diff --git a/tests/DotnetEightProject/Fake.csproj b/tests/DotnetEightProject/Fake.csproj new file mode 100644 index 0000000..a55016c --- /dev/null +++ b/tests/DotnetEightProject/Fake.csproj @@ -0,0 +1,18 @@ + + + + net8.0 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/DotnetEightProject/FakeTests.cs b/tests/DotnetEightProject/FakeTests.cs new file mode 100644 index 0000000..fecec13 --- /dev/null +++ b/tests/DotnetEightProject/FakeTests.cs @@ -0,0 +1,6 @@ +using Xunit; +public class FakeTests +{ + [Fact] + public void Add_should_add_numbers() => Assert.Equal(2, Fake.Add(1, 1)); +} \ No newline at end of file diff --git a/tests/DotnetEightProject/expected_results.json b/tests/DotnetEightProject/expected_results.json new file mode 100644 index 0000000..24c081e --- /dev/null +++ b/tests/DotnetEightProject/expected_results.json @@ -0,0 +1,11 @@ +{ + "version": 3, + "status": "pass", + "tests": [ + { + "name": "Add should add numbers", + "status": "pass", + "test_code": "Assert.Equal(2, Fake.Add(1, 1))" + } + ] +} diff --git a/tests/DownloadedSolution/Fake.csproj b/tests/DownloadedSolution/Fake.csproj index a55016c..7396cca 100644 --- a/tests/DownloadedSolution/Fake.csproj +++ b/tests/DownloadedSolution/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/EditorFiles/Fake.csproj b/tests/EditorFiles/Fake.csproj index a55016c..7396cca 100644 --- a/tests/EditorFiles/Fake.csproj +++ b/tests/EditorFiles/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleCompileErrors/Fake.csproj b/tests/MultipleCompileErrors/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleCompileErrors/Fake.csproj +++ b/tests/MultipleCompileErrors/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleTestClassesWithAllPasses/Fake.csproj b/tests/MultipleTestClassesWithAllPasses/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleTestClassesWithAllPasses/Fake.csproj +++ b/tests/MultipleTestClassesWithAllPasses/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleTestsWithAllPasses/Fake.csproj b/tests/MultipleTestsWithAllPasses/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleTestsWithAllPasses/Fake.csproj +++ b/tests/MultipleTestsWithAllPasses/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleTestsWithMultipleFails/Fake.csproj b/tests/MultipleTestsWithMultipleFails/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleTestsWithMultipleFails/Fake.csproj +++ b/tests/MultipleTestsWithMultipleFails/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleTestsWithSingleFail/Fake.csproj b/tests/MultipleTestsWithSingleFail/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleTestsWithSingleFail/Fake.csproj +++ b/tests/MultipleTestsWithSingleFail/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleTestsWithTestOutput/Fake.csproj b/tests/MultipleTestsWithTestOutput/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleTestsWithTestOutput/Fake.csproj +++ b/tests/MultipleTestsWithTestOutput/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj b/tests/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj index a55016c..7396cca 100644 --- a/tests/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj +++ b/tests/MultipleTestsWithTestOutputExceedingLimit/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/NoTasks/Fake.csproj b/tests/NoTasks/Fake.csproj index a55016c..7396cca 100644 --- a/tests/NoTasks/Fake.csproj +++ b/tests/NoTasks/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/NoTests/Fake.csproj b/tests/NoTests/Fake.csproj index a55016c..7396cca 100644 --- a/tests/NoTests/Fake.csproj +++ b/tests/NoTests/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/NotImplemented/Fake.csproj b/tests/NotImplemented/Fake.csproj index a55016c..7396cca 100644 --- a/tests/NotImplemented/Fake.csproj +++ b/tests/NotImplemented/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/SingleCompileError/Fake.csproj b/tests/SingleCompileError/Fake.csproj index a55016c..7396cca 100644 --- a/tests/SingleCompileError/Fake.csproj +++ b/tests/SingleCompileError/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/SingleTestThatFails/Fake.csproj b/tests/SingleTestThatFails/Fake.csproj index a55016c..7396cca 100644 --- a/tests/SingleTestThatFails/Fake.csproj +++ b/tests/SingleTestThatFails/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/SingleTestThatPasses/Fake.csproj b/tests/SingleTestThatPasses/Fake.csproj index a55016c..7396cca 100644 --- a/tests/SingleTestThatPasses/Fake.csproj +++ b/tests/SingleTestThatPasses/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/SingleTestThatPassesWithDifferentSlug/Foo.csproj b/tests/SingleTestThatPassesWithDifferentSlug/Foo.csproj index a55016c..7396cca 100644 --- a/tests/SingleTestThatPassesWithDifferentSlug/Foo.csproj +++ b/tests/SingleTestThatPassesWithDifferentSlug/Foo.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/SomeTestsWithTask/Fake.csproj b/tests/SomeTestsWithTask/Fake.csproj index a55016c..7396cca 100644 --- a/tests/SomeTestsWithTask/Fake.csproj +++ b/tests/SomeTestsWithTask/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/TestsInDifferentFormats/Fake.csproj b/tests/TestsInDifferentFormats/Fake.csproj index a55016c..7396cca 100644 --- a/tests/TestsInDifferentFormats/Fake.csproj +++ b/tests/TestsInDifferentFormats/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/UseCultureAttribute/Fake.csproj b/tests/UseCultureAttribute/Fake.csproj index 0be5426..da0c722 100644 --- a/tests/UseCultureAttribute/Fake.csproj +++ b/tests/UseCultureAttribute/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/UseTimeZones/Fake.csproj b/tests/UseTimeZones/Fake.csproj index 0be5426..da0c722 100644 --- a/tests/UseTimeZones/Fake.csproj +++ b/tests/UseTimeZones/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/WithConstructor/Fake.csproj b/tests/WithConstructor/Fake.csproj index a55016c..7396cca 100644 --- a/tests/WithConstructor/Fake.csproj +++ b/tests/WithConstructor/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/WithDisposable/Fake.csproj b/tests/WithDisposable/Fake.csproj index a55016c..7396cca 100644 --- a/tests/WithDisposable/Fake.csproj +++ b/tests/WithDisposable/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/WithExample/Fake.csproj b/tests/WithExample/Fake.csproj index a55016c..7396cca 100644 --- a/tests/WithExample/Fake.csproj +++ b/tests/WithExample/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/WithNonTestClasses/Fake.csproj b/tests/WithNonTestClasses/Fake.csproj index a55016c..7396cca 100644 --- a/tests/WithNonTestClasses/Fake.csproj +++ b/tests/WithNonTestClasses/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 diff --git a/tests/WithPrivateDisposableClasses/Fake.csproj b/tests/WithPrivateDisposableClasses/Fake.csproj index a55016c..7396cca 100644 --- a/tests/WithPrivateDisposableClasses/Fake.csproj +++ b/tests/WithPrivateDisposableClasses/Fake.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0