Add GitHub Actions test workflow, fix consent CSRF #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| pull_request: | |
| branches: [main, dev] | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| env: | |
| UMBRACO_CLIENT_ID: umbraco-back-office-mcp | |
| UMBRACO_CLIENT_SECRET: '1234567890' | |
| UMBRACO_BASE_URL: https://localhost:5201 | |
| NODE_TLS_REJECT_UNAUTHORIZED: '0' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: nuget- | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Build SDK | |
| run: npm run build | |
| - name: Build template | |
| run: npm run build -w template | |
| - name: Build hosted MCP | |
| run: npm run build -w packages/hosted-mcp | |
| - name: Build CLI package | |
| run: npm run build -w packages/create-mcp-server | |
| # ── Unit tests (no infrastructure) ── | |
| - name: SDK unit tests | |
| run: npm run test | |
| - name: Hosted MCP unit tests | |
| run: npm test -w packages/hosted-mcp | |
| - name: CLI unit tests | |
| run: npm test -w packages/create-mcp-server | |
| - name: Template tool handler tests | |
| run: npm run test:template | |
| env: | |
| USE_MOCK_API: 'true' | |
| # ── Integration tests (Wrangler, no Umbraco) ── | |
| - name: CLI integration tests | |
| run: npm run test:cli | |
| - name: Wrangler integration tests | |
| run: npm run test:integration | |
| # ── Tests requiring Umbraco ── | |
| - name: Setup .NET dev certs | |
| run: dotnet dev-certs https | |
| - name: Start Umbraco | |
| run: | | |
| cd tests/umbraco-instance | |
| ASPNETCORE_ENVIRONMENT=Development \ | |
| ASPNETCORE_URLS="http://localhost:5200;https://localhost:5201" \ | |
| dotnet run --no-launch-profile > /tmp/umbraco.log 2>&1 & | |
| echo $! > /tmp/umbraco.pid | |
| - name: Wait for Umbraco | |
| run: | | |
| echo "Waiting for Umbraco to be ready..." | |
| for i in $(seq 1 60); do | |
| if curl -sf http://localhost:5200/umbraco/management/api/v1/server/status 2>/dev/null | grep -q "Run"; then | |
| echo "Umbraco is ready!" | |
| exit 0 | |
| fi | |
| if ! kill -0 $(cat /tmp/umbraco.pid) 2>/dev/null; then | |
| echo "Umbraco process died! Last 50 lines of log:" | |
| tail -50 /tmp/umbraco.log | |
| exit 1 | |
| fi | |
| echo "Attempt $i/60 - waiting 5s..." | |
| sleep 5 | |
| done | |
| echo "Umbraco failed to start within 5 minutes. Last 50 lines of log:" | |
| tail -50 /tmp/umbraco.log | |
| exit 1 | |
| timeout-minutes: 6 | |
| - name: Chained Wrangler integration tests | |
| run: npm run test:integration:chained | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Hosted MCP Playwright E2E | |
| run: npm run test:e2e | |
| - name: Chained MCP Playwright E2E | |
| run: npm run test:e2e:chained | |
| evals: | |
| name: LLM Eval Tests | |
| if: >- | |
| github.event.pull_request.base.ref == 'main' && | |
| startsWith(github.event.pull_request.head.ref, 'release/') | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_TLS_REJECT_UNAUTHORIZED: '0' | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Build SDK | |
| run: npm run build | |
| - name: Build template | |
| run: npm run build -w template | |
| - name: Run CLI eval tests | |
| run: npm run test:cli:evals |