コンテンツにスキップ

CI インテグレーション

GitHub Actions セットアップ

.github/workflows/architecture-check.yml
name: Architecture Check
on: [push, pull_request]
jobs:
mille:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install mille (cargo)
run: cargo install mille
- name: Check architecture
run: mille check --format github-actions

--format github-actions の出力

違反があると PR のコードレビュー画面に直接アノテーションが表示されます:

::error file=src/usecase/order.rs,line=3::External violation: 'sqlx' is not allowed in 'usecase' (import: sqlx)
::error file=src/main.rs,line=15::Call pattern violation: 'find_user' is not in allow_methods

出力フォーマット一覧

フォーマット用途
terminal(デフォルト)ローカル開発。読みやすいターミナル出力
github-actionsCI。PR レビュー画面にアノテーション表示
json外部ツール連携。機械可読な JSON 出力

段階的な CI 導入

ステップ 1: まず warning として警告のみ出す

mille.toml
[severity]
dependency_violation = "warning"
- run: mille check --format github-actions
# exit 0 — CI は落とさず警告のみ表示

ステップ 2: 修正が進んだら error に変更して強制

[severity]
dependency_violation = "error"

npm でのインストール例

- name: Install mille (npm)
run: npm install -g @makinzm/mille
- name: Check architecture
run: mille check --format github-actions

終了コード

コード意味
0違反なし
1違反あり
3設定ファイルエラー

GitHub Actions は exit code 1 を検知して CI を失敗させます。