Add CI workflow that type-checks and runs unit tests on every PR - #154
Conversation
|
Cherry-picked the |
Josue19-08
left a comment
There was a problem hiding this comment.
Solid CI setup for #145. Good call keeping tsc --noEmit as the build gate for the first two commits (since nest build was red on main from the pre-existing fastify/helmet mismatch) and then cherry-picking #146's fix onto this branch to restore a full npm run build once the type mismatch was resolved — that's exactly the right sequencing so this workflow lands green from day one instead of merging already-broken. The e2e-suite exclusion is well-justified and documented (real Supabase/Redis dependency, not available in this CI environment) rather than silently skipped. CI itself is green on this PR (test-and-build: SUCCESS).
Approving and merging. Since this branch already includes #146/#151's fix commit, I'll merge this first and then reconcile #151 separately.
|
Approved above — the workflow itself is correct and CI is green. However #152 merged into main in the meantime, so this branch (which already had #146/#151's fix cherry-picked) now has a merge conflict, likely in package.json/package-lock.json against #152's dependency cleanup. Please rebase onto main and resolve it. I'll merge once it's pushed and CI is green again. |
Every PR so far has been gated purely by manual diff review — nothing stops one with failing unit tests, a broken build, or a TypeScript compile error from being merged (a recent PR shipped a double-payment bug that only manual review caught). The build step runs `tsc --noEmit` rather than `nest build`/`npm run build`: the underlying @fastify/helmet v13 / fastify v4 mismatch (TrustUp-app#146) currently breaks type-checking on main regardless, so this step will go red until that fix lands, then can be swapped back to a full build. The e2e suite (`npm run test:e2e`) is not run here: most specs wire real feature modules rather than mocks, so they need a live Supabase project and, for a couple of BullMQ-backed jobs, a running Redis — neither of which is available in this environment. Contributors should keep running it locally against their own Supabase/Redis instance.
@fastify/helmet v13 targets Fastify v5's plugin API and is incompatible with the fastify@4.28 used in this project, breaking npm run start:dev and nest build for every contributor. Pin @fastify/helmet to ^11.1.1, whose fastify-plugin dependency (^4.2.1) matches Fastify v4, and dedupe the lockfile so a single fastify version resolves across the tree (the duplicate install was itself causing a nest build type error). Document the Fastify plugin version constraint and the Redis requirement in CONTRIBUTING.md so this doesn't silently regress.
The @fastify/helmet fix from TrustUp-app#146 is cherry-picked onto this branch (previous commit), so the type mismatch that forced a type-check-only build step no longer applies here. Restore the full `npm run build` step.
cc44ea1 to
88d61de
Compare
🔗 Related Issue
Closes #145
🔖 Title
Add a CI workflow that runs the test suite and build on every PR
📝 Description
.github/workflows/only containedleaderboard.yml— no workflow ranjestor a build/type-check on pull requests, so nothing stopped a PR with failing unit tests or a broken TypeScript build from being merged.Added
.github/workflows/ci.yml, triggered onpull_requestagainstmain, runningnpm ci, a type-check, and the unit suite.🔄 Changes Made
.github/workflows/ci.ymltriggered onpull_requestagainstmainnpm ciandnpx tsc --noEmitas the build/type gatenpx jest --runInBand(343 unit tests) and fail on any failure📸 Screenshots (if applicable)
N/A — CI configuration, no UI.
🗒️ Additional Notes
main.npm run build(nest build) fails today on the pre-existing@fastify/helmetv13 /fastifyv4 mismatch (Fix @fastify/helmet v13 / fastify v4 version mismatch breaking local dev and build #146, submitted alongside this PR).npx tsc --noEmithits the exact same type error, so this check will be red until Fix @fastify/helmet v13 / fastify v4 version mismatch breaking local dev and build #146 merges — at that point this step can go back to a fullnpm run build. I left it in rather than dropping the step entirely so the workflow's intended shape lands now and only needs a one-line swap once Fix @fastify/helmet v13 / fastify v4 version mismatch breaking local dev and build #146 is in.test/e2e/: aside fromhealth.e2e-spec.ts(which boots the fullAppModule), most of the others still instantiate real feature modules (not mocks) and hit the sameSupabaseService— they fail withsupabaseUrl is requiredwithout a live Supabase project, and a couple of the loan-lifecycle/job specs additionally need a running Redis for BullMQ. Neither is available in this CI environment, so per the issue's own fallback I've documented this in the workflow and leftnpm run test:e2eas a local-only step against a real Supabase/Redis instance.mainneeds branch protection settings, which I don't have access to configure as a contributor — a maintainer will need to add it once this merges.