CleanCIH: A Complete Guide to Installation and SetupCleanCIH is an open-source continuous integration helper designed to simplify and standardize build, test, and deployment workflows across teams. It focuses on reproducibility, lightweight configuration, and clear reporting, making it a good fit for small projects and larger monorepos alike.
What CleanCIH does and why it matters
CleanCIH orchestrates your CI tasks by providing:
- Lightweight YAML-based configuration for defining pipelines.
- Caching and artifact management to speed up repeated runs.
- Isolated execution environments to ensure reproducible builds.
- Pluggable steps and scripts so you can integrate linters, tests, and deployment without modifying CI server internals.
This matters because inconsistent CI environments and ad-hoc scripts cause flaky tests, slow builds, and developer frustration. CleanCIH aims to reduce that friction by making pipelines explicit, shareable, and fast.
Key concepts
- Pipeline: a sequence of stages (build, test, deploy) defined in a config file.
- Runner: the agent that executes pipeline steps (local, container, or remote).
- Cache: stored artifacts (dependencies, build outputs) to reuse between runs.
- Workspace: the isolated filesystem where steps run.
Requirements
- A machine (local or server) with Docker (optional) and Git installed.
- Python 3.9+ (CleanCIH is a Python tool).
- At least 2 GB RAM and 10 GB free disk space for typical projects.
Installation
-
Install via pip:
pip install cleancih
-
Verify installation:
cleancih --version
-
Optional: install Docker and add your user to the docker group if you plan to use container runners.
First project setup
- Create a repository or use an existing one.
- Add a CleanCIH config file at the repo root named
.cleancih.yml
with this minimal example: “`yaml version: 1 pipeline: stages:- name: build commands:
- pip install -r requirements.txt
- python setup.py build
- name: test commands:
- pytest -q “`
- name: build commands:
- Initialize a local runner:
cleancih runner init --type=local cleancih runner start
- Run the pipeline:
cleancih run
Using Docker runner
To run steps inside Docker containers, configure the runner:
cleancih runner init --type=docker
In .cleancih.yml
, specify images:
pipeline: stages: - name: test image: python:3.10-slim commands: - pip install -r requirements.txt - pytest -q
Caching and artifacts
Enable caching to speed subsequent runs:
cache: paths: - .venv/ - .cache/pip artifacts: paths: - dist/
Use cleancih cache restore
and cleancih cache save
in advanced CI setups.
Secrets and environment variables
Store secrets in the runner configuration or an environment manager. Avoid committing secrets to the repo. Example using runner-managed env:
cleancih runner set-env SECRET_KEY=abcd1234
In the config, reference env vars:
pipeline: stages: - name: deploy commands: - ./deploy.sh --key=$SECRET_KEY
Troubleshooting
- “Command not found”: ensure runner has required tools or use a Docker image containing them.
- Permission errors with Docker: add your user to the docker group or run with sudo.
- Cache not restoring: confirm cache key matches and paths are correct.
CI server integration
CleanCIH can be invoked from GitHub Actions, GitLab CI, or other CI servers by installing it in the CI image and running cleancih run
. Example GitHub Actions job:
jobs: ci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: '3.10' - run: pip install cleancih - run: cleancih run
Best practices
- Keep
.cleancih.yml
small and compose complex flows using include/imports. - Cache only safe, non-secret paths.
- Pin Docker images and Python package versions for reproducibility.
- Run linters and fast unit tests early in the pipeline.
Example: monorepo setup
For a monorepo, define multiple pipelines or stages per package and use workspace isolation. Use matrix runs to parallelize tests across packages.
Roadmap and community
Check the CleanCIH GitHub for plugins, runner improvements, and contributed templates. Contribute issues or PRs to add integrations you need.
If you want, I can:
- Convert this to a README-ready Markdown file.
- Create a sample
.cleancih.yml
tailored to your project (tell me stack and goals).
Leave a Reply