Skip to content

Evaluate redundancy between pre-commit hooks and GitHub CI/CD workflows #125

Description

@jonpspri

Problem Statement

There appears to be significant overlap between our pre-commit hooks and GitHub CI/CD workflows, particularly in the quality checks. This redundancy may be creating unnecessary maintenance overhead.

Current Redundancies

Quality Checks in Both Systems

Pre-commit hooks (.pre-commit-config.yaml):

  • Ruff linting (--fix --exit-non-zero-on-fix)
  • Ruff formatting
  • MyPy type checking
  • MCP documentation compliance checks

GitHub CI/CD (.github/workflows/test.yml):

  • Ruff linting (ruff check src/ tests/)
  • Ruff format check (ruff format --check src/ tests/)
  • MyPy type checking (mypy src/databeak/)
  • MCP documentation compliance checks (separate job)

Questions to Address

  1. Should we simplify CI/CD? Could we replace the individual quality check steps with a single pre-commit run --all-files command?

  2. What are the trade-offs?

    • Pro: Single source of truth for quality checks, easier maintenance
    • Con: Less granular GitHub Actions output, potentially slower feedback
    • Con: Pre-commit uses --fix mode, CI/CD should be read-only
  3. What should remain separate?

    • Test execution (unit/integration) - clearly separate concern
    • Multi-version testing (Python 3.12, 3.13) - matrix strategy
    • Coverage reporting to Codecov - CI/CD specific
  4. Hybrid approach? Could we:

    • Use pre-commit run --all-files in CI/CD for most checks
    • Override specific hooks to use read-only mode (e.g., --check for ruff)
    • Keep tests as separate jobs

Proposed Investigation

  • Research best practices for pre-commit + GitHub Actions integration
  • Test pre-commit run --all-files in CI environment
  • Evaluate impact on GitHub Actions UI/output clarity
  • Measure performance differences
  • Consider using pre-commit.ci service as alternative

Additional Context

Pre-commit strengths:

  • Runs locally before commits (shift-left testing)
  • Auto-fix capabilities
  • Comprehensive hook ecosystem
  • pre-commit.ci for automated PR fixes

GitHub Actions strengths:

  • Matrix testing across Python versions
  • Integration with GitHub UI
  • Codecov integration
  • Can run on different triggers (push, PR, schedule)

Expected Outcome

A clear strategy for:

  1. Which checks should run where
  2. How to minimize duplication while maintaining effectiveness
  3. Whether to adopt pre-commit run --all-files in CI/CD or keep current approach
  4. Documentation of the rationale for our chosen approach

Labels: enhancement, ci/cd, maintenance, discussion

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions