1name: Cloudflare Tools
2
3on:
4 push:
5 branches: [main]
6 paths:
7 - "submodules/distilled"
8 - "packages/cloudflare-runtime/**"
9 - "packages/cloudflare-test-tools/**"
10 - "packages/frontend-frameworks/**"
11 - "packages/node-utils/**"
12 - "scripts/copy-package-files.ts"
13 - "patches/**"
14 - "package.json"
15 - "pnpm-lock.yaml"
16 - "pnpm-workspace.yaml"
17 - "turbo.json"
18 - "tsconfig.json"
19 - ".github/workflows/cloudflare-tools.yml"
20 pull_request:
21 types: [opened, reopened, synchronize]
22 paths:
23 - "submodules/distilled"
24 - "packages/cloudflare-runtime/**"
25 - "packages/cloudflare-test-tools/**"
26 - "packages/frontend-frameworks/**"
27 - "packages/node-utils/**"
28 - "scripts/copy-package-files.ts"
29 - "patches/**"
30 - "package.json"
31 - "pnpm-lock.yaml"
32 - "pnpm-workspace.yaml"
33 - "turbo.json"
34 - "tsconfig.json"
35 - ".github/workflows/cloudflare-tools.yml"
36 workflow_dispatch:
37
38permissions:
39 contents: read
40
41concurrency:
42 group: cloudflare-tools-${{ github.ref }}
43 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
44
45jobs:
46 test:
47 # GitHub does not expose repository secrets to fork pull requests. Keep
48 # the secret-backed test matrix on trusted refs while still running it for
49 # pushes, manual dispatches, and pull requests from this repository.
50 if: >-
51 github.event_name != 'pull_request' ||
52 github.event.pull_request.head.repo.full_name == github.repository
53 name: Test (${{ matrix.os }})
54 runs-on: ${{ matrix.os }}
55 strategy:
56 fail-fast: false
57 matrix:
58 os:
59 - blacksmith-8vcpu-ubuntu-2404
60 - blacksmith-6vcpu-macos-latest
61 - blacksmith-8vcpu-windows-2025
62 steps:
63 - name: Checkout repository
64 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65
66 - name: Checkout distilled
67 run: git submodule update --init --depth=1 --checkout -- submodules/distilled
68
69 - name: Restore Turbo cache
70 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
71 with:
72 path: .turbo
73 key: turbo-${{ runner.os }}-${{ github.repository_id }}-${{ github.sha }}-${{ github.workflow }}-${{ github.run_attempt }}
74 restore-keys: |
75 turbo-${{ runner.os }}-${{ github.repository_id }}-${{ github.sha }}-
76 turbo-${{ runner.os }}-${{ github.repository_id }}-
77
78 - name: Setup pnpm, Node.js, Bun and install dependencies
79 uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
80 with:
81 cache: true
82 install: true
83 require-lockfile: true
84
85 - name: Typecheck
86 run: pnpm typecheck:cloudflare-packages
87
88 - name: Test
89 run: pnpm test:cloudflare-packages ${{ runner.os == 'Windows' && '--concurrency=3' || runner.os == 'macOS' && '--concurrency=2' || '' }}
90 env:
91 TEST_MYSQL_URL: ${{ secrets.TEST_MYSQL_URL }}
92 TEST_POSTGRES_URL: ${{ secrets.TEST_POSTGRES_URL }}
93 CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
94 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
95 TEST_KV_NAMESPACE_ID: ${{ secrets.TEST_KV_NAMESPACE_ID }}
96 TEST_R2_BUCKET_NAME: ${{ secrets.TEST_R2_BUCKET_NAME }}
97 TEST_D1_DATABASE_ID: ${{ secrets.TEST_D1_DATABASE_ID }}
98 TEST_SERVICE_WORKER_NAME: ${{ secrets.TEST_SERVICE_WORKER_NAME }}