Skip to content

Commit

Permalink
Merge pull request #22161 from storybookjs/shilman/bench-task
Browse files Browse the repository at this point in the history
Build: Add benchmark task
  • Loading branch information
shilman authored Jun 23, 2023
2 parents 96b838b + 1107520 commit 162ba43
Show file tree
Hide file tree
Showing 20 changed files with 1,699 additions and 704 deletions.
139 changes: 38 additions & 101 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,88 +151,6 @@ jobs:
- code/renderers
- code/presets
- .verdaccio-cache
cra-bench:
executor:
class: large
name: sb_playwright
working_directory: /tmp/storybook
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Running local registry
command: |
cd code
yarn local-registry --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6001
- run:
name: set up cra repro, skip tests
command: |
cd code
SANDBOX_ROOT=../bench yarn task --task sandbox --template cra/default-ts --skip-template-stories --start-from=never --no-link
- run:
name: Run @storybook/bench on repro
command: |
cd bench/cra-default-ts
rm -rf node_modules
mkdir node_modules
../../code/node_modules/.bin/sb-bench 'yarn install' --label cra
- report-workflow-on-failure
- run:
name: prep artifacts
when: always
command: tar cvzf /tmp/cra-default-ts-bench.tar.gz bench/cra-default-ts
- store_artifacts:
path: /tmp/cra-default-ts-bench.tar.gz
destination: cra-default-ts-bench.tar.gz
react-vite-bench:
executor:
class: large
name: sb_playwright
working_directory: /tmp/storybook
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Running local registry
command: |
cd code
yarn local-registry --open
background: true
- run:
name: Wait for registry
command: |
cd code
yarn wait-on http://localhost:6001
- run:
name: set up react-vite repro, skip tests
command: |
cd code
SANDBOX_ROOT=../bench yarn task --task sandbox --template react-vite/default-ts --skip-template-stories --start-from=never --no-link
- run:
name: Run @storybook/bench on repro
command: |
cd bench/react-vite-default-ts
rm -rf node_modules
mkdir node_modules
../../code/node_modules/.bin/sb-bench 'yarn install' --label react-vite
- report-workflow-on-failure
- run:
name: prep artifacts
when: always
command: tar cvzf /tmp/react-vite-default-ts-bench.tar.gz bench/react-vite-default-ts
- store_artifacts:
path: /tmp/react-vite-default-ts-bench.tar.gz
destination: react-vite-default-ts-bench.tar.gz
lint:
executor:
class: large
Expand Down Expand Up @@ -414,6 +332,7 @@ jobs:
- persist_to_workspace:
root: .
paths:
- sandbox/*/bench/*.json
- sandbox/*/storybook-static
test-runner-production:
parameters:
Expand Down Expand Up @@ -525,6 +444,28 @@ jobs:
- store_artifacts: # this is where playwright puts more complex stuff
path: code/playwright-results/
destination: playwright
bench:
parameters:
parallelism:
type: integer
default: 2
executor:
class: medium
name: sb_playwright
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Running Bench
command: yarn task --task bench --template $(yarn get-template << pipeline.parameters.workflow >> bench) --no-link --start-from=never --junit
- run:
name: Uploading results
command: yarn upload-bench $(yarn get-template << pipeline.parameters.workflow >> bench)
- report-workflow-on-failure:
template: $(yarn get-template << pipeline.parameters.workflow >> bench)

workflows:
ci:
Expand Down Expand Up @@ -596,18 +537,12 @@ workflows:
- coverage:
requires:
- unit-tests
- cra-bench:
requires:
- build
- react-vite-bench:
requires:
- build
- create-sandboxes:
parallelism: 9
parallelism: 11
requires:
- build
- build-sandboxes:
parallelism: 9
parallelism: 11
requires:
- create-sandboxes
- chromatic-sandboxes:
Expand All @@ -625,6 +560,10 @@ workflows:
parallelism: 9
requires:
- build-sandboxes
- bench:
parallelism: 2
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
# - test-runner-dev:
# requires:
Expand Down Expand Up @@ -653,34 +592,32 @@ workflows:
- coverage:
requires:
- unit-tests
- cra-bench:
requires:
- build
- react-vite-bench:
requires:
- build
- create-sandboxes:
parallelism: 18
parallelism: 20
requires:
- build
- build-sandboxes:
parallelism: 18
parallelism: 20
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 18
parallelism: 20
requires:
- build-sandboxes
- e2e-production:
parallelism: 18
parallelism: 20
requires:
- build-sandboxes
- e2e-dev:
parallelism: 4
requires:
- create-sandboxes
- test-runner-production:
parallelism: 18
parallelism: 20
requires:
- build-sandboxes
- bench:
parallelism: 2
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ code/test-results/
code/playwright-results/
code/playwright-report/
code/playwright/.cache/
code/bench-results/
4 changes: 4 additions & 0 deletions code/builders/builder-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ const starter: StarterFunction = async function* starterGeneratorFn({
next();
}
});
router.use(`/index.html`, ({ path }, res) => {
console.log({ path });
res.status(200).send(html);
});

return {
bail,
Expand Down
Loading

0 comments on commit 162ba43

Please sign in to comment.