diff --git a/.github/workflows/inception-matrix.yml b/.github/workflows/inception-matrix.yml index 66657e3..be43125 100644 --- a/.github/workflows/inception-matrix.yml +++ b/.github/workflows/inception-matrix.yml @@ -543,6 +543,71 @@ jobs: dart un.dart test/fib.py 2>&1 | tee output.txt || true grep -q "fib(10) = 55" output.txt || echo "Dart integration pending" + # ============================================================================ + # .NET Languages (C# and .NET 10) + # ============================================================================ + csharp: + name: ".NET: C# (Mono)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Mono + run: | + sudo apt-get update + sudo apt-get install -y mono-complete + - name: Build C# (Mono) + run: | + cd clients/csharp/sync/src + mcs Un.cs -out:un-mono.exe || echo "Build attempted" + - name: Test --help + run: | + cd clients/csharp/sync/src + mono un-mono.exe --help 2>&1 || echo "Help test attempted" + - name: Integration test + if: env.UNSANDBOX_PUBLIC_KEY != '' + run: | + cd clients/csharp/sync/src + mono un-mono.exe ../../../../test/fib.py 2>&1 | tee output.txt || true + grep -q "fib(10) = 55" output.txt || echo "C# Mono integration pending" + + dotnet: + name: ".NET: .NET 10" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + dotnet-quality: 'preview' + - name: Build .NET 10 (sync) + run: | + cd clients/dotnet/sync/src + dotnet build -c Release || echo "Sync build attempted" + - name: Build .NET 10 (async) + run: | + cd clients/dotnet/async/src + dotnet build -c Release || echo "Async build attempted" + - name: Test sync --help + run: | + cd clients/dotnet/sync/src + dotnet run -- --help 2>&1 || echo "Sync help test attempted" + - name: Test async --help + run: | + cd clients/dotnet/async/src + dotnet run -- --help 2>&1 || echo "Async help test attempted" + - name: Integration test (sync) + if: env.UNSANDBOX_PUBLIC_KEY != '' + run: | + cd clients/dotnet/sync/src + dotnet run -- ../../../../test/fib.py 2>&1 | tee output.txt || true + grep -q "fib(10) = 55" output.txt || echo ".NET 10 sync integration pending" + - name: Integration test (async) + if: env.UNSANDBOX_PUBLIC_KEY != '' + run: | + cd clients/dotnet/async/src + dotnet run -- ../../../../test/fib.py 2>&1 | tee output.txt || true + grep -q "fib(10) = 55" output.txt || echo ".NET 10 async integration pending" + # ============================================================================ # TIER 4: Functional Languages # ============================================================================ @@ -891,6 +956,8 @@ jobs: - kotlin - groovy - dart + - csharp + - dotnet - haskell - ocaml - clojure diff --git a/clients/csharp/Makefile b/clients/csharp/Makefile index 7e61ade..f03396e 100644 --- a/clients/csharp/Makefile +++ b/clients/csharp/Makefile @@ -1,10 +1,10 @@ -# UN C# Client - Build and Test +# UN C# Client - Build and Test (Mono/.NET Framework compatible) -.PHONY: all build build-mono build-dotnet test test-cli test-library test-integration test-functional clean help +.PHONY: all build test test-cli test-library test-integration test-functional clean help ROOT_DIR := $(shell cd ../.. && pwd) -SYNC_DIR := sync -DOTNET_DIR := dotnet +SYNC_DIR := sync/src +ASYNC_DIR := async/src GREEN := \033[32m RED := \033[31m YELLOW := \033[33m @@ -13,51 +13,43 @@ NC := \033[0m .DEFAULT_GOAL := help help: - @echo "UN C# Client - Build and Test" + @echo "UN C# Client (Mono) - Build and Test" @echo "" - @echo " make build Compile both Mono (.NET Framework) and .NET versions" - @echo " make build-mono Compile Mono/.NET Framework version (sync/)" - @echo " make build-dotnet Compile modern .NET 10 version (dotnet/)" - @echo " make test All 4 test modes" + @echo " make build Compile Mono/.NET Framework versions" + @echo " make test All test modes" + @echo " make test-cli Test CLI functionality" + @echo " make test-functional Test with real API (requires credentials)" + @echo " make clean Remove build artifacts" @echo "" + @echo "Note: For modern .NET 10, use clients/dotnet/" -build: build-mono build-dotnet - -build-mono: - @echo "$(YELLOW)Building Mono/.NET Framework version...$(NC)" +build: + @echo "$(YELLOW)Building C# Mono version...$(NC)" @if [ -f "$(SYNC_DIR)/Un.cs" ]; then \ - mcs "$(SYNC_DIR)/src/Un.cs" -out:"$(SYNC_DIR)/un-mono.exe" && echo "$(GREEN)✓$(NC) Mono version compiled"; \ - else echo "$(RED)✗$(NC) Mono source not found"; fi - -build-dotnet: - @echo "$(YELLOW)Building .NET 10 version...$(NC)" - @if [ -f "$(DOTNET_DIR)/Un.csproj" ]; then \ - cd $(DOTNET_DIR) && dotnet build -c Release && echo "$(GREEN)✓$(NC) .NET version compiled"; \ - else echo "$(RED)✗$(NC) .NET project not found"; fi + mcs "$(SYNC_DIR)/Un.cs" -out:"$(SYNC_DIR)/un-mono.exe" && echo "$(GREEN)✓$(NC) Sync version compiled"; \ + else echo "$(RED)✗$(NC) Sync source not found"; fi + @if [ -f "$(ASYNC_DIR)/Un.cs" ]; then \ + mcs "$(ASYNC_DIR)/Un.cs" -out:"$(ASYNC_DIR)/un-mono.exe" && echo "$(GREEN)✓$(NC) Async version compiled"; \ + else echo "$(YELLOW)⊘$(NC) Async source not found (optional)"; fi test: test-cli test-library test-integration test-functional - @echo "$(GREEN)✓ C# Client: All 4 test modes complete$(NC)" + @echo "$(GREEN)✓ C# Client: All test modes complete$(NC)" -test-cli: +test-cli: build @echo "" @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" @echo "CLI MODE: Testing C# CLI" @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - @if [ -f "$(ROOT_DIR)/un.cs" ]; then \ - dotnet script "$(ROOT_DIR)/un.cs" -- --help 2>/dev/null && echo " $(GREEN)✓$(NC) CLI: --help works" || echo " $(YELLOW)⊘$(NC) CLI: dotnet not installed or error"; \ - fi - @if ls $(SYNC_DIR)/*.csproj 1>/dev/null 2>&1; then \ - cd $(SYNC_DIR) && dotnet build 2>/dev/null && echo " $(GREEN)✓$(NC) CLI: Sync SDK compiles" || echo " $(YELLOW)⊘$(NC) CLI: Compile failed"; \ - fi + @if [ -f "$(SYNC_DIR)/un-mono.exe" ]; then \ + mono "$(SYNC_DIR)/un-mono.exe" --help 2>/dev/null && echo " $(GREEN)✓$(NC) CLI: --help works" || echo " $(YELLOW)⊘$(NC) CLI: mono not installed or error"; \ + else echo " $(RED)✗$(NC) CLI: Build failed"; fi test-library: @echo "" @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" @echo "LIBRARY MODE: Testing C# classes" @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - @if ls $(SYNC_DIR)/*.csproj 1>/dev/null 2>&1; then \ - cd $(SYNC_DIR) && dotnet test 2>/dev/null || echo " $(YELLOW)⊘$(NC) Library: Tests incomplete"; \ - else echo " $(YELLOW)⊘$(NC) Library: No .csproj"; fi + @echo " $(YELLOW)⊘$(NC) Library: Unit tests not yet implemented" test-integration: @echo "" @@ -67,15 +59,21 @@ test-integration: @if [ -z "$$UNSANDBOX_PUBLIC_KEY" ]; then echo " $(YELLOW)⊘$(NC) Skipping (no API credentials)"; \ else echo " $(YELLOW)⊘$(NC) Integration: Not yet implemented"; fi -test-functional: +test-functional: build @echo "" @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" @echo "FUNCTIONAL MODE: Real-world scenarios" @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - @if [ -z "$$UNSANDBOX_PUBLIC_KEY" ]; then echo " $(YELLOW)⊘$(NC) Skipping (no API credentials)"; \ - else echo " $(YELLOW)⊘$(NC) Functional: Not yet implemented"; fi + @if [ -z "$$UNSANDBOX_PUBLIC_KEY" ]; then \ + echo " $(YELLOW)⊘$(NC) Skipping (no API credentials)"; \ + elif [ -f "$(SYNC_DIR)/un-mono.exe" ]; then \ + echo "Testing execute..."; \ + mono "$(SYNC_DIR)/un-mono.exe" "$(ROOT_DIR)/test/fib.py" 2>&1 | grep -q "fib(10) = 55" && echo " $(GREEN)✓$(NC) Execute passed" || echo " $(YELLOW)⊘$(NC) Execute test failed"; \ + else \ + echo " $(RED)✗$(NC) Build required first"; \ + fi clean: - @rm -rf $(SYNC_DIR)/bin $(SYNC_DIR)/obj $(SYNC_DIR)/un-mono.exe 2>/dev/null || true - @rm -rf $(DOTNET_DIR)/bin $(DOTNET_DIR)/obj 2>/dev/null || true + @rm -f $(SYNC_DIR)/un-mono.exe $(ASYNC_DIR)/un-mono.exe 2>/dev/null || true + @rm -rf $(SYNC_DIR)/bin $(SYNC_DIR)/obj $(ASYNC_DIR)/bin $(ASYNC_DIR)/obj 2>/dev/null || true @echo "$(GREEN)✓$(NC) Cleaned C# artifacts" diff --git a/clients/dotnet/Makefile b/clients/dotnet/Makefile index f6ebf55..71cb5af 100644 --- a/clients/dotnet/Makefile +++ b/clients/dotnet/Makefile @@ -1,38 +1,99 @@ -# UN CLI - .NET 10 Implementation +# UN CLI - .NET 10 Implementation (sync and async) -.PHONY: build run clean test help +.PHONY: build build-sync build-async run clean test test-sync test-async help -BUILD_DIR := sync/src -BINARY := sync/src/bin/Release/net10.0/un +SYNC_DIR := sync/src +ASYNC_DIR := async/src -build: - cd $(BUILD_DIR) && dotnet build -c Release +GREEN := \033[32m +YELLOW := \033[33m +NC := \033[0m -run: - cd $(BUILD_DIR) && dotnet run -- +build: build-sync build-async + +build-sync: + @echo "$(YELLOW)Building .NET 10 sync version...$(NC)" + cd $(SYNC_DIR) && dotnet build -c Release + @echo "$(GREEN)✓ Sync build complete$(NC)" + +build-async: + @echo "$(YELLOW)Building .NET 10 async version...$(NC)" + cd $(ASYNC_DIR) && dotnet build -c Release + @echo "$(GREEN)✓ Async build complete$(NC)" + +run-sync: + cd $(SYNC_DIR) && dotnet run -- + +run-async: + cd $(ASYNC_DIR) && dotnet run -- clean: - cd $(BUILD_DIR) && dotnet clean - rm -rf $(BUILD_DIR)/bin $(BUILD_DIR)/obj + cd $(SYNC_DIR) && dotnet clean 2>/dev/null || true + cd $(ASYNC_DIR) && dotnet clean 2>/dev/null || true + rm -rf $(SYNC_DIR)/bin $(SYNC_DIR)/obj + rm -rf $(ASYNC_DIR)/bin $(ASYNC_DIR)/obj -test: build +test: test-sync test-async + @echo "$(GREEN)✓ .NET 10: All tests complete$(NC)" + +test-sync: build-sync + @echo "" + @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + @echo "Testing .NET 10 SYNC version" + @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" @echo "Testing --help..." - cd $(BUILD_DIR) && dotnet run -- --help + cd $(SYNC_DIR) && dotnet run -- --help @echo "" @echo "Testing --version..." - cd $(BUILD_DIR) && dotnet run -- --version + cd $(SYNC_DIR) && dotnet run -- --version + @echo "$(GREEN)✓ Sync tests passed$(NC)" + +test-async: build-async + @echo "" + @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + @echo "Testing .NET 10 ASYNC version" + @echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + @echo "Testing --help..." + cd $(ASYNC_DIR) && dotnet run -- --help + @echo "" + @echo "Testing --version..." + cd $(ASYNC_DIR) && dotnet run -- --version + @echo "$(GREEN)✓ Async tests passed$(NC)" test-cli: build @echo "CLI tests require UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY" - cd $(BUILD_DIR) && dotnet run -- key + @if [ -n "$$UNSANDBOX_PUBLIC_KEY" ]; then \ + echo "Testing sync key validation..."; \ + cd $(SYNC_DIR) && dotnet run -- key; \ + echo "Testing async key validation..."; \ + cd $(ASYNC_DIR) && dotnet run -- key; \ + else \ + echo "$(YELLOW)⊘ Skipping (no API credentials)$(NC)"; \ + fi + +test-functional: build + @if [ -z "$$UNSANDBOX_PUBLIC_KEY" ]; then \ + echo "$(YELLOW)⊘ Skipping functional tests (no API credentials)$(NC)"; \ + else \ + echo "Testing sync execute..."; \ + cd $(SYNC_DIR) && dotnet run -- ../../test/fib.py 2>&1 | grep -q "fib(10) = 55" && echo "$(GREEN)✓ Sync execute passed$(NC)"; \ + echo "Testing async execute..."; \ + cd $(ASYNC_DIR) && dotnet run -- ../../test/fib.py 2>&1 | grep -q "fib(10) = 55" && echo "$(GREEN)✓ Async execute passed$(NC)"; \ + fi help: @echo "UN CLI (.NET 10) Makefile" @echo "" @echo "Targets:" - @echo " build Build the CLI" - @echo " run Run the CLI" - @echo " clean Clean build artifacts" - @echo " test Run basic tests" - @echo " test-cli Run CLI tests (requires API keys)" - @echo " help Show this help" + @echo " build Build both sync and async versions" + @echo " build-sync Build sync version only" + @echo " build-async Build async version only" + @echo " run-sync Run sync CLI" + @echo " run-async Run async CLI" + @echo " clean Clean build artifacts" + @echo " test Run basic tests (both versions)" + @echo " test-sync Test sync version" + @echo " test-async Test async version" + @echo " test-cli Run CLI tests (requires API keys)" + @echo " test-functional Run functional tests (requires API keys)" + @echo " help Show this help"