Skip to content

Commit

Permalink
generate node 18 sandboxes separately
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Sep 15, 2023
1 parent 3d0d8a1 commit 8e2fcfe
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 16 deletions.
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,49 @@ jobs:
- report-workflow-on-failure
- store_test_results:
path: test-results
# We test a few sandboxes separately because
# they do not support Node 16
node-18-sandboxes:
executor:
class: large
name: sb_playwright
steps:
- git-shallow-clone/checkout_advanced:
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
name: Create Sandbox
command: |
yarn task --template angular-cli/prerelease --no-link --start-from=never --junit --task sandbox
- run:
name: Build Sandbox
command: |
yarn task --template angular-cli/prerelease --no-link --start-from=never --junit --task build
- run:
name: Chromatic
command: |
yarn task --template angular-cli/prerelease --no-link --start-from=never --junit --task chromatic
- run:
name: E2E Tests Production
command: |
yarn task --template angular-cli/prerelease --no-link --start-from=never --junit --task e2e-tests
- run:
name: E2E Tests Development
command: |
yarn task --template angular-cli/prerelease --no-link --start-from=never --junit --task e2e-tests-dev
- run:
name: Test Runner
command: |
yarn task --template angular-cli/prerelease --no-link --start-from=never --junit --task test-runner
- report-workflow-on-failure:
template: angular-cli/prerelease
- persist_to_workspace:
root: .
paths:
- sandbox
- store_test_results:
path: test-results
## new workflow
create-sandboxes:
parameters:
Expand Down Expand Up @@ -608,6 +651,9 @@ workflows:
- chromatic-internal-storybooks:
requires:
- build
- node-18-sandboxes:
requires:
- build
- create-sandboxes:
parallelism: 34
requires:
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/generate-sandboxes-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
node-version: 16
- uses: actions/checkout@v3
with:
# 👉 DON'T FORGET TO UNDO THE VALUE BACK TO `main` BEFORE YOU MERGE YOUR CHANGES!
ref: main
- name: Setup git user
run: |
Expand All @@ -42,8 +43,14 @@ jobs:
- name: Wait for registry
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry
- name: Generate Node 16 sandboxes
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease
working-directory: ./code
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Generate Node 18 sandboxes
run: yarn generate-sandboxes --local-registry --templates=angular-cli/prerelease
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=main
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Generate and push sandboxes (next)

# If you're thinking of

on:
schedule:
- cron: '2 2 */1 * *'
Expand All @@ -24,6 +26,7 @@ jobs:
node-version: 16
- uses: actions/checkout@v3
with:
# 👉 DON'T FORGET TO UNDO THE VALUE BACK TO `next` BEFORE YOU MERGE YOUR CHANGES!
ref: next
- name: Setup git user
run: |
Expand All @@ -42,8 +45,14 @@ jobs:
- name: Wait for registry
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry
- name: Generate Node 16 sandboxes
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease
working-directory: ./code
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Generate Node 18 sandboxes
run: yarn generate-sandboxes --local-registry --templates=angular-cli/prerelease
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=next
Expand Down
3 changes: 1 addition & 2 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const baseTemplates = {
'angular-cli/prerelease': {
name: 'Angular CLI Prerelease (Webpack | TypeScript)',
script:
'npx -p @angular/cli@next ng new angular-v16 --directory {{beforeDir}} --routing=true --minimal=true --style=scss --strict --skip-git --skip-install --package-manager=yarn',
'npx -p @angular/cli@next ng new angular-v17 --directory {{beforeDir}} --routing=true --minimal=true --style=scss --strict --skip-git --skip-install --package-manager=yarn',
expected: {
framework: '@storybook/angular',
renderer: '@storybook/angular',
Expand Down Expand Up @@ -586,7 +586,6 @@ export const merged: TemplateKey[] = [
];
export const daily: TemplateKey[] = [
...merged,
'angular-cli/prerelease',
'cra/default-js',
'react-vite/default-js',
'vue3-vite/default-js',
Expand Down
28 changes: 19 additions & 9 deletions scripts/sandbox/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,16 @@ const runGenerators = async (
};

export const options = createOptions({
template: {
type: 'string',
description: 'Which template would you like to create?',
templates: {
type: 'string[]',
description: 'Which templates would you like to create?',
values: Object.keys(sandboxTemplates),
},
exclude: {
type: 'string[]',
description: 'Space-delimited list of templates to exclude. Takes precedence over --templates',
promptType: false,
},
localRegistry: {
type: 'boolean',
description: 'Generate reproduction from local registry?',
Expand All @@ -220,7 +225,8 @@ export const options = createOptions({
});

export const generate = async ({
template,
templates,
exclude,
localRegistry,
debug,
}: OptionValues<typeof options>) => {
Expand All @@ -230,11 +236,11 @@ export const generate = async ({
...configuration,
}))
.filter(({ dirName }) => {
if (template) {
return dirName === template;
let include = Array.isArray(templates) ? templates.includes(dirName) : true;
if (Array.isArray(exclude) && include) {
include = !exclude.includes(dirName);
}

return true;
return include;
});

await runGenerators(generatorConfigs, localRegistry, debug);
Expand All @@ -243,7 +249,11 @@ export const generate = async ({
if (require.main === module) {
program
.description('Generate sandboxes from a set of possible templates')
.option('--template <template>', 'Create a single template')
.option('--templates [templates...]', 'Space-delimited list of templates to include')
.option(
'--exclude [templates...]',
'Space-delimited list of templates to exclude. Takes precedence over --templates'
)
.option('--debug', 'Print all the logs to the console')
.option('--local-registry', 'Use local registry', false)
.action((optionValues) => {
Expand Down
3 changes: 2 additions & 1 deletion scripts/tasks/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const generate: Task = {
const { generate: generateRepro } = await import('../sandbox/generate');

await generateRepro({
template: details.key,
templates: [details.key],
exclude: [],
localRegistry: true,
debug: options.debug,
});
Expand Down

0 comments on commit 8e2fcfe

Please sign in to comment.