@@ -56,12 +56,70 @@ master_only_filter: &master_only_filter
5656
5757orbs :
585859+ 5960
6061# ========================================
6162# COMMANDS
6263# ========================================
6364
6465commands :
66+ # Bundle installation with hoisting and overrides (Linux/macOS)
67+ install_bit_bundle :
68+ parameters :
69+ os :
70+ type : string
71+ default : " linux"
72+ cpu :
73+ type : string
74+ default : " x64"
75+ directory :
76+ type : string
77+ default : " bit-${BIT_VERSION}"
78+ steps :
79+ - run :
80+ name : install bit bundle for <<parameters.os>> <<parameters.cpu>>
81+ command : >
82+ cd <<parameters.directory>> &&
83+ pnpm init &&
84+ echo "node-linker=hoisted" >> .npmrc &&
85+ echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
86+ pnpm dlx @ialdama/jsonmod --key pnpm.overrides.uri-js --values npm:uri-js-replace &&
87+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.cross-spawn@7" --values "^7.0.5" &&
88+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.lodash@4" --values "4.17.21" &&
89+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.trim@0" --values "0.0.3" &&
90+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.@teambit/harmony" --values "0.4.7" &&
91+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.postcss@8" --values "^8.4.19" &&
92+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.ajv@6" --values "^6.12.6" &&
93+ pnpm add @teambit/bit --os=<<parameters.os>> --cpu=<<parameters.cpu>>
94+
95+ # Bundle installation for Windows (with Windows-specific configs)
96+ install_bit_bundle_windows :
97+ parameters :
98+ cpu :
99+ type : string
100+ default : " x64"
101+ directory :
102+ type : string
103+ default : " bit-${BIT_VERSION}"
104+ steps :
105+ - run :
106+ name : install bit bundle for Windows <<parameters.cpu>>
107+ command : >
108+ cd <<parameters.directory>> &&
109+ pnpm init &&
110+ echo "node-linker=hoisted" >> .npmrc &&
111+ echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
112+ echo "prefer-symlinked-executables=false" >> .npmrc &&
113+ pnpm dlx @ialdama/jsonmod --key pnpm.neverBuiltDependencies --values cpu-features --values ssh2 &&
114+ pnpm dlx @ialdama/jsonmod --key pnpm.overrides.uri-js --values npm:uri-js-replace &&
115+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.cross-spawn@7" --values "^7.0.5" &&
116+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.lodash@4" --values "4.17.21" &&
117+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.trim@0" --values "0.0.3" &&
118+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.@teambit/harmony" --values "0.4.7" &&
119+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.postcss@8" --values "^8.4.19" &&
120+ pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.ajv@6" --values "^6.12.6" &&
121+ pnpm add @teambit/bit --os=win32 --cpu=<<parameters.cpu>>
122+
65123 # Bit configuration
66124 bit_config :
67125 parameters :
@@ -85,6 +143,20 @@ commands:
85143 - run : ' <<parameters.bin_name>> config set hub_domain <<parameters.env>>.bit.dev'
86144 - run : ' <<parameters.bin_name>> config set package-manager.cache /home/circleci/package-manager-cache'
87145
146+ # Optimize node_modules size for BVM distributions
147+ optimize_node_modules :
148+ parameters :
149+ platform :
150+ default : ' '
151+ type : string
152+ steps :
153+ - run :
154+ name : optimize node_modules size<<# parameters.platform >> for <<parameters.platform>><</parameters.platform>>
155+ command : >
156+ cd bit-${BIT_VERSION} &&
157+ node ../bit/scripts/cleanup-node-modules.js ./node_modules --keep-teambit-maps &&
158+ echo "Node modules optimized successfully<<# parameters.platform >> for <<parameters.platform>><</parameters.platform>>"
159+
88160 # NPM setup
89161 bit_global_for_npm :
90162 steps :
@@ -296,7 +368,7 @@ commands:
296368 - restore_cache :
297369 key : bitsrc-registry10
298370 - restore_cache :
299- key : core-aspect-env-v0.0.72 -v1
371+ key : core-aspect-env-v0.0.80 -v1
300372 - run : npm view @teambit/bit version > ./version.txt
301373 - restore_cache :
302374 key : v3-linux-bvm-folder-{{ checksum "version.txt" }}
@@ -379,7 +451,7 @@ commands:
379451 - restore_cache :
380452 key : bitsrc-registry10
381453 - restore_cache :
382- key : core-aspect-env-v0.0.72 -v1
454+ key : core-aspect-env-v0.0.80 -v1
383455 - run : npm view @teambit/bit version > ./version.txt
384456 - restore_cache :
385457 key : v3-linux-bvm-folder-{{ checksum "version.txt" }}
@@ -485,7 +557,7 @@ jobs:
485557 name : bbit install
486558 command : cd bit && bbit install
487559 - save_cache :
488- key : core-aspect-env-v0.0.72 -v1
560+ key : core-aspect-env-v0.0.80 -v1
489561 paths :
490562 - /home/circleci/Library/Caches/Bit/capsules/caec9a107
491563 # - run: cd bit && bbit compile
@@ -540,11 +612,20 @@ jobs:
540612 - restore_cache :
541613 key : bitsrc-registry10
542614 - restore_cache :
543- key : core-aspect-env-v0.0.72 -v1
615+ key : core-aspect-env-v0.0.80 -v1
544616 - run :
545617 name : ' check circular dependencies'
546618 command : ' cd bit && ./scripts/circular-deps-check/ci-check.sh'
547619
620+ check_env_cache_sync :
621+ << : *defaults
622+ steps :
623+ - attach_workspace :
624+ at : ./
625+ - run :
626+ name : ' check env cache synchronization'
627+ command : ' cd bit && ./scripts/check-env-cache-sync.sh'
628+
548629 generate_and_check_types :
549630 << : *defaults
550631 steps :
@@ -584,11 +665,13 @@ jobs:
584665
585666 # ========== Bit CI Jobs ==========
586667 bit_pr :
668+ # uncomment in case this job fails with "Killed".
669+ # resource_class: 2xlarge
587670 resource_class : xlarge
588671 << : *defaults
589672 environment :
590673 # BIT_FEATURES: cloud-importer-v2
591- NODE_OPTIONS : --max-old-space-size=15000
674+ NODE_OPTIONS : --max-old-space-size=30000
592675 steps :
593676 - attach_workspace :
594677 at : ./
@@ -606,6 +689,8 @@ jobs:
606689 path : ~/Library/Caches/Bit/logs
607690
608691 bit_merge :
692+ # uncomment in case this job fails with "Killed".
693+ # resource_class: 2xlarge
609694 resource_class : xlarge
610695 << : *defaults
611696 environment :
@@ -624,8 +709,12 @@ jobs:
624709 name : If no component has changed, exit the job
625710 command : |
626711 if cd bit && bit diff | grep -q "there are no modified components to diff"; then
627- echo "No changes detected, halting job to prevent further workflow execution."
628- circleci-agent step halt
712+ if grep -q '"nextVersion": {' .bitmap; then
713+ echo "No changes detected, but soft-tagged components found. Continuing workflow."
714+ else
715+ echo "No changes detected, halting job to prevent further workflow execution."
716+ circleci-agent step halt
717+ fi
629718 fi
630719 - run : cd bit && npm run generate-cli-reference
631720 - run : cd bit && npm run generate-cli-reference-json
@@ -635,10 +724,10 @@ jobs:
635724 - run :
636725 name : ' bit ci merge'
637726 command : ' cd bit && bit ci merge --build --auto-merge-resolve manual ${BIT_CI_MERGE_EXTRA_FLAGS}'
638- # command: 'cd bit && bit ci merge --build --auto-merge-resolve manual --increment-by 3 ${BIT_CI_MERGE_EXTRA_FLAGS}'
727+ # command: 'cd bit && bit ci merge --build --auto-merge-resolve manual --increment-by 2 ${BIT_CI_MERGE_EXTRA_FLAGS}'
639728 no_output_timeout : ' 50m'
640729 environment :
641- NODE_OPTIONS : --max-old-space-size=32000
730+ NODE_OPTIONS : --max-old-space-size=30000
642731 - store_artifacts :
643732 path : ~/Library/Caches/Bit/logs
644733
@@ -671,6 +760,58 @@ jobs:
671760 - e2e_test_cmd :
672761 bit_bin : " --bin_bit=bbit"
673762
763+ # setup job: creates cleaned bit bundle and persists to workspace (runs once)
764+ setup_bundle_simulation :
765+ << : *defaults
766+ environment :
767+ PUPPETEER_SKIP_CHROMIUM_DOWNLOAD : " true"
768+ steps :
769+ - attach_workspace :
770+ at : ./
771+ - set_bit_cloud_registry
772+ - setup_bit_version
773+ - setup_pnpm
774+ - run : mkdir bit-bundle-test
775+ - install_bit_bundle :
776+ directory : " bit-bundle-test"
777+ - run :
778+ name : apply cleanup script to bundled installation with UI deps removal
779+ command : >
780+ cd bit-bundle-test &&
781+ node ../bit/scripts/cleanup-node-modules.js ./node_modules --remove-ui-deps --remove-esm
782+ - persist_to_workspace :
783+ root : .
784+ paths :
785+ - bit-bundle-test
786+
787+ # test job: uses cleaned bit bundle from workspace and runs e2e tests (parallelized)
788+ e2e_test_bundle_simulation :
789+ << : *defaults
790+ environment :
791+ BITSRC_ENV : stg
792+ BIT_FEATURES : cloud-importer-v2
793+ parallelism : 25
794+ steps :
795+ - attach_workspace :
796+ at : ./
797+ - restore_common_caches
798+ - run :
799+ name : setup cleaned bit binary
800+ command : >
801+ mkdir -p /home/circleci/.npm-global/bin &&
802+ cd bit-bundle-test &&
803+ BIT_BIN=$(find node_modules -name "bit" -type f -path "*/bin/*" | head -1) &&
804+ echo "Found bit binary at: $BIT_BIN" &&
805+ chmod +x $(pwd)/$BIT_BIN &&
806+ ln -sf $(pwd)/$BIT_BIN /home/circleci/.npm-global/bin/bit-cleaned &&
807+ chmod +x /home/circleci/.npm-global/bin/bit-cleaned &&
808+ echo 'export PATH=~/.npm-global/bin:$PATH' >> $BASH_ENV
809+ - run :
810+ name : verify cleaned binary works
811+ command : source $BASH_ENV && bit-cleaned --version
812+ - e2e_test_cmd :
813+ bit_bin : " --bin_bit=bit-cleaned"
814+
674815 # ========== Utility Jobs ==========
675816 harmony_deploy_approval_job :
676817 << : *defaults
@@ -689,19 +830,8 @@ jobs:
689830 - set_bit_cloud_registry
690831 - setup_bit_version
691832 - setup_pnpm
692- - run :
693- name : install bit for Linux x64
694- command : >
695- cd bit-${BIT_VERSION} &&
696- pnpm init &&
697- echo "node-linker=hoisted" >> .npmrc &&
698- echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
699- pnpm dlx @ialdama/jsonmod --key pnpm.overrides.uri-js --values npm:uri-js-replace &&
700- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.cross-spawn@7" --values "^7.0.5" &&
701- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.lodash@4" --values "4.17.21" &&
702- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.trim@0" --values "0.0.3" &&
703- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.@teambit/harmony" --values "0.4.7" &&
704- pnpm add @teambit/bit --os=linux --cpu=x64
833+ - install_bit_bundle
834+ - optimize_node_modules
705835 - run :
706836 name : copy lockfile
707837 command : mkdir lockfile && cp bit-${BIT_VERSION}/pnpm-lock.yaml lockfile
@@ -714,6 +844,8 @@ jobs:
714844 command : >
715845 cd bit-${BIT_VERSION} &&
716846 pnpm install --os=linux --cpu=arm64
847+ - optimize_node_modules :
848+ platform : arm64
717849 - compress_bit
718850 - run :
719851 name : move to linux-arm64 folder
@@ -742,19 +874,9 @@ jobs:
742874 - set_bit_cloud_registry
743875 - setup_bit_version
744876 - setup_pnpm
745- - run :
746- name : install bit for macOS x64
747- command : >
748- cd bit-${BIT_VERSION} &&
749- pnpm init &&
750- echo "node-linker=hoisted" >> .npmrc &&
751- echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
752- pnpm dlx @ialdama/jsonmod --key pnpm.overrides.uri-js --values npm:uri-js-replace &&
753- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.cross-spawn@7" --values "^7.0.5" &&
754- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.lodash@4" --values "4.17.21" &&
755- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.trim@0" --values "0.0.3" &&
756- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.@teambit/harmony" --values "0.4.7" &&
757- pnpm add @teambit/bit --os=darwin --cpu=x64
877+ - install_bit_bundle :
878+ os : " darwin"
879+ - optimize_node_modules
758880 - compress_bit
759881 - run :
760882 name : move to macos folder
@@ -764,6 +886,8 @@ jobs:
764886 command : >
765887 cd bit-${BIT_VERSION} &&
766888 pnpm install --os=darwin --cpu=arm64
889+ - optimize_node_modules :
890+ platform : arm64
767891 - compress_bit
768892 - run :
769893 name : move to macos-arm64 folder
@@ -789,21 +913,8 @@ jobs:
789913 - set_bit_cloud_registry
790914 - setup_bit_version
791915 - setup_pnpm
792- - run :
793- name : install bit for Windows x64
794- command : >
795- cd bit-${BIT_VERSION} &&
796- pnpm init &&
797- echo "node-linker=hoisted" >> .npmrc &&
798- echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
799- echo "prefer-symlinked-executables=false" >> .npmrc &&
800- pnpm dlx @ialdama/jsonmod --key pnpm.neverBuiltDependencies --values cpu-features --values ssh2 &&
801- pnpm dlx @ialdama/jsonmod --key pnpm.overrides.uri-js --values npm:uri-js-replace &&
802- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.cross-spawn@7" --values "^7.0.5" &&
803- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.lodash@4" --values "4.17.21" &&
804- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.trim@0" --values "0.0.3" &&
805- pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.@teambit/harmony" --values "0.4.7" &&
806- pnpm add @teambit/bit --os=win32 --cpu=x64
916+ - install_bit_bundle_windows
917+ - optimize_node_modules
807918 - compress_bit
808919 - run :
809920 name : move to windows folder
@@ -1075,6 +1186,9 @@ workflows:
10751186 - check_circular_dependencies :
10761187 requires :
10771188 - setup_harmony
1189+ - check_env_cache_sync :
1190+ requires :
1191+ - setup_harmony
10781192 - generate_and_check_types :
10791193 requires :
10801194 - setup_harmony
@@ -1085,6 +1199,18 @@ workflows:
10851199 - e2e_test :
10861200 requires :
10871201 - setup_harmony
1202+ - setup_bundle_simulation :
1203+ filters :
1204+ branches :
1205+ only : /^optimize-node-modules.*|^cleanup-script.*|.*cleanup.*script.*/
1206+ requires :
1207+ - setup_harmony
1208+ - e2e_test_bundle_simulation :
1209+ filters :
1210+ branches :
1211+ only : /^optimize-node-modules.*|^cleanup-script.*|.*cleanup.*script.*/
1212+ requires :
1213+ - setup_bundle_simulation
10881214 - bit_pr :
10891215 requires :
10901216 - setup_harmony
@@ -1098,6 +1224,22 @@ workflows:
10981224 branches :
10991225 only : master
11001226 serial-group : " bit-merge-operations"
1227+ post-steps :
1228+ - slack/notify :
1229+ event : fail
1230+ custom : |
1231+ {
1232+ "text": "🚨 MASTER BRANCH FAILURE 🚨",
1233+ "blocks": [
1234+ {
1235+ "type": "section",
1236+ "text": {
1237+ "type": "mrkdwn",
1238+ "text": "⚠️ *bit_merge failed on master branch*\nThis needs immediate attention!\n<${CIRCLE_BUILD_URL}|View Failed Build>"
1239+ }
1240+ }
1241+ ]
1242+ }
11011243
11021244 # Nightly workflow
11031245 nightly :
0 commit comments