ci: test pipeline and continuous deploy to Cloudflare - #9
Merged
Merged
Conversation
- Run typecheck and tests on every pull request and push to main - Deploy from main after verify: apply D1 migrations, then wrangler deploy - Point the DB binding at the real D1 database and set BOT_INFO as a var
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Links deploys to this repository. After this PR, every merge to
maingoes live on Cloudflare automatically, and every PR runs the tests.verifyjob (every PR and every push tomain):npm ci,typecheck,test.deployjob (push tomainonly, afterverifypasses): applies the D1 migrations with--remote, then runswrangler deploy.wrangler.jsonc: the singleDBbinding now points at the real D1 database, andBOT_INFOis set as a var (the publicgetMeresult).Review first:
.github/workflows/ci.yml, in particular the order of the deploy steps.Decisions
checkoutv7.0.1,setup-nodev7.0.0).wranglercomes frompackage-lock.jsoncontents: readonlyCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_ID. The runtime secrets (BOT_TOKEN,WEBHOOK_SECRET,PII_KEYRING) are set once withwrangler secret putand never pass through GitHubwrangler d1 createhad added a second binding (hack_bot_db) with"remote": true. It was removed: the code usesenv.DB, andremotewould have pointed local development at the production database.Test plan
npm test: 144/144 tests pass locally with the new confignpm run typecheck: cleanverifyjob passes on this PRdeployjob applies the migrations and publishes the Worker