-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Check Storybook build on CI for PRs #68466
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Check Storybook build | ||
|
||
on: pull_request | ||
|
||
# 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 | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} | ||
|
||
- name: Setup Node.js and install dependencies | ||
uses: ./.github/setup-node | ||
|
||
- name: Build Storybook | ||
run: npm run storybook:build | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 does it make sense to run the regular build command here though? We don't really need the built assets, right?
There's a
--smoke-test
feature we could use for this purpose:https://storybook.js.org/docs/api/cli-options#:~:text=my%2Dssl%2Dkey-,%2D%2Dsmoke%2Dtest,-Exit%20after%20successful
Furthermore, for such purposes, we should likely utilize
--ci
, which skips any interactive prompts:https://storybook.js.org/docs/api/cli-options#:~:text=dev%20%2D%2Dsmoke%2Dtest-,%2D%2Dci,-CI%20mode%20(skip
I'd suggest we introduce a new smoke test command and we use it here.
Its package.json script entry would look roughly like this (untested):
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this in the original PR but leaned toward
build
for a couple reasons:time
comparisons locally, there is no substantial wall-clock difference betweendev --ci --smoke-test
andbuild
, even though the total CPU time is clearly different (apparentlybuild
is better parallelized). The only significant difference was in the failing case, wheredev --ci --smoke-test
was actually 1 minute slower in wall-clock time due to some weird hanging between the error being logged and the process exiting.dev
requires a new test command (and possibly an additionalpre
command) in package.json.So all in all it seems to me like using
build
is simpler and good enough, but no strong opinion. Thoughts?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on that? Under what circumstances would it happen?
What's more important is that it's surprising that the smoke test is slower! In my tests against v7 (in another repo, though), that wasn't the case. If the regular build command is faster, I don't see a good reason not to go with it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing serious, I'm just thinking of code paths in the build process that involve
process.env.NODE_ENV
conditionals.