mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-09-30 12:42:26 +07:00
Track Homebrew's clang-format version instead of a fixed pin
The previous commit pinned CI and the pre-commit hook to a fixed clang-format 23.1.0, but the maintainer develops on macOS against whatever version `brew` currently installs, which changes over time as Homebrew updates the formula. style-check now runs on macos-latest and installs clang-format via `brew install`, so it tracks the same moving target the maintainer's Mac does. The pre-commit hook switches from pre-commit's own pinned mirror to a local hook that shells out to the system clang-format, so a local commit and CI both go through the same Homebrew-installed binary rather than two independently versioned copies. Trade-off: this reintroduces the non-determinism a fixed pin avoids -- a commit's style-check result can now change over time as Homebrew updates the formula -- but that mirrors how the maintainer already develops, which is the point. Also install coreutils in CI: the style_check Makefile target needs grealpath's --relative-to, which the macOS-native realpath lacks.
This commit is contained in:
@@ -31,7 +31,10 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
style-check:
|
style-check:
|
||||||
runs-on: ubuntu-latest
|
# Uses the macOS runner's pre-installed Homebrew so clang-format tracks
|
||||||
|
# whatever version `brew install clang-format` currently resolves to on
|
||||||
|
# the maintainer's own Mac, instead of a version pinned in this file.
|
||||||
|
runs-on: macos-latest
|
||||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
@@ -39,8 +42,8 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: install clang-format
|
- name: install clang-format
|
||||||
run: |
|
run: |
|
||||||
pipx install clang-format==23.1.0
|
brew update
|
||||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
brew install clang-format coreutils
|
||||||
- name: run style check
|
- name: run style check
|
||||||
run: |
|
run: |
|
||||||
clang-format --version
|
clang-format --version
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
- repo: local
|
||||||
rev: v23.1.0 # CIのstyle-checkと同じバージョンに揃える
|
|
||||||
hooks:
|
hooks:
|
||||||
- id: clang-format
|
- id: clang-format
|
||||||
|
name: clang-format
|
||||||
|
# Uses whatever `clang-format` resolves to on PATH (the Homebrew
|
||||||
|
# install on macOS) instead of a version pinned here, so it tracks
|
||||||
|
# the same version CI installs via `brew install clang-format`.
|
||||||
|
entry: clang-format
|
||||||
|
language: system
|
||||||
files: ^(httplib\.h|(example|fuzzing|test)/[^/]+\.(cpp|cc|h))$
|
files: ^(httplib\.h|(example|fuzzing|test)/[^/]+\.(cpp|cc|h))$
|
||||||
args: [-i] # インプレースで修正
|
args: [-i]
|
||||||
|
|||||||
Reference in New Issue
Block a user