Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/ci-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
e2e: ${{ fromJSON(steps.ci-filter.outputs.results).e2e == true }}
workflows: ${{ fromJSON(steps.ci-filter.outputs.results).workflows == true }}
db: ${{ fromJSON(steps.ci-filter.outputs.results).db == true }}
design_system: ${{ fromJSON(steps.ci-filter.outputs.results)['design-system'] == true }}
commit_sha: ${{ steps.commit-sha.outputs.sha }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -56,6 +57,11 @@ jobs:
packages/testing/playwright/**
packages/testing/containers/**
workflows: .github/**
design-system:
packages/frontend/@n8n/design-system/**
packages/frontend/@n8n/chat/**
packages/frontend/@n8n/storybook/**
.github/workflows/test-visual-chromatic.yml
db:
packages/cli/src/databases/**
packages/cli/src/modules/*/database/**
Expand Down Expand Up @@ -140,11 +146,20 @@ jobs:
ref: ${{ needs.install-and-build.outputs.commit_sha }}
secrets: inherit

chromatic:
name: Chromatic
needs: install-and-build
if: needs.install-and-build.outputs.design_system == 'true'
uses: ./.github/workflows/test-visual-chromatic.yml
with:
ref: ${{ needs.install-and-build.outputs.commit_sha }}
secrets: inherit

# This job is required by GitHub branch protection rules.
# PRs cannot be merged unless this job passes.
required-checks:
name: Required Checks
needs: [install-and-build, unit-test, typecheck, lint, e2e-tests, db-tests, security-checks]
needs: [install-and-build, unit-test, typecheck, lint, e2e-tests, db-tests, security-checks, chromatic]
if: always()
runs-on: ubuntu-slim
steps:
Expand Down
64 changes: 8 additions & 56 deletions .github/workflows/test-visual-chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
name: 'Test: Visual Chromatic'

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
pull_request_review:
types: [submitted]

concurrency:
group: chromatic-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
workflow_call:
inputs:
ref:
description: GitHub ref to check out.
required: false
type: string
default: ''

jobs:
changeset:
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- name: Determine changed files
uses: tomi/paths-filter-action@32c62f5ca100c1110406e3477d5b3ecef4666fec # v3.0.2
id: changed
if: github.event_name == 'pull_request_review'
with:
filters: |
design_system:
- 'packages/frontend/@n8n/design-system/**'
- 'packages/frontend/@n8n/chat/**'
- 'packages/frontend/@n8n/storybook/**'
- '.github/workflows/test-visual-chromatic.yml'
outputs:
has_changes: ${{ steps.changed.outputs.design_system || 'false' }}

chromatic:
needs: [changeset]
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
(
github.event_name == 'pull_request_review' &&
needs.changeset.outputs.has_changes == 'true' &&
github.event.review.state == 'approved' &&
!startsWith(github.event.pull_request.head.ref, 'release/') &&
!startsWith(github.event.pull_request.head.ref, 'release-pr/')
)
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
ref: ${{ inputs.ref }}

- name: Setup Node.js
uses: ./.github/actions/setup-nodejs
Expand All @@ -63,23 +35,3 @@ jobs:
onlyChanged: true
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
exitZeroOnChanges: false

- name: Success comment
if: always() && steps.chromatic_tests.outcome == 'success' && github.ref != 'refs/heads/master'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
edit-mode: replace
body: |
:white_check_mark: No visual regressions found.

- name: Fail comment
if: always() && steps.chromatic_tests.outcome == 'failure' && github.ref != 'refs/heads/master'
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
edit-mode: replace
body: |
[:warning: Visual regressions found](${{steps.chromatic_tests.outputs.url}}): ${{steps.chromatic_tests.outputs.changeCount}}