Skip to content

Commit 1b22556

Browse files
Upgrade to .NET 10 (#296)
* Migrate to new solution format * Upgrade .NET 10 Docker image * Use Ubuntu 24.04 runner * Only support .NET 9 and .NET 10 * Upgrade projects to .NET 10, xUnit v3 and latest versions of packages * Use long-form argument * Update README instructions to point to correct binary * Upgrade test runner packages * Update test command * Add RootNamespace to .NET 10 projects * Minor docker context tweaks * Update golden tests to new output format * Add script to update golden tests * No longer use read-only filesystem * Merge and rename tests * Fix package versions * Fix project file name * Fix rename * Fix .NET 9 projects * Fix Fscheck tests * Fix failing tests
1 parent 33526ac commit 1b22556

104 files changed

Lines changed: 344 additions & 939 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
*
2-
!bin/run.sh
3-
!bin/run-tests.sh
4-
!src/Exercism.TestRunner.FSharp
5-
src/Exercism.TestRunner.FSharp/bin
6-
src/Exercism.TestRunner.FSharp/obj
7-
.appends
8-
.git
9-
.github
10-
.gitignore
11-
.gitattributes
12-
.dockerignore
13-
Dockerfile
2+
!/bin/run.sh
3+
!/src/Exercism.TestRunner.FSharp
4+
/src/Exercism.TestRunner.FSharp/bin
5+
/src/Exercism.TestRunner.FSharp/obj

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
build:
1313
name: Tests
14-
runs-on: ubuntu-20.04
14+
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8

Dockerfile

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
1-
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build
1+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS build
22
ARG TARGETARCH
33

44
WORKDIR /tmp
55

66
# Pre-install packages for offline usage
77
RUN dotnet new console
8-
RUN dotnet add package Microsoft.NET.Test.Sdk -v 16.8.3
9-
RUN dotnet add package xunit -v 2.4.1
10-
RUN dotnet add package xunit.runner.visualstudio -v 2.4.3
11-
RUN dotnet add package FsUnit -v 4.0.4
12-
RUN dotnet add package FsUnit.xUnit -v 4.0.4
13-
RUN dotnet add package Exercism.Tests -v 0.1.0-alpha
14-
RUN dotnet add package Exercism.Tests -v 0.1.0-beta1
15-
RUN dotnet add package Aether -v 8.3.1
16-
RUN dotnet add package BenchmarkDotNet -v 0.12.1
17-
RUN dotnet add package FakeItEasy -v 6.2.1
18-
RUN dotnet add package FsCheck -v 2.14.3
19-
RUN dotnet add package FsCheck -v 2.16.3
20-
RUN dotnet add package FsCheck.Xunit -v 2.14.3
21-
RUN dotnet add package FSharp.Core -v 6.0.1
22-
RUN dotnet add package FSharp.Core -v 7.0.400
23-
RUN dotnet add package FSharp.Core -v 8.0.101
24-
RUN dotnet add package FSharp.Core -v 8.0.403
25-
RUN dotnet add package FSharp.Core -v 9.0.201
26-
RUN dotnet add package FParsec -v 1.1.1
27-
RUN dotnet add package FsToolkit.ErrorHandling -v 4.15.2
8+
RUN dotnet add package Microsoft.NET.Test.Sdk --version 16.8.3
9+
RUN dotnet add package Microsoft.NET.Test.Sdk --version 18.3.0
10+
RUN dotnet add package xunit --version 2.4.1
11+
RUN dotnet add package xunit.v3 --version 3.2.2
12+
RUN dotnet add package xunit.runner.visualstudio --version 2.4.3
13+
RUN dotnet add package xunit.runner.visualstudio --version 3.1.5
14+
RUN dotnet add package FsUnit --version 4.0.4
15+
RUN dotnet add package FsUnit.xUnit --version 4.0.4
16+
RUN dotnet add package FsUnit.xUnit --version 7.1.1
17+
RUN dotnet add package Exercism.Tests --version 0.1.0-alpha
18+
RUN dotnet add package Exercism.Tests --version 0.1.0-beta1
19+
RUN dotnet add package Exercism.Tests.xunit.v3 --version 0.1.0-beta1
20+
RUN dotnet add package Aether --version 8.3.1
21+
RUN dotnet add package BenchmarkDotNet --version 0.12.1
22+
RUN dotnet add package FakeItEasy --version 6.2.1
23+
RUN dotnet add package FsCheck --version 2.14.3
24+
RUN dotnet add package FsCheck --version 3.3.2
25+
RUN dotnet add package FsCheck.Xunit --version 2.14.3
26+
RUN dotnet add package FsCheck.Xunit.v3 --version 3.3.2
27+
RUN dotnet add package FSharp.Core --version 9.0.201
28+
RUN dotnet add package FSharp.Core --version 10.0.103
29+
RUN dotnet add package FParsec --version 1.1.1
30+
RUN dotnet add package FsToolkit.ErrorHandling --version 4.15.2
2831

2932
WORKDIR /app
3033

@@ -37,7 +40,7 @@ COPY src/Exercism.TestRunner.FSharp/ ./
3740
RUN dotnet publish -a $TARGETARCH -c Release -o /opt/test-runner --no-restore
3841

3942
# Build runtime image
40-
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS runtime
43+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.103-alpine3.23 AS runtime
4144

4245
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
4346
ENV DOTNET_ROLL_FORWARD=Major
@@ -48,6 +51,6 @@ WORKDIR /opt/test-runner
4851

4952
COPY --from=build /root/.nuget/packages/ /root/.nuget/packages/
5053
COPY --from=build /opt/test-runner/ .
51-
COPY bin/ bin/
54+
COPY bin/run.sh bin/run.sh
5255

5356
ENTRYPOINT ["sh", "/opt/test-runner/bin/run.sh"]

Exercism.TestRunner.FSharp.sln

Lines changed: 0 additions & 16 deletions
This file was deleted.

Exercism.TestRunner.FSharp.slnx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj" />
3+
</Solution>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This repository contains the F# test runner, which implements the [test runner i
99
To run a solution's tests, follow these steps:
1010

1111
1. Open a command prompt in the root directory.
12-
1. Run `./run.ps1 <exercise> <input-directory> <output-directory>`. This script will:
12+
1. Run `./bin/run.sh <exercise> <input-directory> <output-directory>`. This script will:
1313
1. Make sure all tests run (no skipped tests) for the solution found in `<input-directory>`.
1414
1. Run all the tests.
1515
1. Once the script has completed, the test results will be written to `<output-directory>/results.json`.
@@ -19,7 +19,7 @@ To run a solution's tests, follow these steps:
1919
To run a solution's tests using a Docker container, follow these steps:
2020

2121
1. Open a command prompt in the root directory.
22-
1. Run `./run-in-docker.ps1 <exercise> <input-directory> <output-directory>`. This script will:
22+
1. Run `./bin/run-in-docker.sh <exercise> <input-directory> <output-directory>`. This script will:
2323
1. Make sure all tests run (no skipped tests) for the solution found in `<input-directory>`.
2424
1. Run all the tests.
2525
1. Once the script has completed, the test results will be written to `<output-directory>/results.json`.

bin/run-in-docker.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ docker build --rm -t exercism/fsharp-test-runner .
3737
docker run \
3838
--rm \
3939
--network none \
40-
--read-only \
4140
--mount type=bind,src="${solution_dir}",dst=/solution \
4241
--mount type=bind,src="${output_dir}",dst=/output \
4342
--mount type=tmpfs,dst=/tmp \

bin/run-tests-in-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ docker build --rm -t exercism/fsharp-test-runner .
2020
docker run \
2121
--rm \
2222
--network none \
23-
--read-only \
2423
--mount type=bind,src="${PWD}/tests",dst=/opt/test-runner/tests \
24+
--mount type=bind,src="${PWD}/bin/run-tests.sh",dst=/opt/test-runner/bin/run-tests.sh \
2525
--mount type=tmpfs,dst=/tmp \
2626
--workdir /opt/test-runner \
2727
--entrypoint /opt/test-runner/bin/run-tests.sh \

bin/update-golden-tests.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env sh
2+
3+
# Synopsis:
4+
# Update the golden tests.
5+
6+
# Example:
7+
# ./bin/update-golden-tests.sh
8+
9+
# Generate the up-to-date results.json
10+
./bin/run-tests-in-docker.sh
11+
12+
# Overwrite the existing files
13+
find tests -name results.json -execdir cp results.json expected_results.json \;

src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
@@ -20,10 +20,10 @@
2020

2121
<ItemGroup>
2222
<PackageReference Include="CommandLineParser" Version="2.9.1" />
23-
<PackageReference Include="Fantomas.Core" Version="6.3.4" />
24-
<PackageReference Include="Fantomas.FCS" Version="6.3.4" />
25-
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
26-
<PackageReference Update="FSharp.Core" Version="9.0.201" />
23+
<PackageReference Include="Fantomas.Core" Version="7.0.5" />
24+
<PackageReference Include="Fantomas.FCS" Version="7.0.5" />
25+
<PackageReference Include="Humanizer.Core" Version="3.0.1" />
26+
<PackageReference Update="FSharp.Core" Version="10.0.103" />
2727
</ItemGroup>
2828

2929
</Project>

0 commit comments

Comments
 (0)