Skip to content

Commit

Permalink
Revert "Sandboxes: Use Node 18 to generate Angular prerelease sandboxes"
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen authored Sep 7, 2023
1 parent d2fc6de commit e822f29
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 104 deletions.
55 changes: 5 additions & 50 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,48 +262,6 @@ jobs:
- report-workflow-on-failure
- store_test_results:
path: test-results
angular-prerelease-sandbox:
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 @@ -650,34 +608,31 @@ workflows:
- chromatic-internal-storybooks:
requires:
- build
- angular-prerelease-sandbox:
requires:
- build
- create-sandboxes:
parallelism: 34
parallelism: 35
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 34
parallelism: 35
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 31
parallelism: 32
requires:
- build-sandboxes
- e2e-production:
parallelism: 31
parallelism: 32
requires:
- build-sandboxes
- e2e-dev:
parallelism: 4
requires:
- create-sandboxes
- test-runner-production:
parallelism: 31
parallelism: 32
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Generate and push sandboxes
name: Generate and push sandboxes (main)

on:
schedule:
Expand All @@ -10,74 +10,48 @@ on:
# branches:
# - <your-branch-name>
# 2. change the "ref" value to <your-branch-name> in the actions/checkout step below.
# 3. 👉 DON'T FORGET TO UNDO THE VALUES BACK BEFORE YOU MERGE YOUR CHANGES!
# 3. 👉 DON'T FORGET TO UNDO THE VALUES BACK TO `main` BEFORE YOU MERGE YOUR CHANGES!

jobs:
generate:
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
CLEANUP_SANDBOX_NODE_MODULES: true
strategy:
fail-fast: false
matrix:
node_version:
- 16
- 18
branch:
- main
- next
include:
- node_version: 16
# space-delimited list of templates
exclude: 'angular-cli/prerelease'
- node_version: 18
# space-delimited list of templates
templates: 'angular-cli/prerelease'
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

node-version: 16
- uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}

ref: main
- name: Setup git user
run: |
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Install dependencies
run: node ./scripts/check-dependencies.js

- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link

- name: Publishing to local registry
run: yarn local-registry --publish
working-directory: ./code

- name: Running local registry
run: yarn local-registry --open &
working-directory: ./code

- name: Wait for registry
run: yarn wait-on http://localhost:6001
working-directory: ./code

- name: Generate
run: yarn generate-sandboxes --local-registry --templates ${{matrix.templates}} --exclude ${{matrix.exclude}}
run: yarn generate-sandboxes --local-registry
working-directory: ./code

- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=${{ matrix.branch }}
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=main
working-directory: ./code

- name: The job has failed
if: ${{ failure() || cancelled() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The generation of sandboxes with Node version **${{ matrix.node_version }}** in the **${{ matrix.branch }}** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'
args: 'The generation of sandboxes in the **main** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'
57 changes: 57 additions & 0 deletions .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Generate and push sandboxes (next)

on:
schedule:
- cron: '2 2 */1 * *'
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling, do the following:
# 1. Uncomment the lines below and add your branch.
# push:
# branches:
# - <your-branch-name>
# 2. change the "ref" value to <your-branch-name> in the actions/checkout step below.
# 3. 👉 DON'T FORGET TO UNDO THE VALUES BACK TO `next` BEFORE YOU MERGE YOUR CHANGES!

jobs:
generate:
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
CLEANUP_SANDBOX_NODE_MODULES: true
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
with:
ref: next
- name: Setup git user
run: |
git config --global user.name "Storybook Bot"
git config --global user.email "bot@storybook.js.org"
- name: Install dependencies
run: node ./scripts/check-dependencies.js
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publishing to local registry
run: yarn local-registry --publish
working-directory: ./code
- name: Running local registry
run: yarn local-registry --open &
working-directory: ./code
- name: Wait for registry
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry
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
working-directory: ./code
- name: The job has failed
if: ${{ failure() || cancelled() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The generation of sandboxes in the **next** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'
1 change: 1 addition & 0 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ 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: 9 additions & 19 deletions scripts/sandbox/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,11 @@ const runGenerators = async (
};

export const options = createOptions({
templates: {
type: 'string[]',
description: 'Which templates would you like to create?',
template: {
type: 'string',
description: 'Which template 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 @@ -225,8 +220,7 @@ export const options = createOptions({
});

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

return true;
});

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

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

0 comments on commit e822f29

Please sign in to comment.