17
loading...
This website collects cookies to deliver better user experience
.circleci/config.yml
. For a monorepo a very minimal example may look something like this:version: 2.1
jobs:
validate-everything:
steps:
- checkout
- run: npm run general-validation
test-subpackage-a:
steps:
- checkout
- run: cd packages/package-a && npm run test
test-subpackage-b:
steps:
- checkout
- run: cd packages/package-b && npm run test
test-subpackage-c:
steps:
- checkout
- run: cd packages/package-c && npm run test
publish-subpackage-c:
steps:
- checkout
- run: cd packages/package-c && npm run publish
workflows:
validate-everything:
jobs:
- validate-everything
subpackage-a:
jobs:
- test-subpackage-a
subpackage-b:
jobs:
- test-subpackage-b
subpackage-c:
jobs:
- test-subpackage-c
- publish-subpackage-c
circletron
the .circle/config.yml
is always the same:version: 2.1
setup: true
orbs:
circletron: circletron/[email protected]
workflows:
trigger-jobs:
jobs:
- circletron/trigger-jobs
circle.yml
distributed within the project and combine them into a single configuration which will be issued via the continuation API. It will modify the configuration to ensure that jobs that are not necessary are no longer run, in a way that is friendly to CI branch protection rules.circle.yml
in the root of the project and where the CI for each subpackage lives in the directory for that subpackage.circle.yml
in the root of the project will host configuration not specific to any subpackage:version: 2.1
jobs:
validate-everything:
steps:
- checkout
- run: npm run general-validation
workflows:
validate-everything:
jobs:
- validate-everything
version
. It's also a good place to provide commands
that can be used in subpackage specific circle.yml
files.packages/package-a/circle.yml
:jobs:
test-subpackage-a:
steps:
- checkout
- run: cd packages/package-a && npm run test
workflows:
subpackage-a:
jobs:
- test-subpackage-a
packages/package-a
the jobs for this subpackage will be skipped. You will probably want to use branch protection rules to ensure that when the test-subpackage-a
job fails the PR will be blocked so omitting this job entirely would not be ideal. Omitted jobs remain in pending
state permanently, blocking the PR. circletron replaces unneeded jobs with a simple job using the busybox:stable
docker image that echoes "Job not required"
and issues a success error code.packages/subpackage-c
uses code from packages/subpackage-a
? In this case the jobs within this package should run when the code in subpackage-a
changes, even if the code in the subpackage itself doesn't change.packages/subpackage-c/circle.yml
shows how to add dependencies and create jobs which run unconditionally:dependencies:
- subpackage-a
jobs:
test-subpackage-c:
steps:
- checkout
- run: cd packages/package-b && npm run test
publish-subpackage-c:
conditional: false
steps:
- checkout
- run: cd packages/package-c && npm run publish
workflows:
subpackage-c:
jobs:
- test-subpackage-c
- publish-subpackage-a
test-subpackage-c
will only be run when changes to package-a
or package-c
are detected and publish-subpackage-c
will run on every push.main
, master
, develop
and any branch starting with release/
as a target branch. The latest commit from the branch commit history which belongs to one of these branches is considered to be the branch-point. For pushes to one of the branches above, all of the jobs are run. This can be changed via the configuration file at .circleci/circletron.yml
:targetBranches: ^(release/|main$|master$|develop$)
17