Skip to content

CI: Split CircleCI config into multiple files #32025

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

Open
wants to merge 2 commits into
base: circleci-config-sort
Choose a base branch
from

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Jul 11, 2025

Closes #

What I did

Reorganized our CircleCI config by splitting it into separate files and then use config packing to generate the final config.yml.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Greptile Summary

Splits monolithic CircleCI configuration into multiple modular files using CircleCI's config packing feature, significantly improving maintainability without changing core functionality.

  • Split configuration into specialized files under .circleci/src/ for workflows, jobs, executors, commands, and parameters
  • Added comprehensive documentation in .circleci/README.md explaining configuration structure and local testing procedures
  • Preserved all existing CI functionality including build chains, test matrices, and parallelization settings
  • Added TODOs for temporarily disabled flaky jobs (bench-sandboxes, test-runner-dev)
  • Maintained workspace persistence and caching strategies across all jobs

@ghengeveld ghengeveld requested a review from ndelangen July 11, 2025 22:08
@ghengeveld ghengeveld self-assigned this Jul 11, 2025
@ghengeveld ghengeveld added build Internal-facing build tooling & test updates ci:normal labels Jul 11, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

39 files reviewed, 18 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +20 to +21
- store_test_results:
path: test-results
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Test results path should match working directory path for consistency. Change to test-storybooks/portable-stories-kitchen-sink/react/test-results

done
yarn bench-packages --base-branch << pipeline.parameters.ghBaseBranch >> --pull-request << pipeline.parameters.ghPrNumber >> --upload
# if there is a NOT a base branch OR NOT a PR number in parameters, just upload benchmarks for the branch
# this happens when runned directly on branches, like next or main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Typo: 'runned' should be 'run'

Suggested change
# this happens when runned directly on branches, like next or main
# this happens when run directly on branches, like next or main

Comment on lines +18 to +19
- store_test_results:
path: test-results
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Test results directory should be prefixed with a unique identifier like 'chromatic-' to avoid conflicts with other test jobs

name: Uploading results
command: yarn upload-bench $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench) << pipeline.parameters.ghPrNumber >> << pipeline.parameters.ghBaseBranch >>
- report-workflow-on-failure:
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Template parameter in report-workflow-on-failure should be quoted to handle paths with spaces.

- bench-packages:
requires:
- build
- check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The 'check' job has no dependencies specified, while most other jobs require 'build'. Consider whether this is intentional.

Comment on lines +16 to +18
cd ../../
mkdir features-1
cd features-1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Use mktemp or unique directory naming to prevent conflicts in parallel runs

Comment on lines 569 to 571
IN_STORYBOOK_SANDBOX: true
STORYBOOK_DISABLE_TELEMETRY: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider moving common environment variables like STORYBOOK_DISABLE_TELEMETRY and IN_STORYBOOK_SANDBOX into job parameters to avoid repetition

name: Storybook init from empty directory (NPM)
command: |
cd code
yarn local-registry --open &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Background process not properly handled - should add trap to cleanup local-registry process on exit

Comment on lines 753 to 766
command: |
cd code
yarn local-registry --open &
cd ../../
mkdir empty-<< parameters.template >>
cd empty-<< parameters.template >>
npm i -g pnpm
pnpm config set registry http://localhost:6001
pnpm dlx storybook init --yes --package-manager pnpm
pnpm run storybook --smoke-test
TEMPLATE=$(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner)
cd sandbox/$(yarn get-sandbox-dir --template $TEMPLATE) && yarn
name: Install sandbox dependencies
- start-event-collector
- run:
command: yarn task --task test-runner --template $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner) --no-link --start-from=never --junit
environment:
IN_STORYBOOK_SANDBOX: true
STORYBOOK_INIT_EMPTY_TYPE: << parameters.template >>
STORYBOOK_DISABLE_TELEMETRY: true
- when:
condition:
equal: ['react-vite-ts', << parameters.template >>]
steps:
STORYBOOK_TELEMETRY_DEBUG: 1
STORYBOOK_TELEMETRY_URL: http://localhost:6007/event-log
name: Running Test Runner
- run:
command: yarn --cwd scripts jiti ./event-log-checker.ts test-run $(yarn get-template --cadence << pipeline.parameters.workflow >> --task test-runner)
name: Check Telemetry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider extracting telemetry check commands into a reusable command since they're used in multiple jobs (test-runner, vitest-integration)

Copy link

nx-cloud bot commented Jul 11, 2025

View your CI Pipeline Execution ↗ for commit 7128fce

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 14s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-14 08:44:48 UTC

@valentinpalkovic valentinpalkovic added ci:daily Run the CI jobs that normally run in the daily job. and removed ci:normal labels Jul 14, 2025
@ghengeveld ghengeveld changed the base branch from next to circleci-config-sort July 14, 2025 08:18
@ghengeveld ghengeveld force-pushed the circleci-config-pack branch from 9f8ba24 to 7128fce Compare July 14, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Internal-facing build tooling & test updates ci:daily Run the CI jobs that normally run in the daily job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants