name: Motion standalone checks # OpenMotion container-first CI: validates repository policy, design system, # Studio UI, cloud backend (PostgreSQL + Redis + S3 CAS), MCP Streamable HTTP, # and multi-target container definitions. on: workflow_call: pull_request: push: branches: [main] workflow_dispatch: permissions: contents: read concurrency: group: motion-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: template-library: name: Template library policy runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - name: Checkout source and contribution history without LFS media uses: actions/checkout@v6.0.2 with: fetch-depth: 0 lfs: false persist-credentials: false - name: Setup pinned Node uses: actions/setup-node@v6 with: node-version: '26.11.1' - name: Require Squash merges for sanitized media history env: GH_TOKEN: ${{ github.token }} run: | # GraphQL variables are passed through gh fields, not expanded by the shell. # shellcheck disable=SC2016 gh api graphql -f owner="$GITHUB_REPOSITORY_OWNER" -f repo="${GITHUB_REPOSITORY#*/}" \ -f query='query($owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { squashMergeAllowed mergeCommitAllowed rebaseMergeAllowed } }' \ --jq '.data.repository | if .squashMergeAllowed and (.mergeCommitAllowed | not) and (.rebaseMergeAllowed | not) then "Squash-only merge policy confirmed" else error("Enable Squash merge only before accepting cleaned media PRs") end' - name: Check the final merge tree and media policy env: BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} run: | if [[ "$BASE_SHA" =~ ^0+$ ]]; then unset BASE_SHA; fi npm run templates:check -- --final-tree npm run storage:check -- --final-tree node --test tests/repository-storage.test.ts tests/media-transfer.test.ts tests/studio-preview-release.test.ts node --test tests/template-library.test.ts tests/ci-scope.test.mjs tests/source-update-guidance.test.mjs maintainability: name: Maintainability report if: github.event_name == 'pull_request' && github.base_ref == 'main' runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - name: Checkout PR merge result uses: actions/checkout@v6.0.2 with: fetch-depth: 2 persist-credentials: false - name: Setup pinned Node uses: actions/setup-node@v6 with: node-version: '26.11.1' cache: npm cache-dependency-path: | package-lock.json .github/maintainability/package-lock.json - name: Select checks for the changed boundary id: scope env: BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} run: node .github/scripts/ci-scope.mjs - name: Compare source against the PR base if: steps.scope.outputs.maintainability == 'true' shell: bash env: PR_HEAD_REVISION: ${{ github.event.pull_request.head.sha }} run: | test "$(git rev-parse HEAD^2)" = "$PR_HEAD_REVISION" BASE_REVISION=$(git rev-parse HEAD^1) base_dir=$(mktemp -d "$RUNNER_TEMP/motion-base.XXXXXX") git archive "$BASE_REVISION" | tar -x -C "$base_dir" npm ci --prefix "$base_dir" --ignore-scripts --no-audit --no-fund npm ci --ignore-scripts --no-audit --no-fund npm ci --prefix .github/maintainability --ignore-scripts --no-audit --no-fund node .github/maintainability/report.mjs "$base_dir" "$BASE_REVISION" >> "$GITHUB_STEP_SUMMARY" checks: name: Source checks runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v6.0.2 with: fetch-depth: 2 persist-credentials: false - name: Setup pinned Node uses: actions/setup-node@v6 with: node-version: '26.11.1' cache: npm cache-dependency-path: package-lock.json - name: Select checks for the changed boundary id: scope env: BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} run: node .github/scripts/ci-scope.mjs - name: Test release controls without publication credentials run: node --test tests/release-workflows.test.mjs tests/release-scan.test.mjs tests/registry-download.test.mjs tests/stable-release.test.mjs tests/release-notes.test.mjs tests/publish-template-catalog.test.mjs tests/template-registry-consumer.test.mjs tests/orbit-cloud-test-sync.test.mjs - name: Exercise cloud test promotion against a local remote run: bash tests/cloud-test-promotion.sh - name: Install locked Motion dependencies if: steps.scope.outputs.full == 'true' run: npm ci --no-audit --no-fund - name: Check source and Studio types if: steps.scope.outputs.full == 'true' run: | npm run check npm run design:test node --test tests/source-build-state.test.ts npm run typecheck:studio npm run typecheck:backend npm run typecheck:cloud - name: Measure component adoption and detached styles if: steps.scope.outputs.full == 'true' env: PR_HEAD: ${{ github.event.pull_request.head.sha }} run: | node --test tests/ui-metrics.test.ts args=() if [[ -n "$PR_HEAD" ]]; then test "$(git rev-parse HEAD^2)" = "$PR_HEAD" args+=(--base "$(git rev-parse HEAD^1)") fi npm run design:metrics -- "${args[@]}" cat dist/ui-metrics/report.md >> "$GITHUB_STEP_SUMMARY" - name: Upload UI metrics with source locations if: steps.scope.outputs.full == 'true' uses: actions/upload-artifact@v7.0.2 with: name: ui-metrics path: dist/ui-metrics/ if-no-files-found: error - name: Check capture failure classification and bounded recovery if: steps.scope.outputs.full == 'true' run: node --test tests/capture-retry.test.ts - name: Check composition, discovery and install attribution if: steps.scope.outputs.full == 'true' run: node --test tests/composition-canvas.test.ts tests/short-form-discovery.test.ts tests/install-attribution-worker.test.ts studio: name: Studio regression (${{ matrix.shard }}/2) env: OPENMOTION_TELEMETRY: '0' strategy: fail-fast: false matrix: shard: [1, 2] runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v6.0.2 with: fetch-depth: 2 persist-credentials: false - name: Setup pinned Node uses: actions/setup-node@v6 with: node-version: '26.11.1' cache: npm cache-dependency-path: package-lock.json - name: Select checks for the changed boundary id: scope env: BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} run: node .github/scripts/ci-scope.mjs - name: Install locked Motion dependencies if: steps.scope.outputs.full == 'true' run: npm ci --no-audit --no-fund - name: Studio regression if: steps.scope.outputs.full == 'true' run: npm run test:studio -- --maxWorkers=2 --shard=${{ matrix.shard }}/2 cloud: name: Cloud backend, security scan & container checks runs-on: ubuntu-24.04 timeout-minutes: 25 env: OPENMOTION_TELEMETRY: '0' steps: - name: Checkout uses: actions/checkout@v6.0.2 with: fetch-depth: 2 persist-credentials: false - name: Setup pinned Node uses: actions/setup-node@v6 with: node-version: '26.11.1' cache: npm cache-dependency-path: package-lock.json - name: Select checks for the changed boundary id: scope env: BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} run: node .github/scripts/ci-scope.mjs - name: Scan tracked source without publication credentials run: | node .github/scripts/motion-scan.mjs install "$RUNNER_TEMP/scanner" node .github/scripts/motion-scan.mjs source . "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/scanner/gitleaks" - name: Install locked Motion dependencies if: steps.scope.outputs.full == 'true' run: npm ci --no-audit --no-fund - name: Build Studio and tracking bundles if: steps.scope.outputs.full == 'true' run: | npm run build:studio npm run build:tracking npm run build:observability - name: Install FFmpeg for cloud media worker tests if: steps.scope.outputs.full == 'true' run: | sudo apt-get update sudo apt-get install -y --no-install-recommends ffmpeg - name: Start isolated render queue test services if: steps.scope.outputs.full == 'true' run: | docker run -d --name render-test-redis -p 127.0.0.1::6379 redis:7-alpine docker run -d --name render-test-postgres -p 127.0.0.1::5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:17-bookworm timeout 30 bash -c 'until docker exec render-test-postgres pg_isready -U postgres; do sleep 1; done' echo "TEST_REDIS_URL=redis://$(docker port render-test-redis 6379)" >> "$GITHUB_ENV" echo "TEST_RENDER_DATABASE_URL=postgres://postgres@$(docker port render-test-postgres 5432)/postgres" >> "$GITHUB_ENV" - name: Run cloud backend and integration test suite if: steps.scope.outputs.full == 'true' run: | node --experimental-strip-types --test tests/cloud/*.test.ts node --experimental-strip-types --test \ tests/design-system.test.ts \ tests/mcp-onboarding.test.ts \ tests/mcp-registry.test.ts \ tests/public-names.test.ts \ tests/extension-boundary.test.ts \ tests/integration-setup.test.ts \ tests/tracking-device.test.ts \ tests/tracking-task-ledger.test.ts \ tests/command-lifecycle.test.ts \ tests/brand-catalog.test.ts \ tests/brand-cover.test.ts \ tests/design-catalog.test.ts \ tests/font-catalog.test.ts \ tests/font-specimen.test.ts \ tests/studio-fonts.test.ts \ tests/hosted-template-catalog.test.ts \ tests/template-cards-ui.test.ts \ tests/template-prompts.test.ts \ tests/recreate-measure.test.ts \ tests/motion-design-remix.test.ts \ tests/spa-routes.test.ts \ tests/scenario-content.test.ts \ tests/inline-storyboard.test.ts - name: Validate container and Compose definitions if: steps.scope.outputs.full == 'true' run: | docker compose -f deploy/docker-compose.yml config -q docker buildx build --check -f deploy/Dockerfile --target api . docker buildx build --check -f deploy/Dockerfile --target worker-media . docker buildx build --check -f deploy/Dockerfile --target worker-render . docker buildx build --check -f deploy/Dockerfile --target worker-render-lambda . docker buildx build --check -f deploy/Dockerfile --target catalog-sync . - name: Check presentation documentation if: steps.scope.outputs.full != 'true' env: CHANGED_DOCS: ${{ steps.scope.outputs.documents }} run: | node .github/scripts/ci-scope.mjs --check-docs echo 'Presentation documentation checked; Studio and cloud backend checks were not needed. Source scanning and repository policy checks still ran.' >> "$GITHUB_STEP_SUMMARY" # Keep the existing required check while every independent lane runs in parallel. standalone: if: ${{ always() }} needs: [template-library, maintainability, checks, studio, cloud] runs-on: ubuntu-24.04 timeout-minutes: 2 steps: - name: Require every validation lane env: VALIDATION_RESULTS: ${{ toJSON(needs) }} ALLOW_SKIPPED_MAINTAINABILITY: ${{ github.event_name != 'pull_request' || github.base_ref != 'main' }} run: | node --input-type=module <<'NODE' const results = JSON.parse(process.env.VALIDATION_RESULTS); for (const job of ['template-library', 'maintainability', 'checks', 'studio', 'cloud']) { const result = results[job]?.result; const expected = job === 'maintainability' && process.env.ALLOW_SKIPPED_MAINTAINABILITY === 'true' ? 'skipped' : 'success'; if (result !== expected) { console.error(`${job}: expected ${expected}, received ${result ?? 'missing'}`); process.exitCode = 1; } } NODE