From e78abab220d409d4d30d5841599a5734a4c7886e Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Thu, 8 Aug 2024 14:31:55 +0200 Subject: [PATCH 1/5] update chromatic workflow using tj-actions/changed-files action --- .github/workflows/chromatic-deploy.yml | 49 +++++++++++++++++++++++ .github/workflows/chromatic.yml | 54 ++++++++++++-------------- 2 files changed, 74 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/chromatic-deploy.yml diff --git a/.github/workflows/chromatic-deploy.yml b/.github/workflows/chromatic-deploy.yml new file mode 100644 index 00000000000..fd2eadc2713 --- /dev/null +++ b/.github/workflows/chromatic-deploy.yml @@ -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 diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 3054c265b98..c867ce2fe34 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -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 - run: yarn - - name: Publish to Chromatic - # 👇 Adds Chromatic as a step in the workflow - uses: chromaui/action@v1 + - name: ⎔ Setup node + uses: actions/setup-node@v4 + with: + cache: npm + cache-dependency-path: ./package.json + node-version: 20 + - name: 📥 Install deps + run: npm install + - 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 From c4f1bff586847db5e010d2226e8a698106ac8208 Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Thu, 8 Aug 2024 15:16:02 +0200 Subject: [PATCH 2/5] skip build for testing purposes --- netlify.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netlify.toml b/netlify.toml index 68ed495e03a..e4a926e9a53 100644 --- a/netlify.toml +++ b/netlify.toml @@ -9,6 +9,9 @@ # Default build command. command = "yarn build" + # Skip build + ignore = "exit 0" + [build.environment] NEXT_FORCE_EDGE_IMAGES="true" From ad7f2ed62d7351d4ec4ec671030be452fc6cd2b2 Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Thu, 8 Aug 2024 15:22:26 +0200 Subject: [PATCH 3/5] add change --- src/@chakra-ui/components/Button.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@chakra-ui/components/Button.ts b/src/@chakra-ui/components/Button.ts index 1b51d328012..17d7ff517a5 100644 --- a/src/@chakra-ui/components/Button.ts +++ b/src/@chakra-ui/components/Button.ts @@ -12,7 +12,7 @@ const ICON_SELECTOR = "& svg" const baseStyle = defineStyle({ borderRadius: "base", - border: "1px", + border: "2px", color: "primary.base", fontWeight: "normal", lineHeight: "1.6", From 9cfdaa3e13308ed6df065626af381cc8372a940b Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Thu, 8 Aug 2024 15:27:52 +0200 Subject: [PATCH 4/5] use yarn --- .github/workflows/chromatic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index c867ce2fe34..33366802e7d 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -28,7 +28,7 @@ jobs: cache-dependency-path: ./package.json node-version: 20 - name: 📥 Install deps - run: npm install + run: yarn - name: Build Storybook run: npm run build-storybook - name: ⚡ Run chromatic From 69dfe2978f6d8033ea776242f28e2ac86f734220 Mon Sep 17 00:00:00 2001 From: Pablo Pettinari Date: Thu, 8 Aug 2024 15:35:20 +0200 Subject: [PATCH 5/5] add new change --- src/@chakra-ui/components/Button.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/@chakra-ui/components/Button.ts b/src/@chakra-ui/components/Button.ts index 17d7ff517a5..7e0011999de 100644 --- a/src/@chakra-ui/components/Button.ts +++ b/src/@chakra-ui/components/Button.ts @@ -12,7 +12,7 @@ const ICON_SELECTOR = "& svg" const baseStyle = defineStyle({ borderRadius: "base", - border: "2px", + border: "3px", color: "primary.base", fontWeight: "normal", lineHeight: "1.6",