Hi!
We have 3 different projects in our github monorepo.
I just refactored our CircleCi configuration using path-filtering to trigger specific workflows depending on what files have been changed in a branch.
This part works great.
However, we are now trying to get github branch protection rule to prevent merges from PRs until tests have passed.
The UI for this feature allows you to select one or more CircleCI workflows to be required.
However we now how separate workflows per project in the monorepo. So cannot require a single workflow to succeed and neither can I put all 3 workflows.
What is the proper way to do this?
Below what I think are the relevant snippets:
From the “setup” config.yml:
workflows:
build-test-workflow:
when:
and:
- << pipeline.parameters.on_demand >>
- equal: ["nothing", << pipeline.parameters.project >>]
jobs:
- path-filtering/filter:
base-revision: develop
config-path: .circleci/main-config.yml
mapping: |
pepper-apis/.* action "build-test"
pepper-apis/pom.xml dss true
pepper-apis/((dss-.*)|(ddp-.*)|(pex-antlr)|(housekeeping)|(studybuilder-cli))/.* dss true
pepper-apis/((dsm-.*)|(ddp-.*))/.* dsm true
pepper-apis/docs/.* api-docs true
From the main-config.yml that get called:
workflows:
version: 2
# Run all tests on DSS project
dss-build-test-workflow:
when:
and:
- equal: ["build-test", << pipeline.parameters.action >>]
- << pipeline.parameters.dss >>
jobs:
- dss-compile-and-run-test-suite-job
- dss-parallel-compile-and-test-job:
parallelism: *test_parallelism
# Run tests on DSM
dsm-build-test-workflow:
when:
and:
- equal: ["build-test", << pipeline.parameters.action >>]
- << pipeline.parameters.dsm >>
jobs:
- dsm-compile-and-run-tests-job
# Build API docs (we never really store)
api-docs-build-test-workflow:
when:
and:
- or:
- equal: ["build-test", << pipeline.parameters.action >>]
- equal: ["build-test-store", << pipeline.parameters.action >>]
- << pipeline.parameters.api-docs >>
jobs:
- build-api-docs-job