Consolidate egress configuration across backends #226
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 every push to main or next, so a merge | |
| # that slipped through (admin override, branch protection off, | |
| # etc.) still gets the same lint/build/typecheck/test signal. | |
| # | |
| # Path filter skips 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] | |
| paths-ignore: | |
| - "**/*.md" | |
| - "docs/**" | |
| - ".github/**/*.md" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # PRs key on the PR number so successive pushes cancel the prior | |
| # run; pushes to main key on the ref so we never cancel a main | |
| # build (those are the historical signal). | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| 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 | |
| - name: rpc | |
| workspace: "@cloudflare/computer-rpc" | |
| path: packages/rpc | |
| needs-siblings: true | |
| - name: computer | |
| workspace: "@cloudflare/computer" | |
| path: packages/computer | |
| needs-siblings: true | |
| - name: computerd | |
| workspace: "@cloudflare/computerd" | |
| path: packages/computerd | |
| needs-siblings: 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. | |
| system-deps: "libfuse2t64 fuse3" | |
| 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 }} | |
| # 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 | |
| - 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 | |
| example: | |
| name: example/${{ matrix.name }} | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: think | |
| workspace: "@cloudflare/example-think" | |
| path: examples/think | |
| - name: container | |
| workspace: "@example/computer-container" | |
| path: examples/container | |
| 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 | |
| run: npx wrangler types | |
| 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 | |
| # Examples don't ship tests today; --if-present makes this a | |
| # no-op until they do. | |
| - name: Test | |
| run: npm test --workspace ${{ matrix.workspace }} --if-present | |
| preview: | |
| name: preview package | |
| if: github.event_name == 'pull_request' | |
| 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 |