CI #489
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
| # Per-package + per-example check matrix. One job per workspace so a | |
| # regression in (say) computerd's tests doesn't hide a typecheck failure in | |
| # workspace. Each job is self-contained: install at the repo root, | |
| # build siblings whose dist/ this package's typecheck depends on, | |
| # then run biome + typecheck + tests scoped to that package. | |
| # | |
| # Runs on every PR and on pushes to the long-lived branches. The release | |
| # workflow also dispatches CI for the release branch because its GITHUB_TOKEN | |
| # push cannot start another workflow. | |
| # | |
| # Path filters skip pure documentation changes — they have no influence on | |
| # any package's lint, typecheck, or test surface. | |
| name: CI | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "**/*.md" | |
| - "docs/**" | |
| - ".github/**/*.md" | |
| push: | |
| branches: [main, next, release] | |
| paths-ignore: | |
| - "**/*.md" | |
| - "docs/**" | |
| - ".github/**/*.md" | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # PRs key on the PR number so successive pushes cancel the prior run. The | |
| # version branch also keeps only its newest run, while main builds remain a | |
| # historical signal and are never canceled. | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/release' }} | |
| jobs: | |
| package: | |
| name: ${{ matrix.name }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: dofs | |
| workspace: "@cloudflare/dofs" | |
| path: packages/dofs | |
| needs-siblings: false | |
| extra-test: "test:workers" | |
| - name: rpc | |
| workspace: "@cloudflare/computer-rpc" | |
| path: packages/rpc | |
| needs-siblings: true | |
| - name: computer | |
| workspace: "@cloudflare/computer" | |
| path: packages/computer | |
| needs-siblings: true | |
| build-computerd-bin: true | |
| extra-test: "test:harness" | |
| system-deps: "fuse3 xz-utils" | |
| - name: computerd | |
| workspace: "@cloudflare/computerd" | |
| path: packages/computerd | |
| needs-siblings: true | |
| build-computerd-bin: true | |
| # libfuse2 (libfuse.so.2) is what fuse-native binds to at | |
| # runtime; fuse3 ships /dev/fuse helpers and the | |
| # FUSE_MOUNT=shim tests need it for the userspace mount path. | |
| # xz-utils extracts the target Node binary used by build:bin. | |
| system-deps: "libfuse2t64 fuse3 xz-utils" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - uses: ./.github/actions/install | |
| - name: Install system dependencies | |
| if: matrix.system-deps | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends ${{ matrix.system-deps }} | |
| - name: Prepare Docker and FUSE | |
| if: matrix.build-computerd-bin | |
| run: | | |
| docker info | |
| sudo modprobe fuse | |
| sudo chmod a+rw /dev/fuse | |
| # Build every npm workspace's dist/ unconditionally for now. The | |
| # computer + computerd jobs need dofs + rpc dist, the rpc job needs | |
| # dofs dist, and the cost of an extra `tsc` pass is small | |
| # compared to the test runtime. Revisit per-package once | |
| # @cloudflare/computer bundles dofs + rpc internally. | |
| - name: Build all workspaces | |
| if: matrix.needs-siblings | |
| run: npm run build --workspaces --if-present | |
| - name: Build this package | |
| if: matrix.needs-siblings == false | |
| run: npm run build --workspace ${{ matrix.workspace }} --if-present | |
| # The computer harness and computerd's real-FUSE regression both | |
| # discover the standalone binary at artifacts/computerd/. Building it | |
| # makes those suites execute instead of silently skipping. | |
| - name: Build computerd binary | |
| if: matrix.build-computerd-bin | |
| run: npm run build:bin --workspace @cloudflare/computerd | |
| - name: Lint + format check | |
| run: npx biome check ${{ matrix.path }} | |
| - name: Typecheck | |
| run: npm run typecheck --workspace ${{ matrix.workspace }} --if-present | |
| - name: Test | |
| run: npm test --workspace ${{ matrix.workspace }} --if-present | |
| - name: Test (${{ matrix.extra-test }}) | |
| if: matrix.extra-test | |
| run: npm run ${{ matrix.extra-test }} --workspace ${{ matrix.workspace }} | |
| example: | |
| name: example/${{ matrix.name }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: artifacts | |
| workspace: "@example/computer-artifacts" | |
| path: examples/artifacts | |
| typegen: "npx wrangler types" | |
| - name: assets | |
| workspace: "@example/computer-assets" | |
| path: examples/assets | |
| - name: container | |
| workspace: "@example/computer-container" | |
| path: examples/container | |
| typegen: "npx wrangler types" | |
| - name: mcp | |
| workspace: "@example/computer-mcp" | |
| path: examples/mcp | |
| - name: think | |
| workspace: "@cloudflare/example-think" | |
| path: examples/think | |
| typegen: "npx wrangler types" | |
| - name: think-compare-runtimes | |
| workspace: "@cloudflare/example-think-compare-runtimes" | |
| path: examples/think-compare-runtimes | |
| - name: tutorial | |
| workspace: "@example/computer-tutorial" | |
| path: examples/tutorial | |
| typegen: "npm run build:types" | |
| - name: worker-javascript | |
| workspace: "@example/computer-worker-javascript" | |
| path: examples/worker-javascript | |
| - name: worker-shell | |
| workspace: "@example/computer-worker-shell" | |
| path: examples/worker-shell | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - uses: ./.github/actions/install | |
| # Examples consume the monorepo packages via local symlinks, so | |
| # @cloudflare/computer's dist/ has to exist before the example's | |
| # typecheck resolves its imports. | |
| - run: npm run build --workspaces --if-present | |
| - name: Generate worker types | |
| if: matrix.typegen | |
| run: ${{ matrix.typegen }} | |
| working-directory: ${{ matrix.path }} | |
| - name: Lint + format check | |
| run: npx biome check ${{ matrix.path }} | |
| - name: Typecheck | |
| run: npm run typecheck --workspace ${{ matrix.workspace }} --if-present | |
| # Most examples don't ship tests today; --if-present keeps this a | |
| # no-op for them while running suites such as think-compare-runtimes. | |
| - name: Test | |
| run: npm test --workspace ${{ matrix.workspace }} --if-present | |
| preview: | |
| name: preview package | |
| if: >- | |
| ${{ | |
| (github.event_name == 'pull_request' && github.head_ref != 'release') || | |
| github.ref == 'refs/heads/release' | |
| }} | |
| needs: [package, example] | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| filter: tree:0 | |
| - uses: ./.github/actions/install | |
| - run: npm run build --workspaces --if-present | |
| - run: npx pkg-pr-new publish --peerDeps ./packages/computer |