Repository navigation
Scripts: Preserve static and dynamic imports of script modules #64505
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Storybook Build and Smoke Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - trunk | |
| # Cancels all previous workflow runs for pull requests that have not completed. | |
| concurrency: | |
| # The concurrency group contains the workflow name and the branch name for pull requests | |
| # or the commit hash for any other events. | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| # Disable permissions for all available scopes by default. | |
| # Any needed permissions should be configured at the job level. | |
| permissions: {} | |
| jobs: | |
| check: | |
| name: Storybook Build and Smoke Tests | |
| runs-on: 'ubuntu-24.04' | |
| permissions: | |
| contents: read | |
| if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | |
| persist-credentials: false | |
| - name: Setup Node.js and install dependencies | |
| uses: ./.github/setup-node | |
| - name: Build Storybook | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=8192 | |
| NODE_ENV: test | |
| run: npm run storybook:build | |
| - name: Validate Storybook sidebar | |
| run: node storybook/scripts/validate-sidebar.mjs | |
| - name: Validate manifest matches design-system-mcp contract | |
| run: node packages/design-system-mcp/scripts/validate-manifest.mjs | |
| - name: Validate manifest has no component or story errors | |
| run: node storybook/scripts/validate-manifest-errors.mts storybook/build/manifests/components.json | |
| # Regenerates the committed snapshot of components/props/descriptions | |
| # from the freshly built manifest. Fails if a component or prop is | |
| # newly missing a description (see the allowlist for known gaps). | |
| - name: Generate manifest snapshot | |
| run: npm run storybook:manifest-snapshot | |
| # Fails when the generated snapshot or pruned allowlist differs from | |
| # what's committed, surfacing documentation changes for sign-off. | |
| # This is similar to the "Check local changes" step of the static | |
| # checks workflow, but the other workflow does not build Storybook, | |
| # which is an expensive operation and only happens here. | |
| - name: Check manifest snapshot is up to date | |
| run: | | |
| if ! git diff --exit-code -- storybook/components-manifest.yml storybook/prop-description-allowlist.json; then | |
| echo "::error::The Storybook manifest snapshot is out of date. Review the diff above to confirm the change is expected, then run 'npm run storybook:build && npm run storybook:manifest-snapshot' locally and commit the updated storybook/components-manifest.yml and storybook/prop-description-allowlist.json." | |
| exit 1 | |
| fi | |
| - name: Build E2E Storybook | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=8192 | |
| NODE_ENV: test | |
| run: npm run storybook:e2e:build | |
| # The story tests only launch Chromium. | |
| - name: Install Playwright browsers | |
| uses: ./.github/setup-playwright | |
| with: | |
| workspace: '@wordpress/storybook' | |
| browsers: chromium | |
| # Vitest renders every story in Chromium through the Storybook | |
| # plugin. A render or play function error fails the job. | |
| - name: Run story tests | |
| run: npm run --workspace @wordpress/storybook test:smoke |