-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
WIP Chromatic workflow update #13607
Draft
pettinarip
wants to merge
5
commits into
dev
Choose a base branch
from
chromatic-ci
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# .github/workflows/chromatic-deploy.yml | ||
name: Chromatic Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- staging | ||
- dev | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
jobs: | ||
changed-files: | ||
runs-on: ubuntu-latest | ||
name: changed-files | ||
outputs: | ||
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }} | ||
any_changed: ${{ steps.changed-files.outputs.any_changed }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: | | ||
src/components/**/* | ||
src/pages/**/* | ||
src/layouts/**/* | ||
src/@chakra-ui/**/* | ||
.storybook/**/* | ||
tailwind.config.ts | ||
src/styles/**/* | ||
|
||
chromatic: | ||
name: Run visual tests | ||
needs: [changed-files] | ||
if: ${{ needs.changed-files.outputs.any_changed == 'true' }} | ||
uses: ./.github/workflows/chromatic.yml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,41 @@ | ||
# .github/workflows/chromatic.yml | ||
|
||
# Workflow name | ||
name: Chromatic Publish and Testing | ||
|
||
# Event for the workflow | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- ready_for_review | ||
paths: | ||
# Only run on file changes in any of these paths | ||
- "src/components/**/*" | ||
- "src/pages/**/*" | ||
- "src/layouts/**/*" | ||
- "src/@chakra-ui/**/*" | ||
- ".storybook/**/*" | ||
- "tailwind.config.ts" | ||
- "src/styles/**/*" | ||
on: workflow_call | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-chromatic | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
# List of jobs | ||
jobs: | ||
chromatic-deployment: | ||
# Operating System | ||
chromatic: | ||
name: Chromatic | ||
runs-on: ubuntu-latest | ||
# Job steps | ||
steps: | ||
# 👇 Version 2 of the action | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # 👈 Required to retrieve git history | ||
- name: Install deps | ||
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm | ||
- name: ⎔ Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: npm | ||
cache-dependency-path: ./package.json | ||
node-version: 20 | ||
- name: 📥 Install deps | ||
run: yarn | ||
- name: Publish to Chromatic | ||
# 👇 Adds Chromatic as a step in the workflow | ||
uses: chromaui/action@v1 | ||
- name: Build Storybook | ||
run: npm run build-storybook | ||
- name: ⚡ Run chromatic | ||
uses: chromaui/action@latest | ||
# Options required for Chromatic's GitHub Action | ||
with: | ||
projectToken: fee8e66c9916 | ||
onlyChanged: true | ||
# 👇 Only fail if Storybook contains stories that error | ||
exitZeroOnChanges: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do you think the
build-storybook:chromatic
script currently in thepackage.json
is no longer needed?