Run BranchPy in CI

Use BranchPy in CI to catch regressions before merge.

Typical CI flow

  1. Install Python and BranchPy.
  2. Run Doctor as an environment sanity check.
  3. Run Analyze and/or Stats in JSON mode.
  4. Fail the build if blocking issues are detected.

Example (GitHub Actions)

name: branchpy-check
on:
  pull_request:
  push:
    branches: [ main ]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: Install BranchPy
        run: pip install branchpy

      - name: Doctor
        run: branchpy doctor --project . --json

      - name: Analyze
        run: branchpy --project . analyze --format json

      - name: Stats
        run: branchpy --project . stats --format json
  • --project <path> for deterministic scope.
  • --json or --format json for machine-readable output.
  • --quiet for lower-noise logs where needed.

Practical notes

  • Keep CI and local workflows aligned to reduce “works on my machine” drift.
  • Pin Python version in CI.
  • If your repo has multiple projects, run BranchPy once per target path.