Skip to content

chore(storybook): support static color settings in testing grid #8202

chore(storybook): support static color settings in testing grid

chore(storybook): support static color settings in testing grid #8202

Workflow file for this run

name:
Verify
# -------------------------------------------------------------
# This workflow will build and verify pull requests. It will:
# - Build the base branch and the PR branch
# - Compare the compiled output of the two branches
# - Run visual regression tests on the PR branch
# - Publish the PR branch to Netlify for review
# -------------------------------------------------------------
on:
merge_group:
pull_request:
branches:
- main
- spectrum-two
# Allow us to run tests for PRs updating github actions
- chore-*ci*
- chore-*github-actions*
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
- auto_merge_enabled
permissions:
contents: read
pull-requests: write
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
# -------------------------------------------------------------
# Validate build for various environments
# -------------------------------------------------------------
verify_builds:
name: Verify
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
strategy:
fail-fast: false
matrix:
system:
- macos-latest
- ubuntu-latest
# - windows-latest # todo: debug token style-dictionary failures on windows
node-version:
- 20
uses: ./.github/workflows/build.yml
with:
system: ${{ matrix.system }}
node-version: ${{ matrix.node-version }}
secrets: inherit
# -------------------------------------------------------------
# Compare the compiled assets
# -------------------------------------------------------------
compare:
name: Compare
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
if: ${{ github.event.pull_request.draft != 'true' || contains(github.event.pull_request.labels.*.name, 'run_ci') }}
uses: ./.github/workflows/compare-results.yml
with:
base-sha: ${{ github.event.pull_request.base.ref }}
head-sha: ${{ github.event.pull_request.head.ref }}
secrets: inherit
# -------------------------------------------------------------
# Returns all changed pull request files.
# --------------------------------------------------------------
changed_files:
runs-on: ubuntu-latest
name: Capture changed-files
outputs:
styles_added_files: ${{ steps.changed-files.outputs.styles_added_files }}
styles_modified_files: ${{ steps.changed-files.outputs.styles_modified_files }}
eslint_added_files: ${{ steps.changed-files.outputs.eslint_added_files }}
eslint_modified_files: ${{ steps.changed-files.outputs.eslint_modified_files }}
plugins_modified_files: ${{ steps.changed-files.outputs.plugins_modified_files }}
plugins_added_files: ${{ steps.changed-files.outputs.plugins_added_files }}
permissions:
pull-requests: read
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files_yaml: |
styles:
- components/*/index.css
- components/*/themes/spectrum.css
- components/*/themes/express.css
eslint:
- components/*/stories/*.js
plugins:
- plugins/**/*
# -------------------------------------------------------------
# Lint pre-compiled assets for consistency
# -------------------------------------------------------------
lint:
name: Lint
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip_lint') == false }}
needs: [changed_files]
uses: ./.github/workflows/lint.yml
with:
styles_added_files: ${{ needs.changed_files.outputs.styles_added_files }}
styles_modified_files: ${{ needs.changed_files.outputs.styles_modified_files }}
eslint_added_files: ${{ needs.changed_files.outputs.eslint_added_files }}
eslint_modified_files: ${{ needs.changed_files.outputs.eslint_modified_files }}
secrets: inherit
# -------------------------------------------------------------
# Run the test suites for the plugins if there are changes
# to any of the plugin files
# -------------------------------------------------------------
plugin_tests:
name: Plugin tests
runs-on: ubuntu-latest
needs: [changed_files]
if: ${{ needs.changed_files.outputs.plugins_added_files != '' || needs.changed_files.outputs.plugins_modified_files != '' }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Use Node LTS version
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Enable Corepack
run: corepack enable
## --- YARN CACHE --- ##
- name: Check for cached dependencies
continue-on-error: true
id: cache-dependencies
uses: actions/cache@v4
with:
path: |
.cache/yarn
node_modules
key: ubuntu-latest-node20-${{ hashFiles('yarn.lock') }}
## --- INSTALL --- ##
# If statement isn't needed here b/c yarn will leverage the cache if it exists
- name: Install dependencies
shell: bash
run: yarn install --immutable
## --- Run plugins test suites --- ##
- name: Run plugin tests
run: yarn test:plugins
# -------------------------------------------------------------
# RUN VISUAL REGRESSION TESTS --- #
# Run VRT on:
# - ALL pull_request where:
# - PR has label 'run_vrt'
# - NOT in draft UNLESS labels includes 'run_ci'
# - PR is mergeable
# Note: mergeable implies ONLY that no merge conflicts with the base
# branch; nothing about other checks, like CI, passing.
# Note: 'skip_vrt' label is used to pass the tasks but not actually
# publish to Chromatic
# -------------------------------------------------------------
vrt:
name: Testing
if: contains(github.event.pull_request.labels.*.name, 'run_vrt') || ((github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run_ci')) && github.event.pull_request.mergeable == true)
uses: ./.github/workflows/vrt.yml
with:
skip: ${{ github.base_ref == 'spectrum-two' || contains(github.event.pull_request.labels.*.name, 'skip_vrt') }}
secrets: inherit
# -------------------------------------------------------------
# PUBLISH TO NETLIFY --- #
# Publish to netlify by leveraging the previous build and then building the site as well
# -------------------------------------------------------------
publish_site:
name: Publish
# The build step ensures we are leveraging the cache for the build
needs: [vrt]
# Note: the goal here is to allow vrt to be skipped but still require the build to succeed
if: ${{ always() }}
uses: ./.github/workflows/publish-site.yml
with:
deploy-message: ${{ github.event.pull_request.title }}
alias: pr-${{ github.event.number }}
# Only pass the storybook url if the vrt was successful
storybook-url: ${{ needs.vrt.outputs.storybook-url || '' }}
secrets: inherit