Repository navigation
ci: pin GitHub Actions to full commit SHAs #2025
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: CI | |
| on: | |
| push: | |
| branches: [main, 'dev/**'] | |
| pull_request: | |
| branches: [main, 'dev/**'] | |
| permissions: | |
| contents: read | |
| jobs: | |
| # The whole workspace (every member) on the Python the runtime images ship. | |
| python: | |
| runs-on: ubuntu-latest | |
| env: | |
| UV_PYTHON: "3.13" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 | |
| - name: uv.lock matches every member's pyproject.toml | |
| run: uv lock --check | |
| - name: Lint | |
| run: uv run ruff check sdpm/ servers/ shared/ api/ agent/ | |
| - name: Vendored files match the manifest | |
| run: cd sdpm/vendor && sha256sum -c SHA256SUMS | |
| - name: Test | |
| run: uv run pytest tests/ -v --cov=sdpm --cov-report=term | |
| # Report only: the text each session puts in front of the model (at start, and with | |
| # the guides its role names), with +/- against the base commit when it can be measured. | |
| - name: Context size report | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} | |
| run: | | |
| base_args=() | |
| if [[ "$BASE_SHA" =~ ^[0-9a-f]{40}$ && "$BASE_SHA" != 0000000000000000000000000000000000000000 ]] \ | |
| && git fetch --quiet --depth=1 origin "$BASE_SHA" \ | |
| && git worktree add --quiet --detach "$RUNNER_TEMP/base" "$BASE_SHA" \ | |
| && uv run python scripts/context_size.py --root "$RUNNER_TEMP/base" --json "$RUNNER_TEMP/base.json" > /dev/null; then | |
| base_args=(--base "$RUNNER_TEMP/base.json") | |
| else | |
| echo "::notice::Base commit not measured; the report has no +/- column." | |
| fi | |
| uv run python scripts/context_size.py --json "$RUNNER_TEMP/context-size.json" "${base_args[@]}" >> "$GITHUB_STEP_SUMMARY" | |
| # Local-surface guard: boots servers/local over real stdio (no mocks) and | |
| # exercises filesystem-anchored resolution (templates, workflows). The unit | |
| # suite mocks this surface, so regressions here used to slip through. | |
| # Runs what an installed user gets: only the sdpm-mcp-local member's | |
| # dependencies, on the oldest supported Python. | |
| local-smoke: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| UV_PYTHON: "3.11" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.11" | |
| - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 | |
| - name: Smoke test local MCP server | |
| run: uv run --package sdpm-mcp-local python scripts/smoke_local.py | |
| # The HTML browser check against a real Chrome: network block, popups, WebRTC | |
| # removal, layout measurement and the speaker view under the deck CSP. The | |
| # fixture fails (not skips) when no browser is found. | |
| browser: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| UV_PYTHON: "3.13" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 | |
| - name: Allow Chrome's sandbox (Ubuntu 24.04 restricts unprivileged user namespaces) | |
| run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
| - name: Real-browser tests | |
| env: | |
| SDPM_TEST_BROWSER: "1" | |
| SDPM_BROWSER: google-chrome | |
| run: google-chrome --version && command -v lsof && uv run pytest tests/test_html_browser_check.py -k real_browser -v -rs | |
| web-ui: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| cache-dependency-path: web-ui/package-lock.json | |
| - name: Install | |
| run: npm ci | |
| working-directory: web-ui | |
| - name: Lint | |
| run: npm run lint | |
| working-directory: web-ui | |
| - name: Type check | |
| run: npx tsc --noEmit | |
| working-directory: web-ui | |
| - name: Test | |
| run: npm test | |
| working-directory: web-ui | |
| - name: Build | |
| run: npm run build:cloud | |
| working-directory: web-ui | |
| e2e: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| cache-dependency-path: web-ui/package-lock.json | |
| - name: Install | |
| run: npm ci | |
| working-directory: web-ui | |
| - name: Install Playwright browser | |
| run: npx playwright install --with-deps chromium | |
| working-directory: web-ui | |
| - name: E2E test | |
| run: npm run test:e2e | |
| working-directory: web-ui | |
| - name: Upload trace on failure | |
| if: failure() | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: playwright-traces | |
| path: web-ui/test-results/ | |
| retention-days: 7 | |
| infra: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| cache-dependency-path: infra/package-lock.json | |
| - name: Install | |
| run: npm ci | |
| working-directory: infra | |
| - name: Type check | |
| run: npx tsc --noEmit | |
| working-directory: infra | |
| - name: Test | |
| run: npm test | |
| working-directory: infra | |
| # cdk synth catches template-level errors that tsc cannot (e.g. invalid | |
| # lifecycle rule combinations only fail at CloudFormation/S3 API time, | |
| # but synth at least validates construct-level constraints and config). | |
| - name: Synth | |
| # config.yaml is a local deployment setting (gitignored) — synth against | |
| # the committed example config. | |
| run: | | |
| cp config.example.yaml config.yaml | |
| npx cdk synth --quiet | |
| working-directory: infra | |
| # Deploy-surface guards: build each deployed artifact the way the CDK deploy | |
| # builds it (same Dockerfile / script, same context, same platform), start it | |
| # and talk to it. Unsatisfiable dependency pins, missing system packages and | |
| # import-time errors used to surface only at deploy time (2026-08-02 | |
| # cachetools/protobuf under aws-opentelemetry-distro, #271 pydantic-core). | |
| # The smoke checks run inside the container (`docker exec`): no published | |
| # ports, and BedrockAgentCoreApp binds to localhost outside AgentCore. | |
| # MCP Runtime image (infra/lib/runtime-stack.ts): linux/arm64, root context. | |
| remote-image: | |
| runs-on: ubuntu-24.04-arm | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Build | |
| uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 | |
| with: | |
| context: . | |
| file: servers/remote/Dockerfile | |
| platforms: linux/arm64 | |
| tags: sdpm-remote:ci | |
| load: true | |
| cache-from: type=gha,scope=remote-image | |
| cache-to: type=gha,mode=max,scope=remote-image | |
| - name: Start | |
| # Placeholder AWS settings: startup only checks they are set; no AWS call | |
| # happens until a tool runs. | |
| run: | | |
| docker run -d --name remote \ | |
| -e AWS_DEFAULT_REGION=us-east-1 -e AWS_ACCESS_KEY_ID=ci -e AWS_SECRET_ACCESS_KEY=ci \ | |
| -e DECKS_TABLE=ci -e PPTX_BUCKET=ci -e RESOURCE_BUCKET=ci \ | |
| -e OTEL_SDK_DISABLED=true \ | |
| sdpm-remote:ci | |
| - name: MCP initialize + tools/list | |
| run: docker exec -i remote python3.13 - mcp http://localhost:8000/mcp < scripts/ci/container_smoke.py | |
| - name: LibreOffice and poppler are on PATH | |
| run: docker exec remote sh -c 'command -v soffice && command -v pdftoppm' | |
| - name: Container logs | |
| if: always() | |
| run: docker logs remote || true | |
| # Agent Runtime image (infra/lib/agent-stack.ts): linux/arm64, root context. | |
| agent-image: | |
| runs-on: ubuntu-24.04-arm | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 | |
| - name: Build | |
| uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 | |
| with: | |
| context: . | |
| file: agent/Dockerfile | |
| platforms: linux/arm64 | |
| tags: sdpm-agent:ci | |
| load: true | |
| cache-from: type=gha,scope=agent-image | |
| cache-to: type=gha,mode=max,scope=agent-image | |
| - name: Start | |
| run: | | |
| docker run -d --name agent \ | |
| -e AWS_REGION=us-east-1 -e AWS_ACCESS_KEY_ID=ci -e AWS_SECRET_ACCESS_KEY=ci \ | |
| -e OTEL_SDK_DISABLED=true \ | |
| sdpm-agent:ci | |
| - name: GET /ping | |
| run: docker exec -i agent python - ping http://localhost:8080/ping < scripts/ci/container_smoke.py | |
| - name: Container logs | |
| if: always() | |
| run: docker logs agent || true | |
| # REST API Lambda (infra/lib/web-ui-stack.ts): x86_64 wheels, Python 3.13. | |
| api-lambda: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 | |
| - name: Bundle | |
| run: bash scripts/bundle_api_lambda.sh "$RUNNER_TEMP/api-bundle" | |
| - name: Handler imports from the bundle alone, in the Lambda runtime image | |
| # -I -S: no site-packages, so nothing outside the bundle can satisfy an import. | |
| run: | | |
| docker run --rm --entrypoint /var/lang/bin/python3 \ | |
| -v "$RUNNER_TEMP/api-bundle:/var/task:ro" \ | |
| -e TABLE_NAME=ci -e PPTX_BUCKET=ci -e AWS_DEFAULT_REGION=us-east-1 \ | |
| public.ecr.aws/lambda/python:3.13 \ | |
| -I -S -c "import sys; sys.path.insert(0, '/var/task'); import index, sdpm.api" | |
| guard: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Deny cdk.context.json | |
| run: | | |
| if [ -f "infra/cdk.context.json" ]; then | |
| echo "::error::infra/cdk.context.json must not be committed" | |
| exit 1 | |
| fi | |
| - name: Deny .env files | |
| run: | | |
| if compgen -G "**/.env" > /dev/null || compgen -G "**/.env.*" > /dev/null; then | |
| echo "::error::.env files must not be committed" | |
| exit 1 | |
| fi |