Path filtered testing. Detect changes, and only run the relevant subprojects' tests.
This is an active project, and current state is only meant to show a proof of concept.
Demonstrates a repo-of-repos pattern or mono-repo pattern. Combines the advantages of a monorepo with those of a multirepo approach. Many companies have a monorepo-strategy for performing some action only if changed/added files.
For each sub-project (folder) run the CI in parallel ignoring unchanged sub-projects, and add tag with the COMMIT_ID if scripts succeed. It was inspired by the need to manage source for multiple linked but separate packages for dbt
A number of options were considered during planning. Utimately these approaches can be grouped into four unique ways to proceed
- Mono repo
- Roll my own package manager
- Git worktrees
- Git submodules
- Github Actions (selected option)
- Uncomplicated testing
- Single repo, and single programming language
- Multiple repos are more harder to setup, secure and maintain
- Must be able to limit builds to only those packages that changed
- Must be able to be able to version each subproject se
- If possible avoid git submodules or worktrees
- Good for projects requiring several different package managers, or when a few libraries are shared across lots of projects
- Powerful, but tricky to setup right, and not familiar to many developers
- Lots of pitfalls and complexity
- Single version of the truth
- All updates should be synchronize, to allow refactoring cross repos
- One commit to change multiple sub-projects
- Create a list of folders with files that changed.
- Uses Github's matrix workflow feature, however instead of a manual list I use the dynamically generated list
- Sub-project CI spawns from primary workflow trigger
- Run a common CI shell script for each, essentially any ci/build/test workflow to be executed
- If success, tag the commit
- Changes to one directory trigger ci for that folder only
- Changes to two folders do not trigger sub-project ci for the third
- Commits without changes do nothing
- Successful PR merge triggers a tagging
- Commit id will match master at that moment
- Version bump
- DBT example
- git subtree
- Turborepo
- Nx