Skip to content

Commit 05b1e83

Browse files
authored
Refactor Turbo + CI jobs (#8845)
1 parent 85bd27a commit 05b1e83

File tree

16 files changed

+224
-96
lines changed

16 files changed

+224
-96
lines changed

.github/pr-labeler.config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ e2e:
77
c3-e2e:
88
- any:
99
- changed-files:
10-
- any-glob-to-any-file: "packages/create-cloudflare/**/*"
10+
- any-glob-to-any-file: "packages/create-cloudflare/e2e-tests/**/*"
11+
- any-glob-to-any-file: "packages/create-cloudflare/templates/**/*"
12+
- any-glob-to-any-file: "packages/create-cloudflare/templates-experimental/**/*"
1113
- head-branch: "changeset-release/main"

.github/workflows/c3-e2e.yml

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,74 @@ on:
44
types: [synchronize, opened, reopened, labeled, unlabeled]
55

66
jobs:
7-
turbo-ignore:
8-
if: contains(github.event.*.labels.*.name, 'c3-e2e' ) && github.event.pull_request.head.repo.owner.login == 'cloudflare'
9-
outputs:
10-
skip: ${{ steps.skip.outcome }}
11-
runs-on: ubuntu-latest
7+
e2e-vp:
8+
# Note: please keep this job in sync with the e2e-only-dependabot-bumped-framework one
9+
#  in .github/workflows/c3-e2e-dependabot.yml
10+
if: github.head_ref == 'changeset-release/main'
11+
timeout-minutes: 45
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.pm.name }}-${{ matrix.pm.version }}
14+
cancel-in-progress: true
15+
name: ${{ format('Run tests for {0}@{1} on {2}', matrix.pm.name, matrix.pm.version, matrix.os) }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest]
20+
pm: [{ name: npm, version: "0.0.0" }, { name: yarn, version: "1.0.0" }]
21+
# include a single windows test with pnpm
22+
include:
23+
- os: windows-latest
24+
pm: { name: pnpm, version: "9.12.0" }
25+
runs-on: ${{ matrix.os }}
1226
steps:
1327
- name: Checkout Repo
1428
uses: actions/checkout@v4
1529
with:
1630
fetch-depth: 0
17-
- shell: bash
18-
id: skip
19-
continue-on-error: true
20-
run: |
21-
npx turbo-ignore create-cloudflare --task="test:e2e" --fallback=$(git merge-base origin/main HEAD)
31+
32+
- uses: dorny/paths-filter@v3
33+
id: changes
34+
with:
35+
filters: |
36+
everything_but_markdown:
37+
- '!**/*.md'
38+
- name: Install Dependencies
39+
if: steps.changes.outputs.everything_but_markdown == 'true'
40+
uses: ./.github/actions/install-dependencies
41+
with:
42+
node-version: 20.11.1
43+
turbo-api: ${{ secrets.TURBO_API }}
44+
turbo-team: ${{ secrets.TURBO_TEAM }}
45+
turbo-token: ${{ secrets.TURBO_TOKEN }}
46+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
47+
48+
- name: E2E Tests (experimental)
49+
if: steps.changes.outputs.everything_but_markdown == 'true'
50+
uses: ./.github/actions/run-c3-e2e
51+
with:
52+
node-version: 20.11.1
53+
packageManager: ${{ matrix.pm.name }}
54+
packageManagerVersion: ${{ matrix.pm.version }}
55+
quarantine: false
56+
experimental: true
57+
accountId: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
58+
apiToken: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
59+
60+
- name: E2E Tests (non-experimental)
61+
if: steps.changes.outputs.everything_but_markdown == 'true'
62+
uses: ./.github/actions/run-c3-e2e
63+
with:
64+
node-version: 20.11.1
65+
packageManager: ${{ matrix.pm.name }}
66+
packageManagerVersion: ${{ matrix.pm.version }}
67+
quarantine: false
68+
experimental: false
69+
accountId: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
70+
apiToken: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
2271

2372
e2e:
2473
# Note: please keep this job in sync with the e2e-only-dependabot-bumped-framework one
2574
#  in .github/workflows/c3-e2e-dependabot.yml
26-
needs: ["turbo-ignore"]
27-
if: ${{ needs.turbo-ignore.outputs.skip == 'failure' }}
2875
timeout-minutes: 45
2976
concurrency:
3077
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.pm.name }}-${{ matrix.pm.version }}
@@ -34,16 +81,8 @@ jobs:
3481
fail-fast: false
3582
matrix:
3683
os: [ubuntu-latest]
37-
pm:
38-
[
39-
{ name: npm, version: "0.0.0" },
40-
{ name: pnpm, version: "9.12.0" },
41-
{ name: yarn, version: "1.0.0" },
42-
]
43-
# include a single windows test with pnpm
44-
include:
45-
- os: windows-latest
46-
pm: { name: pnpm, version: "9.12.0" }
84+
pm: [{ name: pnpm, version: "9.12.0" }]
85+
4786
runs-on: ${{ matrix.os }}
4887
steps:
4988
- name: Checkout Repo
@@ -57,7 +96,6 @@ jobs:
5796
filters: |
5897
everything_but_markdown:
5998
- '!**/*.md'
60-
6199
- name: Install Dependencies
62100
if: steps.changes.outputs.everything_but_markdown == 'true'
63101
uses: ./.github/actions/install-dependencies

.github/workflows/create-pullrequest-prerelease.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919

2020
- name: Install Dependencies
2121
uses: ./.github/actions/install-dependencies
22+
with:
23+
turbo-api: ${{ secrets.TURBO_API }}
24+
turbo-team: ${{ secrets.TURBO_TEAM }}
25+
turbo-token: ${{ secrets.TURBO_TOKEN }}
26+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
27+
node-version: ${{ matrix.node_version }}
2228

2329
- name: Build Miniflare
2430
# `extract-runtime-versions.mjs` needs to be able to resolve `miniflare`, but we want to have the correct

.github/workflows/e2e.yml

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ on:
66
repository_dispatch:
77

88
jobs:
9-
e2e-test:
9+
e2e-test-vp:
1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}
1212
cancel-in-progress: true
1313
timeout-minutes: 40
14-
if: github.event_name == 'pull_request' && contains(github.event.*.labels.*.name, 'e2e' ) && github.event.pull_request.head.repo.owner.login == 'cloudflare'
14+
if: github.event_name == 'pull_request' && contains(github.event.*.labels.*.name, 'e2e' ) && github.event.pull_request.head.repo.owner.login == 'cloudflare' && github.head_ref == 'changeset-release/main'
1515
name: "E2E Test"
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [macos-13, windows-2022, ubuntu-22.04]
19+
os: [windows-2022, ubuntu-22.04]
2020
node: ["18"]
2121
runs-on: ${{ matrix.os }}
2222
steps:
@@ -34,12 +34,6 @@ jobs:
3434
turbo-token: ${{ secrets.TURBO_TOKEN }}
3535
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
3636

37-
- name: Run builds
38-
run: pnpm run build
39-
env:
40-
NODE_ENV: "production"
41-
CI_OS: ${{ runner.os }}
42-
4337
- name: Run Vite E2E tests
4438
run: pnpm test:e2e -F @cloudflare/vite-plugin --log-order=stream
4539
env:
@@ -63,19 +57,63 @@ jobs:
6357
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html
6458
CI_OS: ${{ matrix.os }}
6559

66-
- name: Upload debug logs
60+
- name: Upload turbo logs
6761
if: always()
6862
uses: actions/upload-artifact@v4
6963
with:
70-
name: e2e-test-debug-logs-${{ matrix.os }}-${{ matrix.node }}
71-
path: ${{ runner.temp }}/wrangler-debug-logs/
64+
name: turbo-runs-${{ matrix.os }}-${{ matrix.node }}
65+
path: .turbo/runs
7266

73-
- name: Upload test report
74-
if: always()
75-
uses: actions/upload-artifact@v4
67+
e2e-test:
68+
concurrency:
69+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node }}
70+
cancel-in-progress: true
71+
timeout-minutes: 40
72+
if: github.event_name == 'pull_request' && contains(github.event.*.labels.*.name, 'e2e' ) && github.event.pull_request.head.repo.owner.login == 'cloudflare'
73+
name: "E2E Test"
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
os: [macos-13]
78+
node: ["18"]
79+
runs-on: ${{ matrix.os }}
80+
steps:
81+
- name: Checkout Repo
82+
uses: actions/checkout@v4
83+
with:
84+
fetch-depth: 0
85+
86+
- name: Install Dependencies
87+
uses: ./.github/actions/install-dependencies
7688
with:
77-
name: e2e-test-report-${{ matrix.os }}-${{ matrix.node }}
78-
path: ${{ runner.temp }}/test-report/
89+
node-version: ${{ matrix.node }}
90+
turbo-api: ${{ secrets.TURBO_API }}
91+
turbo-team: ${{ secrets.TURBO_TEAM }}
92+
turbo-token: ${{ secrets.TURBO_TOKEN }}
93+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
94+
95+
- name: Run Vite E2E tests
96+
run: pnpm test:e2e -F @cloudflare/vite-plugin --log-order=stream
97+
env:
98+
NODE_DEBUG: "vite-plugin:test"
99+
# The AI tests need to connect to Cloudflare
100+
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
101+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
102+
NODE_OPTIONS: "--max_old_space_size=8192"
103+
CI_OS: ${{ matrix.os }}
104+
105+
- name: Run Wrangler E2E tests
106+
run: pnpm run test:e2e:wrangler
107+
env:
108+
CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }}
109+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }}
110+
HYPERDRIVE_DATABASE_URL: ${{ secrets.TEST_HYPERDRIVE_DATABASE_URL}}
111+
WRANGLER: node --no-warnings ${{ github.workspace}}/packages/wrangler/bin/wrangler.js
112+
WRANGLER_IMPORT: ${{ github.workspace}}/packages/wrangler/wrangler-dist/cli.js
113+
NODE_OPTIONS: "--max_old_space_size=8192"
114+
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
115+
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html
116+
CI_OS: ${{ matrix.os }}
79117

80118
- name: Upload turbo logs
81119
if: always()

.github/workflows/test-and-check.yml

Lines changed: 79 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- run: curl -X POST https://devprod-status-bot.devprod.workers.dev/pr-project/workers-sdk/${{ github.event.number }}
1717

18-
check-non-linux:
18+
check-vp:
1919
if: github.head_ref == 'changeset-release/main'
2020
timeout-minutes: 30
2121
concurrency:
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
os: [macos-latest, windows-latest]
29+
os: [ubuntu-24.04-arm, windows-latest]
3030
runs-on: ${{ matrix.os }}
3131
steps:
3232
- name: Checkout Repo
@@ -62,7 +62,7 @@ jobs:
6262
cancel-in-progress: true
6363

6464
name: "Checks"
65-
runs-on: ubuntu-24.04-arm
65+
runs-on: macos-latest
6666
steps:
6767
- name: Checkout Repo
6868
uses: actions/checkout@v4
@@ -78,19 +78,28 @@ jobs:
7878
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
7979

8080
- name: Build
81-
run: pnpm run build
81+
run: pnpm run build --summarize
8282
env:
8383
CI_OS: ${{ runner.os }}
8484

8585
- name: Check for errors
86-
run: pnpm run check
86+
run: pnpm run check --summarize
8787
env:
8888
NODE_OPTIONS: "--max_old_space_size=8192"
89+
CI_OS: ${{ runner.os }}
8990

9091
- name: Check the changesets
9192
run: node -r esbuild-register tools/deployments/validate-changesets.ts
9293

93-
test:
94+
- name: Upload turbo logs
95+
if: always()
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: turbo-runs-${{ matrix.os }}-${{ matrix.node }}
99+
path: .turbo/runs
100+
101+
test-vp:
102+
if: github.head_ref == 'changeset-release/main'
94103
timeout-minutes: 30
95104
concurrency:
96105
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.filter }}-${{ matrix.node_version }}-test
@@ -105,10 +114,6 @@ jobs:
105114
os_name: Linux
106115
node_version: 18.20.6
107116
filter: '--filter="./tools" --filter="./packages/*" --filter="./fixtures/*" --filter="./packages/vite-plugin-cloudflare/playground"'
108-
- os: macos-latest
109-
os_name: macOS
110-
node_version: 18.20.6
111-
filter: '--filter="./packages/*" --filter="./fixtures/*" --filter="./packages/vite-plugin-cloudflare/playground"'
112117
- os: windows-latest
113118
os_name: Windows
114119
node_version: 18.20.6
@@ -155,3 +160,67 @@ jobs:
155160
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
156161
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html
157162
CI_OS: ${{ matrix.os_name }}
163+
164+
- name: Upload turbo logs
165+
if: always()
166+
uses: actions/upload-artifact@v4
167+
with:
168+
name: turbo-runs-${{ matrix.os }}-${{ matrix.node }}
169+
path: .turbo/runs
170+
171+
test:
172+
timeout-minutes: 30
173+
concurrency:
174+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.filter }}-${{ matrix.node_version }}-test
175+
cancel-in-progress: true
176+
177+
name: ${{ format('Tests ({0})', matrix.os_name) }}
178+
strategy:
179+
fail-fast: false
180+
matrix:
181+
include:
182+
- os: macos-latest
183+
os_name: macOS
184+
node_version: 18.20.6
185+
filter: '--filter="./packages/*" --filter="./fixtures/*" --filter="./packages/vite-plugin-cloudflare/playground" --summarize'
186+
runs-on: ${{ matrix.os }}
187+
steps:
188+
- name: Checkout Repo
189+
uses: actions/checkout@v4
190+
with:
191+
fetch-depth: 0
192+
193+
- uses: dorny/paths-filter@v3
194+
id: changes
195+
with:
196+
filters: |
197+
everything_but_markdown:
198+
- '!**/*.md'
199+
200+
- name: Install Dependencies
201+
if: steps.changes.outputs.everything_but_markdown == 'true'
202+
uses: ./.github/actions/install-dependencies
203+
with:
204+
turbo-api: ${{ secrets.TURBO_API }}
205+
turbo-team: ${{ secrets.TURBO_TEAM }}
206+
turbo-token: ${{ secrets.TURBO_TOKEN }}
207+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
208+
node-version: ${{ matrix.node_version }}
209+
210+
- name: Run tests
211+
if: steps.changes.outputs.everything_but_markdown == 'true'
212+
run: pnpm run test:ci --concurrency 1 ${{ matrix.filter }}
213+
env:
214+
TMP_CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
215+
TMP_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
216+
NODE_OPTIONS: "--max_old_space_size=8192"
217+
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
218+
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/index.html
219+
CI_OS: ${{ matrix.os_name }}
220+
221+
- name: Upload turbo logs
222+
if: always()
223+
uses: actions/upload-artifact@v4
224+
with:
225+
name: turbo-runs-${{ matrix.os }}-${{ matrix.node }}
226+
path: .turbo/runs

packages/create-cloudflare/e2e-tests/frameworks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ const verifyDeployment = async (
275275
return;
276276
}
277277

278-
if (testCommitMessage) {
278+
if (testCommitMessage && process.env.CLOUDFLARE_API_TOKEN) {
279279
await testDeploymentCommitMessage(projectName, frameworkId);
280280
}
281281

0 commit comments

Comments
 (0)