@rexezuge/tooling 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -34
- package/dist/eslint-options.d.ts +54 -0
- package/dist/eslint-options.d.ts.map +1 -0
- package/dist/eslint-options.js +0 -0
- package/dist/eslint-options.js.map +7 -0
- package/dist/eslint-rules.d.ts.map +1 -1
- package/dist/eslint-rules.js +1 -1
- package/dist/eslint-rules.js.map +2 -2
- package/dist/eslint-strict.d.ts +2 -1
- package/dist/eslint-strict.d.ts.map +1 -1
- package/dist/eslint-strict.js +2 -1
- package/dist/eslint-strict.js.map +3 -3
- package/dist/eslint.d.ts +2 -53
- package/dist/eslint.d.ts.map +1 -1
- package/dist/eslint.js.map +2 -2
- package/dist/manifest-validate.d.ts.map +1 -1
- package/dist/manifest-validate.js +1 -1
- package/dist/manifest-validate.js.map +3 -3
- package/dist/manifest.d.ts +21 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js.map +2 -2
- package/dist/pages-proxy.d.ts +2 -0
- package/dist/pages-proxy.d.ts.map +1 -0
- package/dist/pages-proxy.js +1 -0
- package/dist/pages-proxy.js.map +7 -0
- package/dist/plugin-option.d.ts +15 -0
- package/dist/plugin-option.d.ts.map +1 -0
- package/dist/plugin-option.js +1 -0
- package/dist/plugin-option.js.map +7 -0
- package/dist/scripts/backup/destinations.d.ts +40 -0
- package/dist/scripts/backup/destinations.d.ts.map +1 -0
- package/dist/scripts/backup/destinations.js +1 -0
- package/dist/scripts/backup/destinations.js.map +7 -0
- package/dist/scripts/backup/encrypt-backup.d.ts +5 -2
- package/dist/scripts/backup/encrypt-backup.d.ts.map +1 -1
- package/dist/scripts/backup/encrypt-backup.js +2 -3
- package/dist/scripts/backup/encrypt-backup.js.map +3 -3
- package/dist/scripts/backup/naming.d.ts +1 -1
- package/dist/scripts/backup/naming.d.ts.map +1 -1
- package/dist/scripts/backup/naming.js +1 -1
- package/dist/scripts/backup/naming.js.map +3 -3
- package/dist/scripts/ensure-spa-shell-stub.d.ts +4 -2
- package/dist/scripts/ensure-spa-shell-stub.d.ts.map +1 -1
- package/dist/scripts/ensure-spa-shell-stub.js +1 -2
- package/dist/scripts/ensure-spa-shell-stub.js.map +3 -3
- package/dist/scripts/init-secrets.d.ts +1 -2
- package/dist/scripts/init-secrets.d.ts.map +1 -1
- package/dist/scripts/init-secrets.js +2 -3
- package/dist/scripts/init-secrets.js.map +3 -3
- package/dist/scripts/migrations-lock.d.ts +6 -2
- package/dist/scripts/migrations-lock.d.ts.map +1 -1
- package/dist/scripts/migrations-lock.js +1 -2
- package/dist/scripts/migrations-lock.js.map +3 -3
- package/dist/scripts/prepare-wrangler-config.d.ts +6 -2
- package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
- package/dist/scripts/prepare-wrangler-config.js +1 -2
- package/dist/scripts/prepare-wrangler-config.js.map +3 -3
- package/dist/scripts/validate-locales.d.ts +20 -2
- package/dist/scripts/validate-locales.d.ts.map +1 -1
- package/dist/scripts/validate-locales.js +5 -5
- package/dist/scripts/validate-locales.js.map +3 -3
- package/dist/scripts/verify-spa-shell.d.ts +7 -2
- package/dist/scripts/verify-spa-shell.d.ts.map +1 -1
- package/dist/scripts/verify-spa-shell.js +1 -2
- package/dist/scripts/verify-spa-shell.js.map +3 -3
- package/dist/scripts/wrangler-config/resources.d.ts +11 -2
- package/dist/scripts/wrangler-config/resources.d.ts.map +1 -1
- package/dist/scripts/wrangler-config/resources.js +1 -1
- package/dist/scripts/wrangler-config/resources.js.map +3 -3
- package/dist/vite.d.ts +2 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -3
- package/dist/vite.js.map +3 -3
- package/dist/vitest-aliases.d.ts +7 -1
- package/dist/vitest-aliases.d.ts.map +1 -1
- package/dist/vitest-aliases.js +1 -1
- package/dist/vitest-aliases.js.map +3 -3
- package/dist/vitest-integration.d.ts +3 -2
- package/dist/vitest-integration.d.ts.map +1 -1
- package/dist/vitest-integration.js +1 -1
- package/dist/vitest-integration.js.map +3 -3
- package/dist/vitest-repo.d.ts +3 -2
- package/dist/vitest-repo.d.ts.map +1 -1
- package/dist/vitest-repo.js +1 -1
- package/dist/vitest-repo.js.map +3 -3
- package/dist/vitest-web.d.ts +3 -2
- package/dist/vitest-web.d.ts.map +1 -1
- package/dist/vitest-web.js +1 -1
- package/dist/vitest-web.js.map +3 -3
- package/dist/vitest.d.ts +4 -3
- package/dist/vitest.d.ts.map +1 -1
- package/dist/vitest.js +1 -1
- package/dist/vitest.js.map +3 -3
- package/package.json +3 -3
- package/presets/tsconfig/web.json +2 -2
- package/schema/manifest.schema.json +28 -1
- package/src/eslint-options.ts +54 -0
- package/src/eslint-rules.ts +4 -0
- package/src/eslint-strict.test.ts +29 -0
- package/src/eslint-strict.ts +36 -4
- package/src/eslint.ts +2 -53
- package/src/github/dependabot.yml +14 -4
- package/src/github/workflows/backup-d1.yml +15 -0
- package/src/github/workflows/backup-main.yml +9 -126
- package/src/github/workflows/continuous-deployment.yml +11 -180
- package/src/github/workflows/continuous-integration.yml +9 -249
- package/src/github/workflows/scheduled-version-update.yml +8 -31
- package/src/github/workflows/upstream-sync.yml +8 -49
- package/src/manifest-validate.ts +31 -2
- package/src/manifest.test.ts +22 -0
- package/src/manifest.ts +22 -0
- package/src/pages-proxy.test.ts +8 -0
- package/src/pages-proxy.ts +13 -0
- package/src/plugin-option.test.ts +13 -0
- package/src/plugin-option.ts +18 -0
- package/src/presets.test.ts +5 -1
- package/src/scripts/backup/backup-rules.test.ts +22 -0
- package/src/scripts/backup/destinations.ts +59 -0
- package/src/scripts/backup/encrypt-backup.ts +58 -48
- package/src/scripts/backup/naming.ts +2 -2
- package/src/scripts/ensure-spa-shell-stub.ts +18 -10
- package/src/scripts/entrypoints.test.ts +55 -0
- package/src/scripts/init-secrets.ts +8 -6
- package/src/scripts/migrations-lock.ts +22 -17
- package/src/scripts/prepare-wrangler-config.ts +34 -14
- package/src/scripts/validate-locales.ts +39 -17
- package/src/scripts/verify-spa-shell.ts +21 -20
- package/src/scripts/wrangler-config/resources.test.ts +10 -0
- package/src/scripts/wrangler-config/resources.ts +21 -4
- package/src/vite.ts +5 -3
- package/src/vitest-aliases.test.ts +33 -0
- package/src/vitest-aliases.ts +37 -7
- package/src/vitest-integration.ts +7 -8
- package/src/vitest-repo.ts +7 -5
- package/src/vitest-web.ts +7 -5
- package/src/vitest.ts +8 -6
- package/src/github/actions/retry-step/action.yml +0 -55
- package/src/github/actions/setup-env/action.yml +0 -20
|
@@ -1,188 +1,19 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# Converged from the eight repos that deploy (Records-Provider and CalDAV-Bridge
|
|
4
|
-
# deploy differently and are left out of this merge). The shape: a `workflow_run`
|
|
5
|
-
# trigger so the deploy runs against the SHA CI actually approved, then the
|
|
6
|
-
# wrangler config materialized from the template — no committed secrets — then the
|
|
7
|
-
# secrets provisioned, then the database migrated, then a dry run as a gate, then
|
|
8
|
-
# the deploy.
|
|
9
|
-
#
|
|
10
|
-
# PLACEHOLDERS:
|
|
11
|
-
# * REPLACE_ME_SCOPE the npm scope, in `pnpm --filter @REPLACE_ME_SCOPE/web build`.
|
|
12
|
-
# * REPLACE_ME_D1_BINDING the D1 binding `wrangler d1 migrations apply` targets.
|
|
13
|
-
# * REPLACE_ME_PAGES the Cloudflare Pages project name, for repos with a SPA.
|
|
14
|
-
#
|
|
15
|
-
# The two workspace variables the config step reads (`WRANGLER_JSONC`,
|
|
16
|
-
# `WRANGLER_PATCH_JSON`, `WRANGLER_VARS_PATCH_JSON`) are how a repo with several
|
|
17
|
-
# environments supplies per-environment settings without a second template file.
|
|
18
|
-
|
|
1
|
+
# A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-cd.yml (tag v1).
|
|
2
|
+
# Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
|
|
19
3
|
name: Continuous Deployment
|
|
20
4
|
|
|
21
|
-
permissions:
|
|
22
|
-
contents: read
|
|
23
|
-
|
|
24
5
|
on:
|
|
25
6
|
workflow_run:
|
|
26
|
-
workflows:
|
|
27
|
-
|
|
28
|
-
branches:
|
|
29
|
-
- main
|
|
30
|
-
types:
|
|
31
|
-
- completed
|
|
7
|
+
workflows: ['Continuous Integration']
|
|
8
|
+
types: [completed]
|
|
9
|
+
branches: [main]
|
|
32
10
|
repository_dispatch:
|
|
33
|
-
types:
|
|
34
|
-
- Upstream Sync Deployment
|
|
11
|
+
types: [upstream-sync]
|
|
35
12
|
workflow_dispatch:
|
|
36
13
|
|
|
37
|
-
concurrency:
|
|
38
|
-
group: continuous-deployment-${{ github.event.workflow_run.head_branch || github.event.client_payload.branch || github.ref }}
|
|
39
|
-
cancel-in-progress: false
|
|
40
|
-
|
|
41
14
|
jobs:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
steps:
|
|
48
|
-
- name: Checkout Repository
|
|
49
|
-
uses: actions/checkout@v6
|
|
50
|
-
with:
|
|
51
|
-
# The SHA CI approved, not the tip of main: a push that lands while the
|
|
52
|
-
# workflow_run is in flight must not be what gets deployed.
|
|
53
|
-
ref: ${{ github.event.workflow_run.head_sha || github.event.client_payload.sha || github.sha }}
|
|
54
|
-
|
|
55
|
-
- name: Setup Environment
|
|
56
|
-
uses: ./.github/actions/setup-env
|
|
57
|
-
|
|
58
|
-
- name: Prepare Wrangler Configuration
|
|
59
|
-
uses: ./.github/actions/retry-step
|
|
60
|
-
with:
|
|
61
|
-
command: pnpm exec tsx scripts/prepare-wrangler-config.ts
|
|
62
|
-
max_attempts: '3'
|
|
63
|
-
env:
|
|
64
|
-
WRANGLER_JSONC: ${{ vars.WRANGLER_JSONC }}
|
|
65
|
-
WRANGLER_PATCH_JSON: ${{ vars.WRANGLER_PATCH_JSON }}
|
|
66
|
-
WRANGLER_VARS_PATCH_JSON: ${{ vars.WRANGLER_VARS_PATCH_JSON }}
|
|
67
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
68
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
69
|
-
|
|
70
|
-
# A `secrets_store_secrets` binding fails the deploy unless the named secret
|
|
71
|
-
# already exists. Nothing creates it — Cloudflare will not generate a value —
|
|
72
|
-
# so this is the only thing standing between a fresh account and a deploy that
|
|
73
|
-
# cannot succeed. Create-if-absent: an existing value still seals every stored
|
|
74
|
-
# credential and is never replaced by a redeploy.
|
|
75
|
-
- name: Initialize Cloudflare Secrets
|
|
76
|
-
uses: ./.github/actions/retry-step
|
|
77
|
-
with:
|
|
78
|
-
command: pnpm exec tsx scripts/init-secrets.ts
|
|
79
|
-
max_attempts: '3'
|
|
80
|
-
env:
|
|
81
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
82
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
83
|
-
|
|
84
|
-
# PLACEHOLDER: the D1 binding to migrate.
|
|
85
|
-
- name: Apply Database Migration
|
|
86
|
-
uses: ./.github/actions/retry-step
|
|
87
|
-
with:
|
|
88
|
-
command: pnpm exec wrangler d1 migrations apply REPLACE_ME_D1_BINDING --remote
|
|
89
|
-
max_attempts: '3'
|
|
90
|
-
env:
|
|
91
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
92
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
93
|
-
|
|
94
|
-
# PLACEHOLDER: the workspace filter for the SPA. The API worker serves the
|
|
95
|
-
# shell this build embeds, so the build is a precondition of the deploy, not
|
|
96
|
-
# a convenience.
|
|
97
|
-
- name: Build Web App
|
|
98
|
-
run: pnpm --filter @REPLACE_ME_SCOPE/web build
|
|
99
|
-
|
|
100
|
-
# A gate, not a rehearsal. Separate from the deploy below and deliberately
|
|
101
|
-
# **not** retried: a dry run that fails is a real defect — a bundle over the
|
|
102
|
-
# size limit, a binding the template no longer declares — and retrying it
|
|
103
|
-
# three times only delays the report while making the log harder to read.
|
|
104
|
-
- name: Dry Run Deploy with Wrangler
|
|
105
|
-
run: pnpm exec wrangler deploy --dry-run
|
|
106
|
-
env:
|
|
107
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
108
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
109
|
-
|
|
110
|
-
- name: Deploy with Wrangler
|
|
111
|
-
uses: ./.github/actions/retry-step
|
|
112
|
-
with:
|
|
113
|
-
command: pnpm exec wrangler deploy
|
|
114
|
-
max_attempts: '3'
|
|
115
|
-
env:
|
|
116
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
117
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
118
|
-
|
|
119
|
-
# Repos with a Pages front end keep this job; it is the reason
|
|
120
|
-
# `functions/[[path]].ts` exists — Pages serves `dist/` as static files, and
|
|
121
|
-
# `/user/...` would resolve to a 404 without the catch-all proxy to the worker.
|
|
122
|
-
deploy-pages:
|
|
123
|
-
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
|
|
124
|
-
name: Deploy Cloudflare Pages
|
|
125
|
-
runs-on: ubuntu-latest
|
|
126
|
-
|
|
127
|
-
steps:
|
|
128
|
-
- name: Checkout Repository
|
|
129
|
-
uses: actions/checkout@v6
|
|
130
|
-
with:
|
|
131
|
-
ref: ${{ github.event.workflow_run.head_sha || github.event.client_payload.sha || github.sha }}
|
|
132
|
-
|
|
133
|
-
- name: Setup Environment
|
|
134
|
-
uses: ./.github/actions/setup-env
|
|
135
|
-
|
|
136
|
-
# PLACEHOLDER: the workspace filter for the SPA.
|
|
137
|
-
- name: Build Frontend
|
|
138
|
-
run: pnpm --filter @REPLACE_ME_SCOPE/web build
|
|
139
|
-
|
|
140
|
-
- name: Configure Pages Service Bindings
|
|
141
|
-
run: cp apps/web/wrangler.template.jsonc wrangler.jsonc
|
|
142
|
-
|
|
143
|
-
# PLACEHOLDER: the Pages project name. Created if absent, and then polled
|
|
144
|
-
# until it is visible, because a project that exists but is not yet listed
|
|
145
|
-
# makes the deploy below fail with an error that names the deploy rather
|
|
146
|
-
# than the propagation delay.
|
|
147
|
-
- name: Ensure Pages Project Exists
|
|
148
|
-
env:
|
|
149
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
150
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
151
|
-
PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || 'REPLACE_ME_PAGES' }}
|
|
152
|
-
DEPLOY_BRANCH: ${{ github.event.workflow_run.head_branch || github.event.client_payload.branch || github.ref_name }}
|
|
153
|
-
run: |
|
|
154
|
-
if CREATE_OUTPUT="$(pnpm exec wrangler pages project create "${PROJECT}" --production-branch "${DEPLOY_BRANCH}" 2>&1)"; then
|
|
155
|
-
echo "Created Pages project \"${PROJECT}\"."
|
|
156
|
-
elif echo "${CREATE_OUTPUT}" | grep -qi "already exists"; then
|
|
157
|
-
echo "Pages project \"${PROJECT}\" already exists."
|
|
158
|
-
else
|
|
159
|
-
echo "${CREATE_OUTPUT}"
|
|
160
|
-
echo "Failed to create Pages project \"${PROJECT}\"." >&2
|
|
161
|
-
exit 1
|
|
162
|
-
fi
|
|
163
|
-
for _ in $(seq 1 18); do
|
|
164
|
-
if pnpm exec wrangler pages project list 2>/dev/null | grep -qE "(^|[[:space:]])${PROJECT}([[:space:]]|$)"; then
|
|
165
|
-
echo "Pages project \"${PROJECT}\" is ready."
|
|
166
|
-
exit 0
|
|
167
|
-
fi
|
|
168
|
-
sleep 5
|
|
169
|
-
done
|
|
170
|
-
echo "Pages project \"${PROJECT}\" is still not visible after polling." >&2
|
|
171
|
-
exit 1
|
|
172
|
-
|
|
173
|
-
- name: Deploy with Wrangler Pages
|
|
174
|
-
uses: ./.github/actions/retry-step
|
|
175
|
-
with:
|
|
176
|
-
command: >
|
|
177
|
-
pnpm exec wrangler pages deploy apps/web/dist
|
|
178
|
-
--project-name "${PROJECT}"
|
|
179
|
-
--branch "${DEPLOY_BRANCH}"
|
|
180
|
-
--commit-hash "${DEPLOY_SHA}"
|
|
181
|
-
--commit-message "$(git log -1 --pretty=%s)"
|
|
182
|
-
max_attempts: '3'
|
|
183
|
-
env:
|
|
184
|
-
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
185
|
-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
186
|
-
PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || 'REPLACE_ME_PAGES' }}
|
|
187
|
-
DEPLOY_BRANCH: ${{ github.event.workflow_run.head_branch || github.event.client_payload.branch || github.ref_name }}
|
|
188
|
-
DEPLOY_SHA: ${{ github.event.workflow_run.head_sha || github.event.client_payload.sha || github.sha }}
|
|
15
|
+
worker-cd:
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-cd.yml@v1
|
|
19
|
+
secrets: inherit
|
|
@@ -1,259 +1,19 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# The most-common superset of the nine repos' CI workflows. Each job exists because
|
|
4
|
-
# its failure is invisible to every other job: a locale defect still typechecks, a
|
|
5
|
-
# god file still lints, an edited migration still deploys. A job per gate means the
|
|
6
|
-
# run log names the tool that broke rather than burying it in a `checks` job.
|
|
7
|
-
#
|
|
8
|
-
# PLACEHOLDERS — the things a consumer must change for this to run at all:
|
|
9
|
-
# * REPLACE_ME_SCOPE the npm scope, in the `pnpm --filter @REPLACE_ME_SCOPE/web build`
|
|
10
|
-
# invocations below.
|
|
11
|
-
# * REPLACE_ME_WEB_FILTER the workspace filter for the SPA (usually @REPLACE_ME_SCOPE/web).
|
|
12
|
-
# * REPLACE_ME_MIGRATIONS the D1 binding `wrangler d1 migrations apply` targets.
|
|
13
|
-
#
|
|
14
|
-
# The script names in the `run:` steps are the ones this package's scripts suggest;
|
|
15
|
-
# see README.md for the package.json wiring.
|
|
16
|
-
|
|
1
|
+
# A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-ci.yml (tag v1).
|
|
2
|
+
# Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
|
|
17
3
|
name: Continuous Integration
|
|
18
4
|
|
|
19
|
-
permissions:
|
|
20
|
-
contents: read
|
|
21
|
-
|
|
22
5
|
on:
|
|
23
|
-
repository_dispatch:
|
|
24
|
-
types:
|
|
25
|
-
- Upstream Sync Integration
|
|
26
|
-
pull_request:
|
|
27
6
|
push:
|
|
28
|
-
branches:
|
|
29
|
-
|
|
7
|
+
branches: [main]
|
|
8
|
+
pull_request:
|
|
9
|
+
repository_dispatch:
|
|
10
|
+
types: [upstream-sync]
|
|
30
11
|
workflow_dispatch:
|
|
31
12
|
|
|
32
|
-
concurrency:
|
|
33
|
-
group: continuous-integration-${{ github.ref }}
|
|
34
|
-
cancel-in-progress: true
|
|
35
|
-
|
|
36
13
|
jobs:
|
|
37
|
-
|
|
38
|
-
# nothing but a checkout while the gates are read-only consumers of the tree.
|
|
39
|
-
checks:
|
|
40
|
-
name: Checks
|
|
41
|
-
runs-on: ubuntu-latest
|
|
42
|
-
|
|
43
|
-
steps:
|
|
44
|
-
- name: Checkout Repository
|
|
45
|
-
uses: actions/checkout@v6
|
|
46
|
-
|
|
47
|
-
- name: Setup Environment
|
|
48
|
-
uses: ./.github/actions/setup-env
|
|
49
|
-
|
|
50
|
-
# `pnpm -r typecheck` reaches every workspace package, `test/` among them.
|
|
51
|
-
- name: Run Type Check and Lint
|
|
52
|
-
run: pnpm -r typecheck && pnpm run lint
|
|
53
|
-
|
|
54
|
-
# Its own step, and read-only, because the `lint` job cannot catch this:
|
|
55
|
-
# `pnpm run lint` is `eslint --fix --quiet`, and `--fix` repairs what it can
|
|
56
|
-
# while `--quiet` suppresses the rest — so CI exits 0 on a tree Prettier
|
|
57
|
-
# rejects, the repairs land in the runner's checkout, and they are thrown
|
|
58
|
-
# away. `prettier --check` is the one command that fails instead of
|
|
59
|
-
# repairing. Edge-Sonic had 242 files in exactly that state.
|
|
60
|
-
- name: Check Formatting
|
|
61
|
-
run: pnpm run format:check
|
|
62
|
-
|
|
63
|
-
- name: Check God-Files
|
|
64
|
-
uses: ./.github/actions/retry-step
|
|
65
|
-
with:
|
|
66
|
-
command: pnpm run check:god-files
|
|
67
|
-
max_attempts: '2'
|
|
68
|
-
|
|
69
|
-
# A locale defect is invisible to the unit tests: the catalogs are data, and
|
|
70
|
-
# a key missing from every bundle still typechecks and still builds.
|
|
71
|
-
- name: Validate Locale Bundles
|
|
72
|
-
uses: ./.github/actions/retry-step
|
|
73
|
-
with:
|
|
74
|
-
command: pnpm run validate:locales
|
|
75
|
-
max_attempts: '2'
|
|
76
|
-
|
|
77
|
-
# Editing an already-applied migration is invisible to every other check:
|
|
78
|
-
# the deploy succeeds, fresh databases pick up the edited statements, and
|
|
79
|
-
# production keeps the schema it had. The lock is what turns that into a
|
|
80
|
-
# failure, and this job is read-only — `migrations-lock` is the operator's
|
|
81
|
-
# command, deliberately not CI's.
|
|
82
|
-
- name: Verify Migration Lock
|
|
83
|
-
uses: ./.github/actions/retry-step
|
|
84
|
-
with:
|
|
85
|
-
command: pnpm run validate:migrations
|
|
86
|
-
max_attempts: '2'
|
|
87
|
-
|
|
88
|
-
unit-tests:
|
|
89
|
-
name: Unit Tests
|
|
90
|
-
runs-on: ubuntu-latest
|
|
91
|
-
|
|
92
|
-
steps:
|
|
93
|
-
- name: Checkout Repository
|
|
94
|
-
uses: actions/checkout@v6
|
|
95
|
-
|
|
96
|
-
- name: Setup Environment
|
|
97
|
-
uses: ./.github/actions/setup-env
|
|
98
|
-
|
|
99
|
-
- name: Run Tests with Coverage
|
|
100
|
-
uses: ./.github/actions/retry-step
|
|
101
|
-
with:
|
|
102
|
-
command: pnpm run test:coverage
|
|
103
|
-
max_attempts: '2'
|
|
104
|
-
|
|
105
|
-
- name: Upload Coverage Report
|
|
106
|
-
if: always()
|
|
107
|
-
uses: actions/upload-artifact@v4
|
|
108
|
-
with:
|
|
109
|
-
name: coverage-report
|
|
110
|
-
path: coverage/
|
|
111
|
-
retention-days: 14
|
|
112
|
-
|
|
113
|
-
# The SPA's own suite. Only repositories with a Vite SPA keep this job; the two
|
|
114
|
-
# configs partition the suite rather than each running all of it, so a jsdom
|
|
115
|
-
# suite under `node` cannot pass while failing.
|
|
116
|
-
web-tests:
|
|
117
|
-
name: Web Tests
|
|
118
|
-
runs-on: ubuntu-latest
|
|
119
|
-
|
|
120
|
-
steps:
|
|
121
|
-
- name: Checkout Repository
|
|
122
|
-
uses: actions/checkout@v6
|
|
123
|
-
|
|
124
|
-
- name: Setup Environment
|
|
125
|
-
uses: ./.github/actions/setup-env
|
|
126
|
-
|
|
127
|
-
- name: Run SPA Unit Tests
|
|
128
|
-
run: pnpm run test:web
|
|
129
|
-
|
|
130
|
-
integration-tests:
|
|
131
|
-
name: Integration Tests
|
|
132
|
-
runs-on: ubuntu-latest
|
|
133
|
-
|
|
134
|
-
steps:
|
|
135
|
-
- name: Checkout Repository
|
|
136
|
-
uses: actions/checkout@v6
|
|
137
|
-
|
|
138
|
-
- name: Setup Environment
|
|
139
|
-
uses: ./.github/actions/setup-env
|
|
140
|
-
|
|
141
|
-
- name: Run Integration Tests
|
|
142
|
-
run: pnpm run test:integration
|
|
143
|
-
|
|
144
|
-
# Only the SPA build. The API worker is typechecked by `pnpm -r typecheck` above,
|
|
145
|
-
# so repeating it here would run the same `tsc --noEmit` against the same
|
|
146
|
-
# tsconfig a second time.
|
|
147
|
-
build:
|
|
148
|
-
name: Build Web App
|
|
149
|
-
runs-on: ubuntu-latest
|
|
150
|
-
|
|
151
|
-
steps:
|
|
152
|
-
- name: Checkout Repository
|
|
153
|
-
uses: actions/checkout@v6
|
|
154
|
-
|
|
155
|
-
- name: Setup Environment
|
|
156
|
-
uses: ./.github/actions/setup-env
|
|
157
|
-
|
|
158
|
-
# PLACEHOLDER: the workspace filter for the SPA.
|
|
159
|
-
- name: Build Web App
|
|
160
|
-
run: pnpm --filter @REPLACE_ME_SCOPE/web build
|
|
161
|
-
|
|
162
|
-
# Verifies the shell the API worker *serves*, which is a different artifact from
|
|
163
|
-
# `apps/web/dist/` — it is embedded into `apps/api/src/generated/spa-shell.ts` by
|
|
164
|
-
# the Vite plugin, and both are gitignored. A stale-but-present shell is a deploy
|
|
165
|
-
# that serves yesterday's operator UI.
|
|
166
|
-
#
|
|
167
|
-
# It builds first rather than depending on `build`, so the failure says "the
|
|
168
|
-
# served shell is wrong" instead of arriving inside a build log. That costs a
|
|
169
|
-
# second Vite build per run; the alternative — verifying inside `build` — is free
|
|
170
|
-
# and is the trade being made here.
|
|
171
|
-
spa-shell:
|
|
172
|
-
name: Verify SPA Shell
|
|
173
|
-
runs-on: ubuntu-latest
|
|
174
|
-
|
|
175
|
-
steps:
|
|
176
|
-
- name: Checkout Repository
|
|
177
|
-
uses: actions/checkout@v6
|
|
178
|
-
|
|
179
|
-
- name: Setup Environment
|
|
180
|
-
uses: ./.github/actions/setup-env
|
|
181
|
-
|
|
182
|
-
# PLACEHOLDER: the workspace filter for the SPA.
|
|
183
|
-
- name: Build Web App
|
|
184
|
-
run: pnpm --filter @REPLACE_ME_SCOPE/web build
|
|
185
|
-
|
|
186
|
-
# The build is a **precondition**, not a convenience: a fresh checkout has
|
|
187
|
-
# neither `apps/web/dist/` nor `apps/api/src/generated/`, and postinstall
|
|
188
|
-
# writes a deliberately empty stub so `tsc` can resolve `SPA_HTML` before
|
|
189
|
-
# anyone has built. Verifying without building cannot pass, and it fails
|
|
190
|
-
# with precisely the message the check exists to give.
|
|
191
|
-
- name: Verify The SPA Shell
|
|
192
|
-
uses: ./.github/actions/retry-step
|
|
193
|
-
with:
|
|
194
|
-
command: pnpm run verify:spa-shell
|
|
195
|
-
max_attempts: '2'
|
|
196
|
-
|
|
197
|
-
dependabot-auto-merge:
|
|
198
|
-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.state == 'open' && !github.event.repository.fork }}
|
|
199
|
-
name: Auto-Merge Dependabot PR
|
|
200
|
-
needs:
|
|
201
|
-
- checks
|
|
202
|
-
- unit-tests
|
|
203
|
-
- web-tests
|
|
204
|
-
- integration-tests
|
|
205
|
-
- build
|
|
206
|
-
- spa-shell
|
|
14
|
+
worker-ci:
|
|
207
15
|
permissions:
|
|
208
16
|
contents: write
|
|
209
17
|
pull-requests: write
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
steps:
|
|
213
|
-
- name: Checkout Repository
|
|
214
|
-
uses: actions/checkout@v6
|
|
215
|
-
|
|
216
|
-
# Auto-merge only after every gate above is green, which is what makes it
|
|
217
|
-
# safe: a dependency bump that breaks the suite waits for a human instead of
|
|
218
|
-
# merging itself.
|
|
219
|
-
- name: Enable Auto-Merge
|
|
220
|
-
uses: ./.github/actions/retry-step
|
|
221
|
-
with:
|
|
222
|
-
command: gh pr merge --auto --merge "$PR_URL"
|
|
223
|
-
max_attempts: '5'
|
|
224
|
-
env:
|
|
225
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
226
|
-
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
227
|
-
|
|
228
|
-
dispatch-upstream-sync-deployment:
|
|
229
|
-
if: ${{ github.event_name == 'repository_dispatch' && github.event.action == 'Upstream Sync Integration' }}
|
|
230
|
-
name: Dispatch Upstream Sync Deployment
|
|
231
|
-
needs:
|
|
232
|
-
- checks
|
|
233
|
-
- unit-tests
|
|
234
|
-
- web-tests
|
|
235
|
-
- integration-tests
|
|
236
|
-
- build
|
|
237
|
-
- spa-shell
|
|
238
|
-
permissions:
|
|
239
|
-
contents: write
|
|
240
|
-
runs-on: ubuntu-latest
|
|
241
|
-
|
|
242
|
-
steps:
|
|
243
|
-
- name: Checkout Repository
|
|
244
|
-
uses: actions/checkout@v6
|
|
245
|
-
|
|
246
|
-
# The second half of the upstream-sync contract: a fork's sync runs CI, and
|
|
247
|
-
# CI — not the sync workflow — is what authorises the deploy.
|
|
248
|
-
- name: Dispatch Deployment
|
|
249
|
-
uses: ./.github/actions/retry-step
|
|
250
|
-
with:
|
|
251
|
-
command: >
|
|
252
|
-
printf '{"event_type":"Upstream Sync Deployment","client_payload":{"branch":"%s","sha":"%s"}}\n'
|
|
253
|
-
"$PAYLOAD_BRANCH" "$PAYLOAD_SHA"
|
|
254
|
-
| gh api repos/${{ github.repository }}/dispatches --method POST --input -
|
|
255
|
-
max_attempts: '2'
|
|
256
|
-
env:
|
|
257
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
258
|
-
PAYLOAD_BRANCH: ${{ github.event.client_payload.branch || 'main' }}
|
|
259
|
-
PAYLOAD_SHA: ${{ github.event.client_payload.sha || github.sha }}
|
|
18
|
+
uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/worker-ci.yml@v1
|
|
19
|
+
secrets: inherit
|
|
@@ -1,38 +1,15 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# The stamp is the family's cache-buster: the CD workflow reads it, and the
|
|
4
|
-
# backup workflows use it in branch names. Forked repos skip the schedule
|
|
5
|
-
# (`if: !github.event.repository.fork`) because a fork must not race its
|
|
6
|
-
# upstream's push.
|
|
7
|
-
|
|
1
|
+
# A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/version-update.yml (tag v1).
|
|
2
|
+
# Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
|
|
8
3
|
name: Scheduled Version Update
|
|
9
4
|
|
|
10
5
|
on:
|
|
11
6
|
schedule:
|
|
12
7
|
- cron: '0 0 1,15 * *'
|
|
13
|
-
|
|
14
|
-
permissions:
|
|
15
|
-
contents: write
|
|
8
|
+
workflow_dispatch:
|
|
16
9
|
|
|
17
10
|
jobs:
|
|
18
|
-
update
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- name: Checkout Repository
|
|
24
|
-
uses: actions/checkout@v6
|
|
25
|
-
with:
|
|
26
|
-
persist-credentials: true
|
|
27
|
-
|
|
28
|
-
- name: Write Current Unix Timestamp
|
|
29
|
-
run: date +%s > .github/.version
|
|
30
|
-
|
|
31
|
-
- name: Commit and Push
|
|
32
|
-
run: |
|
|
33
|
-
git config user.name "github-actions[bot]"
|
|
34
|
-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
35
|
-
|
|
36
|
-
git add .github/.version
|
|
37
|
-
git diff --staged --quiet || git commit -m "chore: update .version stamp"
|
|
38
|
-
git push
|
|
11
|
+
version-update:
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/version-update.yml@v1
|
|
15
|
+
secrets: inherit
|
|
@@ -1,56 +1,15 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# Converged from eight repos (all but Records-Provider and CalDAV-Bridge ship this
|
|
4
|
-
# file, and the two that differ do so only in the upstream repository name).
|
|
5
|
-
#
|
|
6
|
-
# The contract has two sides and they change in the same commit: this workflow
|
|
7
|
-
# publishes `Upstream Sync Integration`, and continuous-integration.yml listens for
|
|
8
|
-
# it. The event is named `Upstream Sync Integration` rather than `Upstream Sync`
|
|
9
|
-
# precisely so it cannot be confused with the `Upstream Sync Deployment` event the
|
|
10
|
-
# deploy workflow listens for — one sync, two dispatches, and the name is what keeps
|
|
11
|
-
# a reader from wiring the wrong one.
|
|
12
|
-
|
|
1
|
+
# A thin caller: the pipeline lives in Rexezuge-CloudflareWorkers/SDK/.github/workflows/upstream-sync.yml (tag v1).
|
|
2
|
+
# Jobs switch on .rexezuge.jsonc features; change behaviour there or in the SDK, not here.
|
|
13
3
|
name: Upstream Sync
|
|
14
4
|
|
|
15
5
|
on:
|
|
16
6
|
schedule:
|
|
17
|
-
|
|
18
|
-
# workflows that share a minute with high-traffic crons.
|
|
19
|
-
- cron: '0 2 * * 1'
|
|
7
|
+
- cron: '17 2 * * 1'
|
|
20
8
|
workflow_dispatch:
|
|
21
9
|
|
|
22
|
-
permissions:
|
|
23
|
-
contents: write
|
|
24
|
-
|
|
25
10
|
jobs:
|
|
26
|
-
sync:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
steps:
|
|
32
|
-
- name: Checkout Repository
|
|
33
|
-
uses: actions/checkout@v6
|
|
34
|
-
|
|
35
|
-
# Pinned by commit rather than a tag: this action writes a config file and
|
|
36
|
-
# fetches a binary onto the runner, so a moved tag is a supply-chain change
|
|
37
|
-
# arriving through a version bump nobody reviewed.
|
|
38
|
-
- name: Sync Changes
|
|
39
|
-
id: sync
|
|
40
|
-
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
|
|
41
|
-
with:
|
|
42
|
-
# PLACEHOLDER: the upstream repository this one forks, as owner/name.
|
|
43
|
-
upstream_sync_repo: REPLACE_ME_ORG/REPLACE_ME_REPO
|
|
44
|
-
upstream_sync_branch: main
|
|
45
|
-
target_sync_branch: main
|
|
46
|
-
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
47
|
-
test_mode: false
|
|
48
|
-
|
|
49
|
-
- name: Trigger Continuous Integration
|
|
50
|
-
if: steps.sync.outputs.has_new_commits == 'true'
|
|
51
|
-
uses: ./.github/actions/retry-step
|
|
52
|
-
with:
|
|
53
|
-
command: gh api repos/${{ github.repository }}/dispatches --method POST -f event_type='Upstream Sync Integration'
|
|
54
|
-
max_attempts: '2'
|
|
55
|
-
env:
|
|
56
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
11
|
+
upstream-sync:
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
uses: Rexezuge-CloudflareWorkers/SDK/.github/workflows/upstream-sync.yml@v1
|
|
15
|
+
secrets: inherit
|
package/src/manifest-validate.ts
CHANGED
|
@@ -56,10 +56,28 @@ class Check {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const BINDING_RE = /^[A-Z][A-Z0-9_]*$/;
|
|
60
|
+
|
|
61
|
+
function checkKv(c: Check, value: unknown): void {
|
|
62
|
+
const kv = c.obj('features.kv', value);
|
|
63
|
+
if (!kv) return;
|
|
64
|
+
c.keys('features.kv', kv, ['bindings', 'namespaceNames']);
|
|
65
|
+
const bindings = c.strings('features.kv.bindings', kv.bindings) ? kv.bindings : [];
|
|
66
|
+
for (const binding of bindings) c.str('features.kv.bindings', binding, BINDING_RE, 'an UPPER_SNAKE binding name');
|
|
67
|
+
if (kv.namespaceNames === undefined) return;
|
|
68
|
+
const names = c.obj('features.kv.namespaceNames', kv.namespaceNames);
|
|
69
|
+
if (!names) return;
|
|
70
|
+
for (const [binding, name] of Object.entries(names)) {
|
|
71
|
+
const at = `features.kv.namespaceNames.${binding}`;
|
|
72
|
+
if (!bindings.includes(binding)) c.fail(at, 'is not listed in features.kv.bindings');
|
|
73
|
+
c.str(at, name);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
function checkFeatures(c: Check, value: unknown): void {
|
|
60
78
|
const features = c.obj('features', value);
|
|
61
79
|
if (!features) return;
|
|
62
|
-
c.keys('features', features, ['d1', 'web', 'background', 'backupD1', 'durableObjects', 'queues', 'workflows', 'email', 'android']);
|
|
80
|
+
c.keys('features', features, ['d1', 'kv', 'web', 'background', 'backupD1', 'durableObjects', 'queues', 'workflows', 'email', 'android']);
|
|
63
81
|
if (features.d1 !== undefined) {
|
|
64
82
|
const d1 = c.obj('features.d1', features.d1);
|
|
65
83
|
if (d1) {
|
|
@@ -69,12 +87,23 @@ function checkFeatures(c: Check, value: unknown): void {
|
|
|
69
87
|
if (d1.migrationsDir !== undefined) c.str('features.d1.migrationsDir', d1.migrationsDir);
|
|
70
88
|
}
|
|
71
89
|
}
|
|
90
|
+
if (features.kv !== undefined) checkKv(c, features.kv);
|
|
72
91
|
if (features.web !== undefined) {
|
|
73
92
|
const web = c.obj('features.web', features.web);
|
|
74
93
|
if (web) {
|
|
75
|
-
c.keys('features.web', web, ['pages', 'spaShell']);
|
|
94
|
+
c.keys('features.web', web, ['pages', 'spaShell', 'buildScript', 'pagesProject']);
|
|
76
95
|
c.bool('features.web.pages', web.pages);
|
|
77
96
|
c.bool('features.web.spaShell', web.spaShell);
|
|
97
|
+
if (web.buildScript !== undefined)
|
|
98
|
+
c.str('features.web.buildScript', web.buildScript, /^[\w:.-]+$/, 'a root package.json script name');
|
|
99
|
+
if (web.pagesProject !== undefined) {
|
|
100
|
+
c.str(
|
|
101
|
+
'features.web.pagesProject',
|
|
102
|
+
web.pagesProject,
|
|
103
|
+
/^[a-z0-9][a-z0-9-]{0,57}$/,
|
|
104
|
+
'lower-case letters, digits and hyphens, at most 58',
|
|
105
|
+
);
|
|
106
|
+
}
|
|
78
107
|
}
|
|
79
108
|
}
|
|
80
109
|
for (const flag of ['background', 'backupD1', 'email', 'android'] as const) {
|
package/src/manifest.test.ts
CHANGED
|
@@ -131,6 +131,28 @@ describe('validateManifest', () => {
|
|
|
131
131
|
expect(errorsOf({ ...MINIMAL, extensions: [] })).toEqual(['extensions: must be an object']);
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
+
it('validates features.kv: UPPER_SNAKE bindings, namespace names only for declared bindings', () => {
|
|
135
|
+
expect(errorsOf({ ...MINIMAL, features: { kv: { bindings: ['CACHE'], namespaceNames: { CACHE: 'old-cache' } } } })).toEqual([]);
|
|
136
|
+
expect(errorsOf({ ...MINIMAL, features: { kv: { bindings: [] } } })).toEqual([]);
|
|
137
|
+
const errors = errorsOf({ ...MINIMAL, features: { kv: { bindings: ['cache'], namespaceNames: { OTHER: 'x', CACHE: '' }, extra: 1 } } });
|
|
138
|
+
expect(errors).toEqual(
|
|
139
|
+
expect.arrayContaining([
|
|
140
|
+
expect.stringContaining('features.kv.bindings: "cache" is invalid'),
|
|
141
|
+
expect.stringContaining('features.kv.extra: unknown key'),
|
|
142
|
+
expect.stringContaining('features.kv.namespaceNames.OTHER: is not listed'),
|
|
143
|
+
]),
|
|
144
|
+
);
|
|
145
|
+
expect(errorsOf({ ...MINIMAL, features: { kv: { bindings: 'CACHE', namespaceNames: [] } } })).toHaveLength(2);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('validates the SPA build script and the Pages project name', () => {
|
|
149
|
+
const web = (fields: object): string[] => errorsOf({ ...MINIMAL, features: { web: { pages: true, spaShell: false, ...fields } } });
|
|
150
|
+
expect(web({ buildScript: 'build:web', pagesProject: 'my-app-web' })).toEqual([]);
|
|
151
|
+
expect(web({ buildScript: 'build web; rm -rf /' })).toEqual([expect.stringContaining('features.web.buildScript')]);
|
|
152
|
+
expect(web({ pagesProject: 'My_App' })).toEqual([expect.stringContaining('features.web.pagesProject')]);
|
|
153
|
+
expect(web({ pagesProject: '' })).toEqual([expect.stringContaining('features.web.pagesProject')]);
|
|
154
|
+
});
|
|
155
|
+
|
|
134
156
|
it('checks feature value types', () => {
|
|
135
157
|
const errors = errorsOf({
|
|
136
158
|
...MINIMAL,
|