Skip to content

Commit 8ab3261

Browse files
committed
Add integration worker fixture and robust workflow defaults
1 parent 7230771 commit 8ab3261

File tree

9 files changed

+125
-18
lines changed

9 files changed

+125
-18
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<title>Workers Release Promoter Integration Fixture</title>
7+
<style>
8+
:root {
9+
color-scheme: light;
10+
}
11+
body {
12+
margin: 0;
13+
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
14+
background: linear-gradient(135deg, #f7fafc, #eef6ff);
15+
color: #1a2633;
16+
}
17+
main {
18+
max-width: 760px;
19+
margin: 8vh auto;
20+
padding: 2rem;
21+
background: rgba(255, 255, 255, 0.85);
22+
border: 1px solid #d9e2ec;
23+
border-radius: 16px;
24+
box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
25+
}
26+
h1 {
27+
margin-top: 0;
28+
font-size: 1.5rem;
29+
}
30+
p {
31+
line-height: 1.5;
32+
}
33+
code {
34+
background: #f2f5f9;
35+
border-radius: 6px;
36+
padding: 0.15rem 0.4rem;
37+
}
38+
</style>
39+
</head>
40+
<body>
41+
<main>
42+
<h1>Workers Release Promoter Integration Fixture</h1>
43+
<p>This fixture project exists to validate real deployment workflows.</p>
44+
<p>Health endpoint: <code>/health</code></p>
45+
<p>Version endpoint: <code>/version</code></p>
46+
</main>
47+
</body>
48+
</html>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export interface Env {
2+
[key: string]: unknown;
3+
}
4+
5+
function json(body: unknown, status = 200): Response {
6+
return new Response(JSON.stringify(body), {
7+
status,
8+
headers: {
9+
'content-type': 'application/json; charset=utf-8',
10+
'cache-control': 'no-store',
11+
},
12+
});
13+
}
14+
15+
export default {
16+
async fetch(request: Request, _env: Env): Promise<Response> {
17+
const url = new URL(request.url);
18+
19+
if (url.pathname === '/health') {
20+
return json({
21+
status: 'ok',
22+
service: 'workers-release-promoter-fixture',
23+
});
24+
}
25+
26+
if (url.pathname === '/version') {
27+
return json({
28+
timestamp: new Date().toISOString(),
29+
runtime: 'cloudflare-workers',
30+
});
31+
}
32+
33+
return new Response(
34+
'Workers Release Promoter integration fixture is running.',
35+
{
36+
status: 200,
37+
headers: {
38+
'content-type': 'text/plain; charset=utf-8',
39+
'cache-control': 'no-store',
40+
},
41+
},
42+
);
43+
},
44+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name = "workers-release-promoter-fixture"
2+
main = "src/index.ts"
3+
compatibility_date = "2026-03-19"
4+
workers_dev = true
5+
6+
[observability.logs]
7+
enabled = true

.github/workflows/example-release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ jobs:
6969
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
7070
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
7171
worker-name: my-worker
72+
working-directory: .github/integration/worker
7273
environment: production
7374
promotion-strategy: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs['promotion-strategy'] || 'gradual' }}
7475
gradual-steps: '10,50,100'
7576
gradual-step-wait-seconds: '30'
76-
smoke-test-url: https://my-worker.example.workers.dev/health
77+
smoke-test-url: https://example.com
7778
smoke-test-expected-status: '200'
78-
smoke-test-expected-body-contains: '"status":"ok"'
79+
smoke-test-expected-body-contains: 'Example Domain'
80+
smoke-test-command: "node -e \"console.log('smoke command ok')\""
7981
smoke-test-retries: '3'
8082
smoke-test-retry-interval: '2000'
8183
auto-rollback: 'true'

.github/workflows/integration-feature-matrix.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ jobs:
9797
with:
9898
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
9999
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
100-
worker-name: ${{ vars.CF_WORKER_NAME }}
101-
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.' }}
100+
worker-name: ${{ vars.CF_WORKER_NAME || 'my-worker' }}
101+
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.github/integration/worker' }}
102102
environment: ${{ vars.CF_ENVIRONMENT || 'production' }}
103103
promotion-strategy: ${{ matrix.strategy }}
104104
gradual-steps: ${{ matrix.gradual_steps }}
105105
gradual-step-wait-seconds: ${{ vars.CF_GRADUAL_STEP_WAIT_SECONDS || '20' }}
106-
smoke-test-url: ${{ vars.CF_STAGING_SMOKE_URL || vars.CF_PRODUCTION_SMOKE_URL }}
106+
smoke-test-url: ${{ vars.CF_STAGING_SMOKE_URL || vars.CF_PRODUCTION_SMOKE_URL || 'https://example.com' }}
107107
smoke-test-expected-status: ${{ vars.CF_SMOKE_EXPECTED_STATUS || '200' }}
108-
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY }}
108+
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY || 'Example Domain' }}
109+
smoke-test-command: "node -e \"console.log('smoke command ok')\""
109110
smoke-test-retries: ${{ vars.CF_SMOKE_RETRIES || '2' }}
110111
smoke-test-retry-interval: ${{ vars.CF_SMOKE_RETRY_INTERVAL || '1500' }}
111112
auto-rollback: 'true'

.github/workflows/integration-merge-promotion.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,16 @@ jobs:
9696
with:
9797
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
9898
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
99-
worker-name: ${{ vars.CF_WORKER_NAME }}
100-
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.' }}
99+
worker-name: ${{ vars.CF_WORKER_NAME || 'my-worker' }}
100+
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.github/integration/worker' }}
101101
environment: ${{ vars.CF_ENVIRONMENT || 'production' }}
102102
promotion-strategy: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs['promotion-strategy'] || 'immediate' }}
103103
gradual-steps: ${{ vars.CF_GRADUAL_STEPS || '10,50,100' }}
104104
gradual-step-wait-seconds: ${{ vars.CF_GRADUAL_STEP_WAIT_SECONDS || '30' }}
105-
smoke-test-url: ${{ vars.CF_PRODUCTION_SMOKE_URL }}
105+
smoke-test-url: ${{ vars.CF_PRODUCTION_SMOKE_URL || 'https://example.com' }}
106106
smoke-test-expected-status: ${{ vars.CF_SMOKE_EXPECTED_STATUS || '200' }}
107-
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY }}
107+
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY || 'Example Domain' }}
108+
smoke-test-command: "node -e \"console.log('smoke command ok')\""
108109
smoke-test-retries: ${{ vars.CF_SMOKE_RETRIES || '3' }}
109110
smoke-test-retry-interval: ${{ vars.CF_SMOKE_RETRY_INTERVAL || '2000' }}
110111
auto-rollback: 'true'

.github/workflows/integration-pr-validation.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ jobs:
9191
with:
9292
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
9393
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
94-
worker-name: ${{ vars.CF_WORKER_NAME }}
95-
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.' }}
94+
worker-name: ${{ vars.CF_WORKER_NAME || 'my-worker' }}
95+
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.github/integration/worker' }}
9696
environment: ${{ vars.CF_ENVIRONMENT || 'production' }}
9797
promotion-strategy: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs['promotion-strategy'] || 'gradual' }}
9898
gradual-steps: ${{ vars.CF_GRADUAL_STEPS || '10,50,100' }}
9999
gradual-step-wait-seconds: ${{ vars.CF_GRADUAL_STEP_WAIT_SECONDS || '30' }}
100-
smoke-test-url: ${{ vars.CF_STAGING_SMOKE_URL || vars.CF_PRODUCTION_SMOKE_URL }}
100+
smoke-test-url: ${{ vars.CF_STAGING_SMOKE_URL || vars.CF_PRODUCTION_SMOKE_URL || 'https://example.com' }}
101101
smoke-test-expected-status: ${{ vars.CF_SMOKE_EXPECTED_STATUS || '200' }}
102-
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY }}
102+
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY || 'Example Domain' }}
103+
smoke-test-command: "node -e \"console.log('smoke command ok')\""
103104
dry-run: 'true'
104105
github-token: ${{ secrets.GITHUB_TOKEN }}
105106
release-note-mode: 'replace-section'

.github/workflows/integration-release-promotion.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,17 @@ jobs:
124124
with:
125125
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
126126
cloudflare-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
127-
worker-name: ${{ vars.CF_WORKER_NAME }}
128-
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.' }}
127+
worker-name: ${{ vars.CF_WORKER_NAME || 'my-worker' }}
128+
working-directory: ${{ vars.CF_WORKING_DIRECTORY || '.github/integration/worker' }}
129129
environment: ${{ vars.CF_ENVIRONMENT || 'production' }}
130130
promotion-strategy: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs['promotion-strategy'] || 'gradual' }}
131131
gradual-steps: ${{ vars.CF_GRADUAL_STEPS || '10,50,100' }}
132132
gradual-step-wait-seconds: ${{ vars.CF_GRADUAL_STEP_WAIT_SECONDS || '30' }}
133133
post-step-smoke-tests: 'true'
134-
smoke-test-url: ${{ vars.CF_PRODUCTION_SMOKE_URL }}
134+
smoke-test-url: ${{ vars.CF_PRODUCTION_SMOKE_URL || 'https://example.com' }}
135135
smoke-test-expected-status: ${{ vars.CF_SMOKE_EXPECTED_STATUS || '200' }}
136-
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY }}
136+
smoke-test-expected-body-contains: ${{ vars.CF_SMOKE_EXPECTED_BODY || 'Example Domain' }}
137+
smoke-test-command: "node -e \"console.log('smoke command ok')\""
137138
smoke-test-retries: ${{ vars.CF_SMOKE_RETRIES || '3' }}
138139
smoke-test-retry-interval: ${{ vars.CF_SMOKE_RETRY_INTERVAL || '2000' }}
139140
auto-rollback: 'true'

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ For production-ready integration templates, use these workflow files directly:
1515
- `.github/workflows/integration-merge-promotion.yml` -- merge-group and main-branch promotion flow
1616
- `.github/workflows/integration-feature-matrix.yml` -- manual matrix coverage for strategy and release-note modes
1717

18+
For out-of-the-box testing, this repository also includes a deployable Worker fixture at `.github/integration/worker`.
19+
1820
---
1921

2022
## Features

0 commit comments

Comments
 (0)