Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET enable windows on intergration test #4622

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ jobs:
- name: Prepare python venv
run: |
source ${{ github.workspace }}/python/.venv/bin/activate
- name: Setup .NET 8.0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
global-json-file: dotnet/global.json
- name: Restore dependencies
run: |
# dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config
Expand All @@ -108,8 +108,7 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest]
version: [ net8.0 ]
os: [ ubuntu-latest, windows-latest ]
needs: build
defaults:
run:
Expand All @@ -127,20 +126,15 @@ jobs:
python-version: "3.11"
- run: uv sync --locked --all-extras
working-directory: ./python
- name: Prepare python venv
run: |
source ${{ github.workspace }}/python/.venv/bin/activate
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install Temp Global.JSON
run: |
echo "{\"sdk\": {\"version\": \"9.0.101\"}}" > global.json
- name: Install .NET Aspire workload
run: dotnet workload install aspire
- name: Install dev certs
- name: Check dev certs when running on linux
run: dotnet --version && dotnet dev-certs https --trust
if: runner.os == 'Linux'
- name: Restore dependencies
run: |
dotnet restore -bl
Expand All @@ -149,9 +143,9 @@ jobs:
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Integration Test
run: dotnet --version && dotnet test --no-build -bl --configuration Release --filter type=integration
- name: Restore the global.json
run: rm global.json && git checkout -- global.json
run: |
dotnet --version
dotnet test --no-build -bl --configuration Release --filter type=integration

aot-test: # this make sure the AutoGen.Core is aot compatible
strategy:
Expand Down
4 changes: 2 additions & 2 deletions dotnet/samples/Hello/HelloAgent/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Orleans": "Warning"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public async Task AppHostLogsHelloAgentE2E(TestEndpoints testEndpoints)
await app.WaitForResource(ResourceName, TargetState).WaitAsync(timeout);
}
}
//sleep 5 seconds to make sure the app is running
await Task.Delay(5000);
//sleep 15 seconds to make sure the app is running
await Task.Delay(15000);
app.EnsureNoErrorsLogged();
app.EnsureLogContains("HelloAgents said Goodbye");
app.EnsureLogContains("Wild Hello from Python!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ async def main() -> None:
topic_id=DefaultTopicId("agents.Output", "HelloAgents/python"),
sender=AgentId("HelloAgents", "python"),
)
await runtime.stop_when_signal()
# await runtime.stop_when_idle()

await runtime.stop_when_shutdown()


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import logging
import signal
import sys
import uuid
import warnings
from asyncio import Future, Task
Expand Down Expand Up @@ -299,8 +300,22 @@ async def stop(self) -> None:
except asyncio.CancelledError:
pass

async def stop_when_shutdown(self) -> None:
"""Stop the runtime when Ctrl+C or SIGTERM is received."""
try:
await self._read_task
except KeyboardInterrupt:
logger.info("Received exit signal, shutting down gracefully...")
await self.stop()

async def stop_when_signal(self, signals: Sequence[signal.Signals] = (signal.SIGTERM, signal.SIGINT)) -> None:
"""Stop the runtime when a signal is received."""

# check if it's running on linux or windows
if sys.platform == "win32":
raise NotImplementedError(
"Signal handling is not supported on Windows. Please use stop_when_shutdown instead."
)
loop = asyncio.get_running_loop()
shutdown_event = asyncio.Event()

Expand Down
Loading