From 3ff6c5e602ef87a2bc6f13b6492584f1c9aa3df8 Mon Sep 17 00:00:00 2001 From: Une Sofie Kinn Ekroll Date: Thu, 10 Oct 2024 13:44:15 +0200 Subject: [PATCH] ci: move Chromatic to separate workflow and also run it after PR is merged (#2599) This allows Chromatic to set the new baseline for main/next branches --- .github/workflows/test.yml | 12 +---------- .github/workflows/visual-tests.yml | 34 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/visual-tests.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aee56beeca..e44e784bfc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,7 @@ on: workflow_dispatch: pull_request: paths: + - .github/workflows/test.yml - 'packages/**' - 'apps/storybook/**' @@ -17,9 +18,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - # Necessary for Chromatic - fetch-depth: 0 - uses: ./.github/actions/gh-setup - name: Build run: yarn build @@ -67,11 +65,3 @@ jobs: check_name: Storybook Test Report check_annotations: true check_title_template: '{{FILE_NAME}} / {{TEST_NAME}}' - - - name: Run Chromatic (visual and interaction tests) - uses: chromaui/action@latest - with: - workingDir: apps/storybook - projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - exitZeroOnChanges: true - autoAcceptChanges: '{main,next}' diff --git a/.github/workflows/visual-tests.yml b/.github/workflows/visual-tests.yml new file mode 100644 index 0000000000..55738796b8 --- /dev/null +++ b/.github/workflows/visual-tests.yml @@ -0,0 +1,34 @@ +name: Visual tests +on: + workflow_dispatch: + pull_request: + paths: + - .github/workflows/visual-tests.yml + - 'packages/**' + - 'apps/storybook/**' + push: + branches: + - main + - next + +jobs: + checks: + name: Build & run visual/interaction tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # Necessary for Chromatic + fetch-depth: 0 + - uses: ./.github/actions/gh-setup + - name: Build + run: yarn build + - name: Build storybook + run: yarn build:storybook + - name: Run Chromatic (visual and interaction tests) + uses: chromaui/action@latest + with: + workingDir: apps/storybook + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + exitZeroOnChanges: true + autoAcceptChanges: '{main,next}'