mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-11-15 05:12:45 +01:00
* Switch to IHost for .NET 10 * 'dotnet-WireMock stops on CTRL-C' * Potential fix for pull request finding 'Missing Dispose call on local IDisposable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * . --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
121 lines
4.8 KiB
YAML
121 lines
4.8 KiB
YAML
name: Run Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
windows-build-and-run:
|
|
name: Run Tests on Windows
|
|
runs-on: windows-2022
|
|
|
|
env:
|
|
IsRunningOnGitHubActions: 'true'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET 8 and 10
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: |
|
|
8.0.x
|
|
10.0.x
|
|
|
|
# - name: 'WireMock.Net.TUnitTests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.TUnitTests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj' -c Release --framework net10.0
|
|
|
|
# - name: 'WireMock.Net.Tests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.Tests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net10.0
|
|
|
|
# - name: 'WireMock.Net.Tests.UsingNuGet'
|
|
# run: dotnet test --project './test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj' -c Release
|
|
|
|
# - name: 'WireMock.Net.Middleware.Tests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.Middleware.Tests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj' -c Release --framework net10.0
|
|
|
|
linux-build-and-run:
|
|
name: Run Tests on Linux
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
IsRunningOnGitHubActions: 'true'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET 8 and 10
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: |
|
|
8.0.x
|
|
10.0.x
|
|
|
|
# - name: 'WireMock.Net.TUnitTests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.TUnitTests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj' -c Release --framework net10.0
|
|
|
|
# - name: 'WireMock.Net.Tests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.Tests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net10.0
|
|
|
|
- name: 'WireMock.Net.Tests.UsingNuGet (net8.0)'
|
|
run: dotnet test --project './test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj' -c Release --framework net8.0
|
|
|
|
# - name: 'WireMock.Net.Tests.UsingNuGet (net10.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj' -c Release --framework net10.0
|
|
|
|
# - name: 'WireMock.Net.Middleware.Tests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.Middleware.Tests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj' -c Release --framework net10.0
|
|
|
|
# - name: 'WireMock.Net.Aspire.Tests (net8.0)'
|
|
# run: dotnet test --project './test/WireMock.Net.Aspire.Tests/WireMock.Net.Aspire.Tests.csproj' -c Release --framework net8.0
|
|
|
|
- name: 'WireMock.Net.Aspire.Tests (net10.0)'
|
|
run: dotnet test --project './test/WireMock.Net.Aspire.Tests/WireMock.Net.Aspire.Tests.csproj' -c Release --framework net10.0
|
|
|
|
- name: 'dotnet-WireMock stops on CTRL-C'
|
|
run: |
|
|
set -m # job control, so the background process does not ignore SIGINT
|
|
dotnet build ./src/dotnet-WireMock.Net/dotnet-WireMock.csproj -c Release
|
|
dotnet ./src/dotnet-WireMock.Net/bin/Release/net10.0/dotnet-WireMock.dll --Urls http://localhost:0 > wiremock.log 2>&1 & # port 0 = OS assigns a free port
|
|
PID=$!
|
|
sleep 3
|
|
grep -q 'Server listening at' wiremock.log || { cat wiremock.log; kill -9 $PID; exit 1; }
|
|
kill -INT $PID
|
|
for i in $(seq 1 10); do
|
|
if ! kill -0 $PID 2>/dev/null; then
|
|
EXIT_CODE=0
|
|
wait $PID || EXIT_CODE=$?
|
|
echo "dotnet-WireMock stopped (exit code $EXIT_CODE)"
|
|
exit $EXIT_CODE
|
|
fi
|
|
sleep 1
|
|
done
|
|
echo "dotnet-WireMock did not stop within 10 seconds after CTRL-C"
|
|
kill -9 $PID
|
|
exit 1
|