ci: clang-format dry-run チェックジョブを追加 (#63)#78
Merged
Conversation
thawk105
added a commit
that referenced
this pull request
May 14, 2026
ci: devcontainer の clang-format を 14 に固定 (PR #78 の CI 失敗修正)
c7a7437 to
97c0fcb
Compare
build とは独立した format.yml を新設し、cc/ include/ common/ 配下の .cc/.hh/.cpp に clang-format --dry-run --Werror をかける。フォーマット 違反コミットを CI で弾く。 clang-format は devcontainer Dockerfile の dev stage (:latest) のみに 入っているため、このジョブは :latest image を使う (:ci slim には無い)。 対象集合と clang-format バージョン (14) は一括 reformat (#76) と揃える。 Closes #63
97c0fcb to
982ce83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
CI に build とは独立した軽量な clang-format チェックジョブを追加する。
clang-format --dry-run --Werrorで.clang-formatに違反するファイルを検出し、フォーマット崩れのコミットが master に混入するのを防ぐ。
Closes #63スタック構成 (重要)
このPRは以下のスタックの最上段で、#75・#76 が先にマージされる必要がある。
理由: 現在の master のソースは未整形なので、clang-format チェックを足すと
即 CI が赤になる。#75 でリファインした
.clang-format、#76 でコードベース全体を reformat 済みのツリーの上にこのジョブを足すことで、初めて緑になる。
GitHub 上の diff も #76 マージ後は format.yml の追加 1ファイルだけになる。
実装方針
Option 1 / Option 2 → Option 2 を選択
新規ワークフロー
.github/workflows/format.ymlとして分離した(issue 本文の Option 2)。理由:
ジョブを分けておけば、どちらが赤かが Actions 一覧で一目で分かる。
paths-ignoreはbuild.ymlと完全に揃えてあり、docs 等の変更で無駄に走らない点は Option 1 と同じ。
clang-format を動かす image →
:latestを選択.devcontainer/Dockerfileを確認したところ、clang-formatはdevstage (=
:latest) にのみ入っており、build.ymlが使う slim な:ciimage には入っていない (#46 で slim 化)。
:ciにclang-formatを足すとDockerfile 変更 + image 再ビルドが必要でスコープが膨らむため、format-check
ジョブだけ
:latestを使う。build.ymlと同様に container job なので--user root+git config --global --add safe.directoryを設定。検証
#76 のツリー (このPRの作業ツリー) 上で、ワークフローが実行するのと同じ
コマンドをローカル実行し緑を確認:
cc/ include/ common/配下の.cc/.hh/.cpp計 240 ファイル。style: ソース全体を .clang-format に合わせて一括 reformat #76 が reformat した集合と一致。
cc/include/common配下にthird_party/や
build/のツリーは無いため、拡張子フィルタだけで十分。:latest、ubuntu:24.04 ベース) と一致。
「master 上で緑」の最終確認は、スタック (#75 → #76 → このPR) が全部
マージされた後になる。
actions / 規約
actions/checkout@v6をメジャー版 pin (build.ymlに合わせる)。paths-ignoreをbuild.ymlと同期。--user root+safe.directory設定済み。