-
Notifications
You must be signed in to change notification settings - Fork 42
chore: implement chromatic #933
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
base: jakehwll/implement-storybook
Are you sure you want to change the base?
Changes from all commits
24f9bed
166e289
98987e0
027d8ab
71f4834
8a9836a
1bcc729
62208d8
f6ba089
ec29282
74c43a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,73 @@ jobs: | |
| run: ${{ runner.os == 'Linux' && 'xvfb-run -a' || '' }} pnpm test:integration --label "VS Code ${{ matrix.vscode-version }}" | ||
| shell: bash | ||
|
|
||
| # Reference guide: | ||
| # https://www.chromatic.com/docs/turbosnap-best-practices/#run-with-caution-when-using-the-pull_request-event | ||
| chromatic: | ||
| name: Chromatic | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| # 👇 Ensures Chromatic can read your full git history | ||
| fetch-depth: 0 | ||
| # 👇 Tells the checkout which commit hash to reference | ||
|
Comment on lines
+89
to
+91
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary comments IMO |
||
| ref: ${{ github.event.pull_request.head.ref }} | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup pnpm, Node.js, and dependencies | ||
| uses: ./.github/actions/setup | ||
|
|
||
| # This step is not meant for mainline because any detected changes to | ||
| # storybook snapshots will require manual approval/review in order for | ||
| # the check to pass. This is desired in PRs, but not in mainline. | ||
| - name: Publish to Chromatic (non-mainline) | ||
| if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder' | ||
| uses: chromaui/action@latest | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should pin this like all other actions for security and reproducibility |
||
| env: | ||
| NODE_OPTIONS: "--max_old_space_size=4096" | ||
| STORYBOOK: true | ||
| with: | ||
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
| # Do a fast, testing build for change previews | ||
| buildScriptName: "storybook:ci" | ||
| exitOnceUploaded: true | ||
| # This will prevent CI from failing when Chromatic detects visual changes | ||
| exitZeroOnChanges: true | ||
| # Prevent excessive build runs on minor version changes | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Misleading comment (I'd say remove most of these inline ones) |
||
| skip: "@(renovate/**|dependabot/**)" | ||
| # Run TurboSnap to trace file dependencies to related stories | ||
| # and tell chromatic to only take snapshots of relevant stories | ||
| onlyChanged: true | ||
| # Avoid uploading single files, because that's very slow | ||
| zip: true | ||
|
|
||
| # This is a separate step for mainline only that auto accepts and changes | ||
| # instead of holding CI up. Since we squash/merge, this is defensive to | ||
| # avoid the same changeset from requiring review once squashed into | ||
| # main. Chromatic is supposed to be able to detect that we use squash | ||
| # commits, but it's good to be defensive in case, otherwise CI remains | ||
| # infinitely "in progress" in mainline unless we re-review each build. | ||
|
Comment on lines
+122
to
+127
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very verbose imo |
||
| - name: Publish to Chromatic (mainline) | ||
| if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder' | ||
| uses: chromaui/action@latest | ||
| env: | ||
| NODE_OPTIONS: "--max_old_space_size=4096" | ||
| STORYBOOK: true | ||
| with: | ||
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
| autoAcceptChanges: true | ||
| # This will prevent CI from failing when Chromatic detects visual changes | ||
| exitZeroOnChanges: true | ||
| # Do a full build with documentation for mainline builds | ||
| buildScriptName: "storybook:build" | ||
| # Run TurboSnap to trace file dependencies to related stories | ||
| # and tell chromatic to only take snapshots of relevant stories | ||
| onlyChanged: true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should drop this on mainline because |
||
| # Avoid uploading single files, because that's very slow | ||
| zip: true | ||
|
|
||
| package: | ||
| name: Package | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ catalog: | |
| "@vscode-elements/react-elements": ^2.4.0 | ||
| "@vscode/codicons": ^0.0.45 | ||
| babel-plugin-react-compiler: ^1.0.0 | ||
| chromatic: ^16.7.0 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: 16.8.0 is already out 😛 (also could be inline in |
||
| coder: github:coder/coder#main | ||
| date-fns: ^4.1.0 | ||
| react: ^19.2.5 | ||
|
|
||
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.
I like the source but the inner comments feel overly verbose to me, we can remove or adapt this to our use-case and make them a bit slimmer!