-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PORTALS-2652 - Integrate with Chromatic #241
Conversation
@@ -228,7 +229,8 @@ | |||
"build:esbuild": "rimraf dist/umd && node esbuild.config.mjs", | |||
"serve:docs": "pnpm storybook", | |||
"build:docs": "pnpm build:storybook", | |||
"build:storybook": "storybook build && touch storybook-static/.nojekyll", | |||
"build:build:gh-pages": "pnpm build-storybook && touch storybook-static/.nojekyll", | |||
"build-storybook": "storybook build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chromatic expects a build-storybook
command. They let us override with a custom command, but that was causing issues for me where the job would fail without a meaningful error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer build Storybook for each PR since that happens in the new deploy to chromatic job
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request_target: | ||
branches: | ||
- main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy to Chromatic when we push to main
(so we always have a deployment target for screenshot diffs) and on pull requests.
Use pull_request_target
so we can use the deploy secret. Because we use pull_request_target
, this job won't run until this is committed to main
(so you won't see the new Chromatic checks on this PR).
For an example, see nickgros#3 . There will be two new checks:
The Storybook Publish check links to a deployed Storybook. A PR submitter could link to a specific story in the Storybook if desired, like this.
The UI Tests check links to a list of all of the components where the base snapshot changed since the last deployment. Here's the list of changes from the example PR above. Snapshot diffs can be reviewed and approved. Here's a specific example of a snapshot diff for a component that changed in the example PR. I don't think we'll want to require UI approval to merge for now, but this could be a useful resource to validate a subset of changes.
The number of snapshots we can create per month is limited by the plan that we're on, so we shouldn't rely on this as a part of our SDLC until we understand the value, get a sense of our usage, and can determine if the cost is worth it (or if we should consider alternatives).