diff --git a/.github/workflows/ci_testcontainers.yml b/.github/workflows/ci_testcontainers.yml new file mode 100644 index 00000000..f1dfe62e --- /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|(runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/test/WireMock.Net.Testcontainers.ConsoleApp/Program.cs b/test/WireMock.Net.Testcontainers.ConsoleApp/Program.cs new file mode 100644 index 00000000..9919614f --- /dev/null +++ b/test/WireMock.Net.Testcontainers.ConsoleApp/Program.cs @@ -0,0 +1,34 @@ +// Copyright © WireMock.Net + +using WireMock.Net.Testcontainers; + +namespace WireMock.Net.TestContainers.ConsoleApp; + +/// +/// 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 00000000..08ce0525 --- /dev/null +++ b/test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj @@ -0,0 +1,18 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + + + + +