Skip to content
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

Separate chromatic workflows #6619

Merged
merged 9 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ar-chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: AR Chromatic 👓

on:
push:
branches: [main]
pull_request:

jobs:
chromatic:
name: Chromatic
runs-on: ubuntu-latest
steps:
- name: Checkout - On Pull Request
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request'}}
with:
fetch-depth: 0
# By default the pull_request event will run on a ephermeral merge commit which simulates a merge between the pull request
# and the target branch. This can cause issues with Chromatic https://www.chromatic.com/docs/turbosnap#github-pullrequest-triggers
# Hopefully by checking out the HEAD commit of a PR instead of the merge commit we can avoid some of those issues.
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout - On Push Event
uses: actions/checkout@v3
if: ${{ github.event_name == 'push'}}
with:
fetch-depth: 0

- uses: guardian/actions-setup-node@main
joecowton1 marked this conversation as resolved.
Show resolved Hide resolved

# Cache npm dependencies using https://github.com/bahmutov/npm-install
# Root yarn installs all workspaces (root, common, dotcom)
- uses: bahmutov/npm-install@v1

- name: Chromatic - Apps Rendering Non Dependency PR / main
uses: chromaui/action@v1
if: ${{ github.event_name == 'push' || (!contains(github.event.pull_request.labels.*.name, 'dependencies') && github.event.pull_request.user.login != 'dependabot')}}
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__APPS_RENDERING }}
token: ${{ secrets.GITHUB_TOKEN }}
untraced: '**/(package**.json|yarn.lock)'
exitOnceUploaded: true
onlyChanged: '!(main)' # only turbosnap on non-main branches
workingDir: apps-rendering

- name: Chromatic - Apps Rendering Dependency PR
uses: chromaui/action@v1
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event.pull_request.user.login == 'dependabot') }}
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__APPS_RENDERING }}
token: ${{ secrets.GITHUB_TOKEN }}
autoAcceptChanges: main
workingDir: apps-rendering
51 changes: 51 additions & 0 deletions .github/workflows/cr-chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Chromatic 👓
joecowton1 marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [main]
pull_request:

jobs:
chromatic:
name: Chromatic
runs-on: ubuntu-latest
steps:
- name: Checkout - On Pull Request
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request'}}
with:
fetch-depth: 0
# By default the pull_request event will run on a ephermeral merge commit which simulates a merge between the pull request
# and the target branch. This can cause issues with Chromatic https://www.chromatic.com/docs/turbosnap#github-pullrequest-triggers
# Hopefully by checking out the HEAD commit of a PR instead of the merge commit we can avoid some of those issues.
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout - On Push Event
uses: actions/checkout@v3
if: ${{ github.event_name == 'push'}}
with:
fetch-depth: 0

- uses: guardian/actions-setup-node@main
joecowton1 marked this conversation as resolved.
Show resolved Hide resolved
joecowton1 marked this conversation as resolved.
Show resolved Hide resolved

# Cache npm dependencies using https://github.com/bahmutov/npm-install
# Root yarn installs all workspaces (root, common, dotcom)
- uses: bahmutov/npm-install@v1

- name: Chromatic - Common Rendering Non Dependency PR / main
uses: chromaui/action@v1
if: ${{ github.event_name == 'push' || (!contains(github.event.pull_request.labels.*.name, 'dependencies') && github.event.pull_request.user.login != 'dependabot')}}
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__COMMON_RENDERING }}
token: ${{ secrets.GITHUB_TOKEN }}
workingDir: common-rendering
exitOnceUploaded: true
onlyChanged: '!(main)' # only turbosnap on non-main branches

- name: Chromatic - Common Rendering Dependency PR
uses: chromaui/action@v1
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event.pull_request.user.login == 'dependabot') }}
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__COMMON_RENDERING }}
token: ${{ secrets.GITHUB_TOKEN }}
autoAcceptChanges: main
workingDir: common-rendering
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Chromatic 👓
name: DCR Chromatic 👓

on:
push:
Expand Down Expand Up @@ -31,24 +31,6 @@ jobs:
# Root yarn installs all workspaces (root, common, dotcom)
- uses: bahmutov/npm-install@v1

- name: Chromatic - Apps Rendering
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__APPS_RENDERING }}
token: ${{ secrets.GITHUB_TOKEN }}
workingDir: apps-rendering
exitOnceUploaded: true
onlyChanged: '!(main)' # only turbosnap on non-main branches

- name: Chromatic - Common Rendering
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN__COMMON_RENDERING }}
token: ${{ secrets.GITHUB_TOKEN }}
workingDir: common-rendering
exitOnceUploaded: true
onlyChanged: '!(main)' # only turbosnap on non-main branches

- name: Chromatic - DCR Non Dependency PR / main
uses: chromaui/action@v1
if: ${{ github.event_name == 'push' || (!contains(github.event.pull_request.labels.*.name, 'dependencies') && github.event.pull_request.user.login != 'dependabot')}}
Expand Down