diff --git a/.github/actions/setup-copilot/action.yml b/.github/actions/setup-copilot/action.yml index e2c9542f..94cc00e8 100644 --- a/.github/actions/setup-copilot/action.yml +++ b/.github/actions/setup-copilot/action.yml @@ -1,5 +1,9 @@ name: "Setup Copilot" description: "Setup Copilot based on the project's package.json file." +outputs: + cli-path: + description: "Path to the Copilot CLI" + value: ${{ steps.cli-path.outputs.path }} runs: using: "composite" steps: diff --git a/.github/workflows/dotnet-sdk-tests.yml b/.github/workflows/dotnet-sdk-tests.yml new file mode 100644 index 00000000..a30c4cc5 --- /dev/null +++ b/.github/workflows/dotnet-sdk-tests.yml @@ -0,0 +1,73 @@ +name: ".NET SDK Tests" + +on: + pull_request: + paths: + - 'dotnet/**' + - 'test/**' + - 'nodejs/package.json' + - '.github/workflows/dotnet-sdk-tests.yml' + - '.github/actions/setup-copilot/**' + workflow_dispatch: + merge_group: + +permissions: + contents: read + +jobs: + test: + name: ".NET SDK Tests" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: ./dotnet + steps: + - uses: actions/checkout@v6.0.2 + - uses: ./.github/actions/setup-copilot + id: setup-copilot + - uses: actions/setup-dotnet@v5 + with: + dotnet-version: "8.0.x" + - uses: actions/setup-node@v6 + with: + cache: "npm" + cache-dependency-path: "./nodejs/package-lock.json" + + - name: Install Node.js dependencies (for CLI) + working-directory: ./nodejs + run: npm ci --ignore-scripts + + - name: Restore .NET dependencies + run: dotnet restore + + - name: Run dotnet format check + if: runner.os == 'Linux' + run: | + dotnet format --verify-no-changes + if [ $? -ne 0 ]; then + echo "❌ dotnet format produced changes. Please run 'dotnet format' in dotnet" + exit 1 + fi + echo "✅ dotnet format produced no changes" + + - name: Build SDK + run: dotnet build --no-restore + + - name: Install test harness dependencies + working-directory: ./test/harness + run: npm ci --ignore-scripts + + - name: Warm up PowerShell + if: runner.os == 'Windows' + run: pwsh.exe -Command "Write-Host 'PowerShell ready'" + + - name: Run .NET SDK tests + env: + COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} + COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }} + run: dotnet test --no-build -v n diff --git a/.github/workflows/go-sdk-tests.yml b/.github/workflows/go-sdk-tests.yml new file mode 100644 index 00000000..3692aa99 --- /dev/null +++ b/.github/workflows/go-sdk-tests.yml @@ -0,0 +1,69 @@ +name: "Go SDK Tests" + +on: + pull_request: + paths: + - 'go/**' + - 'test/**' + - 'nodejs/package.json' + - '.github/workflows/go-sdk-tests.yml' + - '.github/actions/setup-copilot/**' + workflow_dispatch: + merge_group: + +permissions: + contents: read + +jobs: + test: + name: "Go SDK Tests" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: ./go + steps: + - uses: actions/checkout@v6.0.2 + - uses: ./.github/actions/setup-copilot + id: setup-copilot + - uses: actions/setup-go@v6 + with: + go-version: "1.23" + + - name: Run go fmt + if: runner.os == 'Linux' + working-directory: ./go + run: | + go fmt ./... + if [ -n "$(git status --porcelain)" ]; then + echo "❌ go fmt produced changes. Please run 'go fmt ./...' in go" + git --no-pager diff + exit 1 + fi + echo "✅ go fmt produced no changes" + + - name: Install golangci-lint + if: runner.os == 'Linux' + uses: golangci/golangci-lint-action@v9 + with: + working-directory: ./go + version: latest + args: --timeout=5m + + - name: Install test harness dependencies + working-directory: ./test/harness + run: npm ci --ignore-scripts + + - name: Warm up PowerShell + if: runner.os == 'Windows' + run: pwsh.exe -Command "Write-Host 'PowerShell ready'" + + - name: Run Go SDK tests + env: + COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} + COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }} + run: /bin/bash test.sh diff --git a/.github/workflows/nodejs-sdk-tests.yml b/.github/workflows/nodejs-sdk-tests.yml new file mode 100644 index 00000000..24b05665 --- /dev/null +++ b/.github/workflows/nodejs-sdk-tests.yml @@ -0,0 +1,65 @@ +name: "Node.js SDK Tests" + +env: + HUSKY: 0 + +on: + pull_request: + paths: + - 'nodejs/**' + - 'test/**' + - '.github/workflows/nodejs-sdk-tests.yml' + - '.github/actions/setup-copilot/**' + workflow_dispatch: + merge_group: + +permissions: + contents: read + +jobs: + test: + name: "Node.js SDK Tests" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: ./nodejs + steps: + - uses: actions/checkout@v6.0.2 + - uses: actions/setup-node@v6 + with: + cache: "npm" + cache-dependency-path: "./nodejs/package-lock.json" + node-version: 22 + - uses: ./.github/actions/setup-copilot + id: setup-copilot + - name: Install dependencies + run: npm ci --ignore-scripts + + - name: Run prettier check + if: runner.os == 'Linux' + run: npm run format:check + + - name: Run ESLint + run: npm run lint + + - name: Typecheck SDK + run: npm run typecheck + + - name: Install test harness dependencies + working-directory: ./test/harness + run: npm ci --ignore-scripts + + - name: Warm up PowerShell + if: runner.os == 'Windows' + run: pwsh.exe -Command "Write-Host 'PowerShell ready'" + + - name: Run Node.js SDK tests + env: + COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} + COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }} + run: npm test diff --git a/.github/workflows/python-sdk-tests.yml b/.github/workflows/python-sdk-tests.yml new file mode 100644 index 00000000..7690f877 --- /dev/null +++ b/.github/workflows/python-sdk-tests.yml @@ -0,0 +1,69 @@ +name: "Python SDK Tests" + +env: + PYTHONUTF8: 1 + +on: + pull_request: + paths: + - 'python/**' + - 'test/**' + - 'nodejs/package.json' + - '.github/workflows/python-sdk-tests.yml' + - '.github/actions/setup-copilot/**' + workflow_dispatch: + merge_group: + +permissions: + contents: read + +jobs: + test: + name: "Python SDK Tests" + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: ./python + steps: + - uses: actions/checkout@v6.0.2 + - uses: ./.github/actions/setup-copilot + id: setup-copilot + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Set up uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + + - name: Install Python dev dependencies + run: uv sync --locked --all-extras --dev + + - name: Run ruff format check + run: uv run ruff format --check . + + - name: Run ruff lint + run: uv run ruff check + + - name: Run ty type checking + run: uv run ty check copilot + + - name: Install test harness dependencies + working-directory: ./test/harness + run: npm ci --ignore-scripts + + - name: Warm up PowerShell + if: runner.os == 'Windows' + run: pwsh.exe -Command "Write-Host 'PowerShell ready'" + + - name: Run Python SDK tests + env: + COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} + COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }} + run: uv run pytest -v -s diff --git a/.github/workflows/sdk-e2e-tests.yml b/.github/workflows/sdk-e2e-tests.yml deleted file mode 100644 index bae0a36b..00000000 --- a/.github/workflows/sdk-e2e-tests.yml +++ /dev/null @@ -1,218 +0,0 @@ -name: "SDK E2E Tests" - -env: - HUSKY: 0 - PYTHONUTF8: 1 - -on: - push: - branches: [main] - pull_request: - workflow_dispatch: - merge_group: - -permissions: - contents: read - -jobs: - nodejs-sdk: - name: "Node.js SDK Tests" - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash - working-directory: ./nodejs - steps: - - uses: actions/checkout@v6.0.2 - - uses: actions/setup-node@v6 - with: - cache: "npm" - cache-dependency-path: "./nodejs/package-lock.json" - node-version: 22 - - uses: ./.github/actions/setup-copilot - - name: Install dependencies - run: npm ci --ignore-scripts - - - name: Run prettier check - if: runner.os == 'Linux' - run: npm run format:check - - - name: Run ESLint - run: npm run lint - - - name: Typecheck SDK - run: npm run typecheck - - - name: Install test harness dependencies - working-directory: ./test/harness - run: npm ci --ignore-scripts - - - name: Warm up PowerShell - if: runner.os == 'Windows' - run: pwsh.exe -Command "Write-Host 'PowerShell ready'" - - - name: Run Node.js SDK tests - env: - COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} - COPILOT_CLI_PATH: ${{ steps.cli-path.outputs.path }} - run: npm test - - go-sdk: - name: "Go SDK Tests" - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash - working-directory: ./go - steps: - - uses: actions/checkout@v6.0.2 - - uses: ./.github/actions/setup-copilot - - uses: actions/setup-go@v6 - with: - go-version: "1.23" - - - name: Run go fmt - if: runner.os == 'Linux' - working-directory: ./go - run: | - go fmt ./... - if [ -n "$(git status --porcelain)" ]; then - echo "❌ go fmt produced changes. Please run 'go fmt ./...' in go" - git --no-pager diff - exit 1 - fi - echo "✅ go fmt produced no changes" - - - name: Install golangci-lint - if: runner.os == 'Linux' - uses: golangci/golangci-lint-action@v9 - with: - working-directory: ./go - version: latest - args: --timeout=5m - - - name: Install test harness dependencies - working-directory: ./test/harness - run: npm ci --ignore-scripts - - - name: Warm up PowerShell - if: runner.os == 'Windows' - run: pwsh.exe -Command "Write-Host 'PowerShell ready'" - - - name: Run Go SDK tests - env: - COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} - COPILOT_CLI_PATH: ${{ steps.cli-path.outputs.path }} - run: /bin/bash test.sh - - python-sdk: - name: "Python SDK Tests" - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash - working-directory: ./python - steps: - - uses: actions/checkout@v6.0.2 - - uses: ./.github/actions/setup-copilot - - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - - name: Set up uv - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - - - name: Install Python dev dependencies - run: uv sync --locked --all-extras --dev - - - name: Run ruff format check - run: uv run ruff format --check . - - - name: Run ruff lint - run: uv run ruff check - - - name: Run ty type checking - run: uv run ty check copilot - - - name: Install test harness dependencies - working-directory: ./test/harness - run: npm ci --ignore-scripts - - - name: Warm up PowerShell - if: runner.os == 'Windows' - run: pwsh.exe -Command "Write-Host 'PowerShell ready'" - - - name: Run Python SDK tests - env: - COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} - COPILOT_CLI_PATH: ${{ steps.cli-path.outputs.path }} - run: uv run pytest -v -s - - dotnet-sdk: - name: ".NET SDK Tests" - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash - working-directory: ./dotnet - steps: - - uses: actions/checkout@v6.0.2 - - uses: ./.github/actions/setup-copilot - - uses: actions/setup-dotnet@v5 - with: - dotnet-version: "8.0.x" - - uses: actions/setup-node@v6 - with: - cache: "npm" - cache-dependency-path: "./nodejs/package-lock.json" - - - name: Install Node.js dependencies (for CLI) - working-directory: ./nodejs - run: npm ci --ignore-scripts - - - name: Restore .NET dependencies - run: dotnet restore - - - name: Run dotnet format check - if: runner.os == 'Linux' - run: | - dotnet format --verify-no-changes - if [ $? -ne 0 ]; then - echo "❌ dotnet format produced changes. Please run 'dotnet format' in dotnet" - exit 1 - fi - echo "✅ dotnet format produced no changes" - - - name: Build SDK - run: dotnet build --no-restore - - - name: Install test harness dependencies - working-directory: ./test/harness - run: npm ci --ignore-scripts - - - name: Warm up PowerShell - if: runner.os == 'Windows' - run: pwsh.exe -Command "Write-Host 'PowerShell ready'" - - - name: Run .NET SDK tests - env: - COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} - run: dotnet test --no-build -v n