Boost Clone
This action clones the Boost source directory, attempting to get it from the cache first. Only the specified modules are cloned and cached.
This is usually the next step in your workflow after setting up a C++ compiler with Setup C++ or installing other dependencies with Install Packages.
Cloning boost is useful when one wants the always use the latest version of boost in a library or is writing a boost proposal. For other use cases, individual boost modules can be fetched with vcpkg in Install Packages or directly included in a package manager manifest.
Besides the explicitly specified list of modules, the action can also scan directories for boost dependencies to implicitly determine what modules should be cloned.
The union of the implicitly and explicitly specified modules is cloned. Caching is based only on these dependencies.
For a project with about 5 boost dependencies, caching saves about 4 minutes in the workflow. When there’s no cache, the scanning scripting saves us about 3 minutes.
Cache key details
The action derives its cache key from three independent SHA-1 fragments:
-
boostHash– the Boost super-project revision (covers pessimistic caching paths). -
modulesAndPatchesHash– hashes of explicitly requested modules plus optional patch repositories. -
configHash– the normalized configuration (branch, scan include/exclude lists, directories, ignore set, and the optimistic flag).
Only the fragments relevant to the chosen caching mode are included: optimistic caching uses modulesAndPatchesHash
plus configHash (and falls back to boostHash when no modules or patches are provided) because module hashes
already capture upstream changes; pessimistic caching always includes boostHash and only appends modulesAndPatchesHash
when patches are present to avoid redundant invalidations.
These fragments are concatenated with - separators (for example, boost-source-${modulesAndPatchesHash}-${configHash}),
so any change in source revision, requested modules/patches, or configuration forces a new cache key while still
avoiding needless cache churn.
Next steps
After cloning boost modules for your C++ project, the next step in your workflow should usually be CMake Workflow. If you are developing a Boost library, it is also usual for the next step to be the B2 Workflow.
Example
steps:
- name: Clone Boost.Variant2
uses: alandefreitas/cpp-actions/boost-clone@v1.9.2
id: boost-clone
with:
branch: master
modules: variant2
Input Parameters
Parameter |
Description |
Default |
|
The directory where Boost should be cloned. If no value is provided (default), the action will clone boost in a temporary directory. |
|
|
Branch of the super-project. Boost projects should usually set this to |
|
|
A list of patches to apply to the boost super-project. A patch is a module intended as a Boost library that is not yet part of the super-project. Each path will be cloned in the |
|
|
The boost submodules we need to clone. This field is optional. If not set, the action will scan the modules found in |
|
|
An independent directory we should scan for boost dependencies to clone. This option also accepts a multi-line string with multiple directories. This is usually a directory in the current project that requires boost libraries.
The Boost modules required in files from this directory will be added to the Only the subdirectories of this directory specified by |
|
|
Additional module subdirectory to scan. For instance, by setting it to By default, the action scans the ['include', 'src', 'source', 'test', 'tests', 'example', 'examples'] directories. |
|
|
Module subdirectory to exclude from scanning. Directories that match any of the values in this list will be ignored. By default, the action excludes the ['test', 'tests'] directories. |
|
|
List of modules that should be ignored in scan-modules. This if often useful to exclude the current project’s libraries from the scan. |
|
|
Cache the boost source directory for future builds. The cache key will include the boost hash, the modules hash and the patch hashes. When using the cache, the action will not rescan dependencies. This means that if a transitive
dependency is updated and |
|
|
If this option is For instance, if your library depends on Boost.Url and Boost.Url depends on Boost.Optional, then the cache will be reused for as long as Boost.Url hasn’t changed, even if Boost.Optional has changed. If you know about a change in a transitive dependency that affects your library, the current cache should be invalidated for the changes to take effect. In the If this option is set to The reason we have to use the main super-project hash in the cache key is that calculating a new hash only for transitive dependencies would require us to clone these transitive dependencies, which makes the cache useless. The default value is |
|
|
Trace commands executed by the workflow. |
|
|
Strategy for obtaining Boost source files. - The archive strategy is faster when many modules are needed, as it avoids per-module git overhead. However, it only works for release tags (e.g., boost-1.87.0), not for develop/master branches. |
|
|
Number of total modules (including transitive dependencies) above which the archive strategy is preferred over git clone. Only applies when clone-strategy is 'auto' and branch is a release tag. The default of 25 is an approximate crossover point based on typical network conditions. Archive download has a fixed overhead (~30s for the ~80MB CMake archive) but no per-module cost. Git clone has lower initial cost but adds ~0.5-1s per module for submodule initialization. For projects needing fewer modules, git is faster; for more modules, archive becomes more efficient. Adjust based on your network and typical module count. |
|