Skip to content

Chromatic

Chromatic #1149

Workflow file for this run

name: Chromatic
# Runs chromatic on:
# - every push to main (to create a chromatic baseline)
# - every pull request where there are changes in stories/ or packages/ and the PR is not in draft mode
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "stories/**"
- "packages/**"
- "website/**"
deployment_status:
permissions:
id-token: write
contents: read
jobs:
playwright:
name: Playwright Tests with Chromatic on ${{ github.event.deployment_status.environment }}
if: github.event.pull_request.draft == false && github.repository == 'FormidableLabs/victory' && github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.49.0-jammy
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: 18.x
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Install Test Dependencies
run: pnpm install
- name: Install Playwright
run: pnpm playwright install --with-deps
- name: Run Playwright Tests
run: npx playwright test
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-results
path: ./playwright-report
retention-days: 30
chromatic:
name: Run Chromatic
needs: playwright
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: 18.x
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install
- name: Download Playwright test results
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
- name: Run Chromatic
uses: chromaui/action@latest
with:
playwright: true
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybook:
name: Storybook Publish
if: github.event.pull_request.draft == false && github.repository == 'FormidableLabs/victory'
runs-on: ubuntu-latest
steps:
# requires all branches and tags to be fetched for chromatic
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: 18.x
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}