diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 27ed77d..a8d317a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -31,7 +31,10 @@ env: jobs: 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 continue-on-error: true steps: @@ -39,8 +42,8 @@ jobs: uses: actions/checkout@v4 - name: install clang-format run: | - pipx install clang-format==23.1.0 - echo "$HOME/.local/bin" >> "$GITHUB_PATH" + brew update + brew install clang-format coreutils - name: run style check run: | clang-format --version diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7a8665..f6ccb48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,12 @@ repos: - - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v23.1.0 # CIのstyle-checkと同じバージョンに揃える + - repo: local hooks: - 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))$ - args: [-i] # インプレースで修正 \ No newline at end of file + args: [-i]