Backends¶
Backends define how foga turns a workflow entry into commands. Each backend
belongs to a specific top-level section, such as build, test, docs, or
install, and accepts its own set of fields.
Every backend-backed workflow entry also accepts an optional launcher field.
launcher must be a non-empty command array such as ["uv", "run"] or
["pipx", "run"]. foga prepends that launcher to each generated backend
command for the configured entry.
Build backends¶
cmake¶
build.cpp.backend: cmake generates a configure step and one or more
cmake --build steps. Its fields mean:
source_dir: source tree passed tocmake -Sbuild_dir: build tree passed tocmake -Band reused forcmake --buildgenerator: optional generator name such asNinjalauncher: optional command prefix prepended to configure and build stepsconfigure_args: extra flags appended to the configure stepbuild_args: extra flags appended to the build steptargets: default C++ targets to build when the CLI does not override themenv: environment variables added to the generated commandshooks: pre/post commands run around the C++ workflow
Minimal example:
build:
cpp:
backend: cmake
source_dir: cpp
build_dir: build
meson¶
build.cpp.backend: meson generates a meson setup step and one or more
meson compile steps. Its fields mean:
source_dir: source tree passed tomeson setupbuild_dir: build tree passed tomeson setupand reused formeson compile -Clauncher: optional command prefix prepended to setup and compile stepssetup_args: extra flags appended to the setup stepcompile_args: extra flags appended to the compile steptargets: default C++ targets to compile when the CLI does not override themenv: environment variables added to the generated commandshooks: pre/post commands run around the C++ workflow
Minimal example:
build:
cpp:
backend: meson
source_dir: cpp
build_dir: build
python-build¶
build.python.backend: python-build runs python3 -m build with optional
extra args, plus optional env and hooks.
foga intentionally does not allow overriding the full build command for this
backend. Use args for extra flags.
Its fields mean:
launcher: optional command prefix prepended to the build commandargs: extra flags appended topython3 -m buildenv: environment variables added to the build commandhooks: pre/post commands run around the Python package build
Minimal example:
build:
python:
backend: python-build
args: ["--wheel"]
Test backends¶
ctest¶
This backend can configure and build C++ tests before running ctest. Its
fields mean:
build_dir: build tree used byctest --test-dir; this is requiredsource_dir: optional source tree; when present,fogaalso runs a CMake configure step before testinggenerator: optional generator name for the configure steplauncher: optional command prefix prepended to configure, build, and test stepsconfigure_args: extra flags appended to the configure stepbuild_args: extra flags appended to the C++ build steptarget: optional build target compiled before tests runargs: extra flags appended to the finalctestcommandenv: environment variables added to generated commandshooks: pre/post commands run around the C++ test workflow
Minimal example:
test:
runners:
cpp:
backend: ctest
build_dir: build
pytest¶
This backend runs pytest. Its fields mean:
path: test path passed topytest; this is required for thepytestbackendmarker: optionalpytest -mselectorlauncher: optional command prefix prepended to the runner commandargs: extra flags appended after the base pytest commandenv: environment variables added to the runner commandhooks: pre/post commands run around the runner
Minimal example:
test:
runners:
unit:
backend: pytest
path: tests
tox¶
This backend runs tox -e <env>. Its fields mean:
tox_env: environment name passed totox -e; this is required for thetoxbackendlauncher: optional command prefix prepended to the runner commandargs: extra flags appended aftertox -e <env>env: environment variables added to the runner commandhooks: pre/post commands run around the runner
Minimal example:
test:
runners:
py311:
backend: tox
tox_env: py311
Docs backends¶
doxygen¶
docs.targets.<name>.backend: doxygen runs doxygen. Its fields mean:
config_file: Doxygen config file passed todoxygen; this is requiredlauncher: optional command prefix prepended to the docs commandargs: extra flags appended after the config fileenv: environment variables added to the docs commandhooks: pre/post commands run around the docs workflow
Minimal example:
docs:
targets:
api:
backend: doxygen
config_file: Doxyfile
mkdocs¶
docs.targets.<name>.backend: mkdocs runs mkdocs build. Its fields mean:
config_file: MkDocs config file passed as--config-file; this is requiredbuild_dir: optional site output directory passed as--site-dirlauncher: optional command prefix prepended to the docs commandargs: extra flags appended after the base commandenv: environment variables added to the docs commandhooks: pre/post commands run around the docs workflow
Minimal example:
docs:
targets:
site:
backend: mkdocs
config_file: mkdocs.yml
sphinx¶
docs.targets.<name>.backend: sphinx runs sphinx-build. Its fields mean:
source_dir: source tree passed tosphinx-build; this is requiredbuild_dir: output tree passed tosphinx-build; this is requiredbuilder: optional Sphinx builder name such ashtmlordirhtmllauncher: optional command prefix prepended to the docs commandargs: extra flags appended after the positional argumentsenv: environment variables added to the docs commandhooks: pre/post commands run around the docs workflow
Minimal example:
docs:
targets:
site:
backend: sphinx
source_dir: docs
build_dir: docs/_build/html
Format backends¶
black¶
format.targets.<name>.backend: black runs black on the configured paths.
Its fields mean:
paths: literal paths or glob patterns resolved beforeblackruns; this is requiredlauncher: optional command prefix prepended to the formatter commandargs: extra flags appended before the pathsenv: environment variables added to the formatter commandhooks: pre/post commands run around the formatter
Minimal example:
format:
targets:
python-style:
backend: black
paths: ["src", "tests"]
clang-format¶
format.targets.<name>.backend: clang-format runs clang-format -i on the
configured paths. Its fields mean:
paths: literal paths or glob patterns resolved beforeclang-formatruns; this is requiredlauncher: optional command prefix prepended to the formatter commandargs: extra flags appended after-iand before the pathsenv: environment variables added to the formatter commandhooks: pre/post commands run around the formatter
Minimal example:
format:
targets:
cpp-style:
backend: clang-format
paths: ["src/**/*.cc", "include/**/*.h"]
ruff-format¶
format.targets.<name>.backend: ruff-format runs ruff format on the
configured paths. Its fields mean:
paths: literal paths or glob patterns resolved beforeruff formatruns; this is requiredlauncher: optional command prefix prepended to the formatter commandargs: extra flags appended before the pathsenv: environment variables added to the formatter commandhooks: pre/post commands run around the formatter
Minimal example:
format:
targets:
python-style:
backend: ruff-format
paths: ["src", "tests"]
Lint backends¶
clang-tidy¶
lint.targets.<name>.backend: clang-tidy runs clang-tidy on the configured
paths. Its fields mean:
paths: paths passed toclang-tidy; this is requiredlauncher: optional command prefix prepended to the lint commandargs: extra flags appended before the pathsenv: environment variables added to the lint commandhooks: pre/post commands run around the linter
Minimal example:
lint:
targets:
cpp-style:
backend: clang-tidy
paths: ["src/main.cc"]
pylint¶
lint.targets.<name>.backend: pylint runs pylint on the configured paths.
Its fields mean:
paths: paths passed topylint; this is requiredlauncher: optional command prefix prepended to the lint commandargs: extra flags appended before the pathsenv: environment variables added to the lint commandhooks: pre/post commands run around the linter
Minimal example:
lint:
targets:
python-style:
backend: pylint
paths: ["src"]
ruff-check¶
lint.targets.<name>.backend: ruff-check runs ruff check on the configured
paths. Its fields mean:
paths: paths passed toruff check; this is requiredlauncher: optional command prefix prepended to the lint commandargs: extra flags appended before the pathsenv: environment variables added to the lint commandhooks: pre/post commands run around the linter
Minimal example:
lint:
targets:
python-style:
backend: ruff-check
paths: ["src", "tests"]
Install backends¶
apt-get¶
install.targets.<name>.backend: apt-get runs apt-get install.
packages: package names passed toapt-get install; this is requiredlauncher: optional command prefix prepended to the install commandargs: extra flags appended before packages, such as-yenv: environment variables added to the install commandhooks: pre/post commands run around the install target
Minimal example:
install:
targets:
system-deps:
backend: apt-get
launcher: ["sudo"]
packages: ["cmake", "ninja-build"]
brew¶
install.targets.<name>.backend: brew runs brew install.
packages: package names passed tobrew install; this is requiredlauncher: optional command prefix prepended to the install commandargs: extra flags appended before packagesenv: environment variables added to the install commandhooks: pre/post commands run around the install target
Minimal example:
install:
targets:
macos-deps:
backend: brew
packages: ["cmake", "ninja"]
npm¶
install.targets.<name>.backend: npm runs npm install.
packages: optional package names appended afternpm installpath: optional local package path appended after the commandlauncher: optional command prefix prepended to the install commandargs: extra flags appended before packages or pathsenv: environment variables added to the install commandhooks: pre/post commands run around the install target
Minimal example:
install:
targets:
ui:
backend: npm
path: web
pip¶
install.targets.<name>.backend: pip runs python3 -m pip install. Its fields
mean:
path: optional local path to install, commonly.packages: optional package names or specifiers appended after the commandeditable: optional boolean that adds-e; requirespathlauncher: optional command prefix prepended to the install commandargs: extra flags appended before packages or pathsenv: environment variables added to the install commandhooks: pre/post commands run around the install target
Minimal example:
install:
targets:
editable:
backend: pip
path: .
editable: true
poetry¶
install.targets.<name>.backend: poetry runs poetry install.
launcher: optional command prefix prepended to the install commandargs: extra flags appended afterpoetry installenv: environment variables added to the install commandhooks: pre/post commands run around the install target
poetry does not use path, packages, or editable.
Minimal example:
install:
targets:
dev:
backend: poetry
args: ["--with", "dev"]
uv¶
install.targets.<name>.backend: uv runs uv sync for uv-managed projects.
Its fields mean:
groups: optional dependency groups passed as repeated--groupflagsextras: optional extras passed as repeated--extraflagsinstall_project: optional boolean that controls whether the local project is installed;falseadds--no-install-projectlauncher: optional command prefix prepended to the install commandargs: extra flags appended afteruv syncenv: environment variables added to the install commandhooks: pre/post commands run around the install target
The uv backend only supports project sync options. path, packages, and
editable are not supported.
Minimal example:
install:
targets:
dev-python:
backend: uv
groups: ["dev"]
extras: ["test", "docs"]
install_project: false
yum¶
install.targets.<name>.backend: yum runs yum install.
packages: package names passed toyum install; this is requiredlauncher: optional command prefix prepended to the install commandargs: extra flags appended before packagesenv: environment variables added to the install commandhooks: pre/post commands run around the install target
Minimal example:
install:
targets:
system-deps:
backend: yum
launcher: ["sudo"]
packages: ["cmake", "ninja-build"]
Deploy backends¶
twine¶
This backend runs twine upload. Its fields mean:
artifacts: glob patterns resolved relative to the project root; this is required and must match built package filesrepository: optional Twine repository name passed as--repositoryrepository_url: optional explicit upload URL passed as--repository-urllauncher: optional command prefix prepended to the upload commandargs: extra flags appended before artifact pathsenv: environment variables added to the upload commandhooks: pre/post commands run around the upload step
Minimal example:
deploy:
targets:
pypi:
backend: twine
artifacts: ["dist/*"]