From 8bf23f6c4dfd668ba0a81b2986bc5304d05332eb Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Fri, 20 Nov 2026 17:27:41 +0100 Subject: [PATCH 1/2] Test Testcontainers ConsoleApp on Linux --- .github/workflows/ci_testcontainers.yml | 44 +++++++++++++++++++ WireMock.Net Solution.sln | 15 +++++++ .../Program.cs | 2 +- .../Program.cs | 34 ++++++++++++++ ...eMock.Net.Testcontainers.ConsoleApp.csproj | 18 ++++++++ 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci_testcontainers.yml create mode 100644 test/WireMock.Net.Testcontainers.ConsoleApp/Program.cs create mode 100644 test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj diff --git a/.github/workflows/ci_testcontainers.yml b/.github/workflows/ci_testcontainers.yml new file mode 100644 index 000000000..f1dfe62e6 --- /dev/null +++ b/.github/workflows/ci_testcontainers.yml @@ -0,0 +1,44 @@ +name: Run Testcontainers ConsoleApp + +on: + pull_request: + branches: + - '**' + push: + branches: + - 'main' + +permissions: + contents: read + +jobs: + linux-testcontainers: + name: Test Testcontainers ConsoleApp on Linux + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Setup .NET 10 + uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5 + with: + dotnet-version: 10.0.x + + - name: Update Testcontainers to the latest stable version + run: | + CSPROJ='./test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj' + LATEST=$(curl -fsSL https://api.nuget.org/v3-flatcontainer/testcontainers/index.json \ + | jq -r '[.versions[] | select(contains("-") | not)] | last') + if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then + echo "Could not determine the latest Testcontainers version" + exit 1 + fi + echo "Latest Testcontainers version: $LATEST" + sed -i -E "s|( +/// Test if WireMock.Net.Testcontainers is compatible with the latest version of Testcontainers for .NET +/// +internal class Program +{ + private static async Task Main(string[] args) + { + try + { + await TestAsync(); + return 0; + } + catch (Exception ex) + { + Console.Error.WriteLine(ex); + return 1; + } + } + + private static async Task TestAsync() + { + var builder = new WireMockContainerBuilder() + .WithLinuxImage() + .WithWatchStaticMappings(true); + + _ = builder.Build(); + } +} \ No newline at end of file diff --git a/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj b/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj new file mode 100644 index 000000000..fdd6f0839 --- /dev/null +++ b/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj @@ -0,0 +1,18 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + + + + + From cbbad6b1b01a359ce69d53d09abfa9ad2f7193bb Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Fri, 20 Nov 2026 17:30:10 +0100 Subject: [PATCH 2/2] fix --- .../WireMock.Net.Testcontainers.csproj | 2 +- .../WireMock.Net.Testcontainers.ConsoleApp.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj index f5954d956..2892b9d45 100644 --- a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj +++ b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj @@ -39,7 +39,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj b/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj index fdd6f0839..08ce0525d 100644 --- a/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj +++ b/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj @@ -8,7 +8,7 @@ - +