build & ci: ビルドシステムとCIの変更
buildとciコミットタイプの使い分けを学びます。ビルドツール設定、CIパイプラインの変更、Dockerファイル、build、ci、choreの違いを解説します。
Type Examples
詳細な説明
build と ci コミットタイプ
これら2つのタイプは、開発とデプロイメントを支援するがアプリケーションコードを直接変更しないインフラストラクチャの変更をカバーします。
build タイプ
ビルドシステム、ビルド設定、またはビルドに影響する外部依存関係の変更にbuildを使用:
build: upgrade webpack to v5 with module federation
build(deps): add zod for runtime validation
build: configure path aliases in tsconfig
buildを使うタイミング:
- バンドラー設定(webpack、Vite、Rollup、esbuild)の変更
- コンパイラ設定(tsconfig、babel)の変更
- ランタイム依存関係の追加、削除、更新
- package.jsonのビルドスクリプトの変更
- Dockerビルドファイル(Dockerfile)の更新
- Makefileまたは類似のビルドオーケストレーションの変更
ci タイプ
CI/CD設定ファイルとスクリプトの変更にciを使用:
ci: add parallel test execution in GitHub Actions
ci(deploy): configure staging environment pipeline
ci: cache node_modules in CI for faster builds
ciを使うタイミング:
- GitHub Actionsワークフローファイル(.github/workflows/)
- Jenkinsパイプライン設定(Jenkinsfile)
- CircleCI、Travis CI、GitLab CI設定
- CI環境固有のデプロイスクリプト
- CI固有のDocker Composeファイル
build、ci、choreの比較
| シナリオ | タイプ |
|---|---|
| webpack設定の更新 | build |
| GitHub Actionsワークフローの追加 | ci |
| .editorconfigの更新 | chore |
| ランタイム依存関係の追加 | build |
| 開発のみの依存関係の追加 | choreまたはbuild |
| Dockerfileの変更 | build |
| CIキャッシュの設定 | ci |
| .gitignoreの更新 | chore |
複合的な変更
コミットがbuildとCI設定の両方に触れる場合、主な意図で選択:
ci: add Docker-based CI pipeline
Add a multi-stage Dockerfile for CI builds and a
GitHub Actions workflow that builds, tests, and
deploys using the Docker image.
The Dockerfile is also usable for local development
via docker-compose.
ユースケース
Dockerイメージをビルドし、テストを並列実行し、ステージング環境にデプロイする新しいGitHub Actionsワークフローをセットアップしました。コミットはDockerfileとワークフローYAMLファイルの両方に触れます。正しいコミットタイプを選択し、CI/CDパイプラインの変更を説明するメッセージを書く必要があります。