Skip to content
Jasper Nykänen edited this page Jul 10, 2024 · 10 revisions

Continuous integration

All pull requests run unit, integration and e2e tests. Currently end to end tests use a headless chromium to run Storybook tests. Static checks (linting and type validation) and aforementioned hard tests need to pass before merging to main is possible. The continuous integration may be bypassed by adding skip-ci label to a pull request, for example when updating README or other code that does not affect the code performance.

Continuous delivery

Junat.live deploys to production on pushes to the main branch. This branch is protected and can only be merged to, no direct pushes are allowed, even for maintainers. Preview deployments currently require vercel-deploy to be included in a commit message; this is to reduce deployments and make them explicit over implicit. Note however that when the pull request is first opened no preview deployments are made (whether vercel-deploy is defined or not).

Turborepo is used to dramatically improve build times as builds can be smartly cached. For example, packages in the packages/ directory are often served from cache. Tests can be cached as well.

The Vercel build condition looks like below:

if [[ "$VERCEL_ENV" == "production" || "$(git log -1 --pretty=%B)" == "vercel-deploy" ]]; then npx turbo-ignore site; fi

Exit code 1 means a new deployment should be issued, while 0 means the build can be ignored. turbo-ignore returns 0 if there are no changes and 1 if there are changes. Here's an example of a change that did not affect site's dependencies, meaning production build was skipped:

# ...
[17:42:13.449] Running "if [[ "$VERCEL_ENV" == "production" || "$(git log -1 --pretty=%B)" == "vercel-deploy" ]]; then npx turbo-ignore site; fi"
[17:42:17.333] npm WARN exec The following package was not found and will be installed: turbo-ignore@1.13.3
[17:42:18.543] ≫   Using Turborepo to determine if this project is affected by the commit...
[17:42:18.543] 
[17:42:18.569] ≫   Using "site" as workspace from arguments
[17:42:18.569] ≫   Using "build" as the task from the arguments
[17:42:18.583] ≫   Found previous deployment ("bd32e86b9fcd04349f44f3972e1b0e374a169500") for "site" on branch "main"
[17:42:18.584] ≫   Analyzing results of `npx turbo run "build" --filter="site...[bd32e86b9fcd04349f44f3972e1b0e374a169500]" --dry=json`
[17:42:26.008] ≫   This project and its dependencies are not affected
[17:42:26.009] ⏭ Ignoring the change
[17:42:26.029] The Deployment has been canceled as a result of running the command defined in the "Ignored Build Step" setting.
[17:42:29.839] 

Clone this wiki locally