diff --git a/.circleci/config.yml b/.circleci/config.yml index 8eb90e39c6cd..617cdac42c28 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: @@ -650,9 +608,6 @@ workflows: - chromatic-internal-storybooks: requires: - build - - angular-prerelease-sandbox: - requires: - - build - create-sandboxes: parallelism: 34 requires: diff --git a/.github/workflows/generate-sandboxes.yml b/.github/workflows/generate-sandboxes-main.yml similarity index 62% rename from .github/workflows/generate-sandboxes.yml rename to .github/workflows/generate-sandboxes-main.yml index bfcd791de4d7..66cd1b800d37 100644 --- a/.github/workflows/generate-sandboxes.yml +++ b/.github/workflows/generate-sandboxes-main.yml @@ -1,4 +1,4 @@ -name: Generate and push sandboxes +name: Generate and push sandboxes (main) on: schedule: @@ -10,7 +10,7 @@ on: # branches: # - # 2. change the "ref" value to 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: @@ -18,66 +18,40 @@ jobs: 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 }})' diff --git a/.github/workflows/generate-sandboxes-next.yml b/.github/workflows/generate-sandboxes-next.yml new file mode 100644 index 000000000000..f22e7cb4a50b --- /dev/null +++ b/.github/workflows/generate-sandboxes-next.yml @@ -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: + # - + # 2. change the "ref" value to 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 }})' diff --git a/code/lib/cli/src/sandbox-templates.ts b/code/lib/cli/src/sandbox-templates.ts index df72ccccc051..b91296c5025f 100644 --- a/code/lib/cli/src/sandbox-templates.ts +++ b/code/lib/cli/src/sandbox-templates.ts @@ -296,6 +296,8 @@ const baseTemplates = { builder: '@storybook/builder-webpack5', }, skipTasks: ['e2e-tests-dev', 'bench'], + // TODO: Can be enabled once we re-revert this PR: https://github.com/storybookjs/storybook/pull/24033 + inDevelopment: true, }, 'angular-cli/default-ts': { name: 'Angular CLI Latest (Webpack | TypeScript)', @@ -584,6 +586,7 @@ export const merged: TemplateKey[] = [ ]; export const daily: TemplateKey[] = [ ...merged, + 'angular-cli/prerelease', 'cra/default-js', 'react-vite/default-js', 'vue3-vite/default-js', diff --git a/scripts/sandbox/generate.ts b/scripts/sandbox/generate.ts index 0e477b1a6220..b74ae5a28d03 100755 --- a/scripts/sandbox/generate.ts +++ b/scripts/sandbox/generate.ts @@ -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?', @@ -225,8 +220,7 @@ export const options = createOptions({ }); export const generate = async ({ - templates, - exclude, + template, localRegistry, debug, }: OptionValues) => { @@ -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); @@ -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