8000
Skip to content

Fix pre-commit CI issues by switching to lite mode - #9484

Merged
bdraco merged 10 commits into
devfrom
pre-commit-lite
Jul 14, 2025
Merged

Fix pre-commit CI issues by switching to lite mode#9484
bdraco merged 10 commits into
devfrom
pre-commit-lite

Conversation

@bdraco
@bdraco bdraco commented Jul 14, 2025
Copy link
Copy Markdown
Member

What does this implement/fix?

This PR switches to pre-commit.ci lite mode to resolve version mismatch issues between our dependencies and pre-commit configuration on the beta branch. The lite mode provides auto-fixing of PRs through GitHub Actions rather than the full pre-commit.ci service.

Changes:

  • Adds pre-commit-ci-lite job to the main CI workflow
  • Configures it to only run on PRs not targeting beta or release branches
  • Disables pre-commit autoupdate until dependency versions are synced
  • Consolidates ruff, flake8, and clang-format checks into the pre-commit action
  • Removes duplicate CI jobs (ruff, flake8, clang-format) since they're now handled by pre-commit
  • Configures pre-commit to skip pylint, clang-tidy-hash, and yamllint in CI
  • Updates cache key generation to include .pre-commit-config.yaml to ensure proper cache invalidation when pre-commit hooks change

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • Fixes ruff version mismatches between deps and .pre-commit-config.yaml on beta branch

Pull request in esphome-docs with documentation (if applicable):

  • N/A

Test Environment

  • N/A (CI configuration change)

Example entry for config.yaml:

# N/A - CI configuration change

Checklist:

  • The code change is tested and works locally.
  • N/A Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome probot-esphome Bot added the small-pr PR < 30 lines label Jul 14, 2025
@codecov-commenter
codecov-commenter commented Jul 14, 2025
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.69%. Comparing base (d31b8ad) to head (53345f0).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #9484   +/-   ##
=======================================
  Coverage   59.69%   59.69%           
=======================================
  Files          50       50           
  Lines       10261    10261           
  Branches     1379     1379           
=======================================
  Hits         6125     6125           
  Misses       3777     3777           
  Partials      359      359           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bdraco
bdraco marked this pull request as ready for review July 14, 2025 03:13
Copilot AI review requested due to automatic review settings July 14, 2025 03:13
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR switches the CI to use pre-commit.ci lite mode, resolving version mismatches by consolidating linters into a single GitHub Actions job and updating cache behavior.

  • Disable automatic updates and skip problematic hooks in .pre-commit-config.yaml
  • Update cache key to include .pre-commit-config.yaml and install pre-commit in the common setup
  • Remove separate ruff/flake8/clang-format jobs and add a unified pre-commit-ci-lite job
Comments suppressed due to low confidence (2)

.github/workflows/ci.yml:504

  • The job-level if condition needs to be wrapped in ${{ }} to be evaluated correctly. For example:
if: ${{ github.event_name == 'pull_request' && github.base_ref != 'beta' && github.base_ref != 'release' }}
    if: github.event_name == 'pull_request' && github.base_ref != 'beta' && github.base_ref != 'release'

.github/workflows/ci.yml:504

  • To properly skip all release branches (e.g. release/v1.2), consider using startsWith instead of exact match. For example:
if: ${{ github.event_name == 'pull_request' && github.base_ref != 'beta' && !startsWith(github.base_ref, 'release/') }}
    if: github.event_name == 'pull_request' && github.base_ref != 'beta' && github.base_ref != 'release'

@bdraco
bdraco merged commit 873f412 into dev Jul 14, 2025
20 checks passed
@bdraco
bdraco deleted the pre-commit-lite branch July 14, 2025 03:30
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

small-pr PR < 30 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0