Skip to content

Commit

Permalink
Run vrt tests with all flags on
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan committed Oct 4, 2024
1 parent 702ba5c commit a9c532b
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 1 deletion.
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,83 @@ jobs:
if: ${{ needs.vrt-runner.result == 'failure' }}
run: exit 1

vrt-runner-all-flags:
runs-on: ubuntu-latest-8-cores
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: npm i -g npm@^10.5.1
- name: Install dependencies
run: npm ci
- name: Build storybook
run: npx storybook build
working-directory: packages/react
- name: Run storybook
id: storybook
working-directory: packages/react
run: |
export PRIMER_REACT_CSS_MODULES_TEAM=1
export PRIMER_REACT_CSS_MODULES_STAFF=1
export PRIMER_REACT_CSS_MODULES_GA=1
npx serve -l 6006 storybook-static &
pid=$!
echo "pid=$pid" >> $GITHUB_OUTPUT
sleep 5
- name: Run VRT
uses: docker://mcr.microsoft.com/playwright:v1.43.0-jammy
env:
STORYBOOK_URL: 'http://172.17.0.1:6006'
with:
args: npx playwright test --grep @vrt --shard="${{ matrix.shard }}/${{ strategy.job-total }}"
- name: Stop storybook
run: kill ${{ steps.storybook.outputs.pid }}
- name: Upload report
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: vrt-all-flags-${{ matrix.shard }}
path: blob-report
retention-days: 1

vrt-all-flags:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: vrt-runner-all-flags
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: npm i -g npm@^10.5.1
- name: install dependencies
run: npm ci
- name: download all reports
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: vrt-all-flags-*
merge-multiple: true
- name: merge all reports
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: vrt-all-flags
path: playwright-report
- name: check vrt-runner job status
if: ${{ needs.vrt-runner.result == 'failure' }}
run: exit 1

aat-runner:
runs-on: ubuntu-latest-8-cores
strategy:
Expand Down
15 changes: 14 additions & 1 deletion packages/react/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@ const primerThemes = [
{value: 'dark_high_contrast', left: '🌗', title: 'Dark High Contrast'},
]

const defaultFeatureFlags = new Map(DefaultFeatureFlags.flags)
const featureFlagEnvList = new Set([
'PRIMER_REACT_CSS_MODULES_TEAM',
'PRIMER_REACT_CSS_MODULES_STAFF',
'PRIMER_REACT_CSS_MODULES_GA',
])

for (const flag of featureFlagEnvList) {
if (process.env[flag] === '1') {
defaultFeatureFlags.set(flag, true)
}
}

export const globalTypes = {
colorScheme: {
name: 'Theme',
Expand All @@ -187,7 +200,7 @@ export const globalTypes = {
featureFlags: {
name: 'Feature flags',
description: 'Toggle feature flags',
defaultValue: Object.fromEntries(DefaultFeatureFlags.flags),
defaultValue: Object.fromEntries(defaultFeatureFlags),
},
}

Expand Down

0 comments on commit a9c532b

Please sign in to comment.