Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b03757

Browse files
committed
chore(site): configure chromatic snapshot tests
Resolves:#444Summary:This commit installs and configures a GH action for chromatic. Chromaticis used for snapshot testing build-over-build.Details:* chore(site): install chromatic* chore(site): add chromatic package.json scriptSuggested by the docs for convenience so that we can run chromatic like:```consoleyarn run chromatic ...```* chore: gitignore storybook builds* ci: configure chromaticThis action configures chromatic to run in CI on pushes to all branches.By running this in CI, we get the following:- snapshot (build-over-build)- checks in our CIThe snapshots and build-over-build behavior are per branch; this way wecan work on a feature branch without worrying about changes being madeto mainline independently.
1 parentfe23dcd commit0b03757

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

‎.github/workflows/chromatic.yaml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name:"Chromatic"
2+
3+
on:push
4+
5+
jobs:
6+
chromatic-deployment:
7+
runs-on:ubuntu-latest
8+
9+
steps:
10+
-uses:actions/checkout@v3
11+
with:
12+
fetch-depth:0# <-- required by Chromatic for build-over-build history
13+
14+
-name:Install dependencies
15+
run:cd site && yarn
16+
17+
# This step is not meant for mainline because any detected changes to
18+
# storybook snapshots will require manual approval/review in order for
19+
# the check to pass. This is desired in PRs, but not in mainline.
20+
-name:Publish to Chromatic (non-mainline)
21+
if:github.ref != "refs/heads/main"
22+
uses:chromaui/action@v1
23+
with:
24+
buildScriptName:"storybook:build"
25+
projectToken:${{ secrets.CHROMATIC_PROJECT_TOKEN }}
26+
workingDir:"./site"
27+
28+
# This is a separate step for mainline only that auto accepts and changes
29+
# instead of holding CI up. Since we squash/merge, this is defensive to
30+
# avoid the same changeset from requiring review once squashed into
31+
# main.
32+
-name:Publish to Chromatic (mainline)
33+
if:github.ref == "refs/heads/main"
34+
uses:chromaui/action@v1
35+
with:
36+
autoAcceptChanges:true
37+
buildScriptName:"storybook:build"
38+
projectToken:${{ secrets.CHROMATIC_PROJECT_TOKEN }}
39+
workingDir:"./site"

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ site/test-results/
2525
site/yarn-error.log
2626
coverage/
2727
site/**/*.typegen.ts
28+
site/build-storybook.log
2829

2930
# Build
3031
dist/

‎site/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"postinstall":"yarn typegen",
88
"build":"NODE_ENV=production webpack build --config=webpack.prod.ts",
99
"build:analyze":"NODE_ENV=production webpack --profile --progress --json --config=webpack.prod.ts > out/stats.json && webpack-bundle-analyzer out/stats.json out",
10+
"chromatic":"chromatic",
1011
"dev":"webpack-dev-server --config=webpack.dev.ts",
1112
"format:check":"prettier --check '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
1213
"format:write":"prettier --write '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
@@ -59,6 +60,7 @@
5960
"@typescript-eslint/eslint-plugin":"5.17.0",
6061
"@typescript-eslint/parser":"5.17.0",
6162
"@xstate/cli":"0.1.5",
63+
"chromatic":"6.5.3",
6264
"copy-webpack-plugin":"10.2.4",
6365
"css-loader":"6.7.1",
6466
"css-minimizer-webpack-plugin":"3.4.1",

‎site/yarn.lock‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5484,6 +5484,11 @@ chownr@^2.0.0:
54845484
resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
54855485
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==
54865486

5487+
chromatic@6.5.3:
5488+
version "6.5.3"
5489+
resolved "https://registry.yarnpkg.com/chromatic/-/chromatic-6.5.3.tgz#dd96e6df6d2ed9d0c79277dc18b06a089080ce62"
5490+
integrity sha512-6Wy2lsNaojY5wTvobE3WV5VrQ5oP7B8kal6zWGrxu9g7Qbenb2cTcQ5SYgQY7tzT0Ed0zeHVyQm4TMmKz+XfXA==
5491+
54875492
chrome-trace-event@^1.0.2:
54885493
version "1.0.3"
54895494
resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp