You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
graph TD
A[Pull Request] --> B{test ジョブ}
B --> C[npm ci]
C --> D[Lint 全パッケージ]
D --> E[Unit tests 全パッケージ]
E --> F[テスト結果保存]
Loading
ワークフロー実行フロー(Phase 2)
graph TD
A[Push/PR] --> B{test ジョブ}
B --> C[Lint + Unit tests]
A --> H{build-and-deploy ジョブ}
H --> I[npm ci]
I --> J[Build 全パッケージ]
J --> K[Integration tests]
K --> L{develop/main/master?}
L -->|Yes| M[Deploy to smalruby3-editor GH Pages]
L -->|Yes| N[Deploy to smalruby.app]
L -->|No| O[End]
Loading
環境変数
GitHub Secrets (必要)
SMALRUBY_APP_DEPLOY_KEY: smalruby.app へのデプロイキー
GOOGLE_CLIENT_ID: Google API クライアント ID
GOOGLE_API_KEY: Google API キー
MESH_GRAPHQL_ENDPOINT: Mesh GraphQL エンドポイント
MESH_API_KEY: Mesh API キー
MESH_AWS_REGION: Mesh AWS リージョン
ワークフロー内環境変数
NODE_OPTIONS: --max-old-space-size=4000
NODE_ENV: production (ビルド時)
DETECT_CHROMEDRIVER_VERSION: "true" (integration test 時)
package.json scripts(ルート)
現在の scripts:
{
"build": "npm run build:vm && npm run build:gui",
"lint": "npm run lint:gui && npm run lint:vm",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "npm run test:unit:gui && npm run test:unit:vm",
"test:integration": "npm run test:integration:gui && npm run test:integration:vm"
}
概要
Monorepo 移行(smalruby3-gui/scratch-vm → smalruby3-editor)に伴い、
smalruby3-editorリポジトリの CI/CD ワークフローを更新します。関連 Issue: #29 (Phase 6)
統合先
smalruby3-editorリポジトリ (NOT smalruby3-develop)既存の
gui/smalruby3-editor/.github/workflows/を修正して CI/CD を実現します。現状分析
smalruby3-editor の現在の CI/CD 構成
.github/workflows/ci.ymlその他のワークフロー
commitlint.yml- commit message チェック ✅ 維持gha-debug.yml- デバッグ情報 ✅ 維持publish.yml- npm publish ❌ 削除予定update-i18n.yml- i18n 更新 ❌ 削除予定signature-assistant.yml- CLA アシスタント ❌ 削除予定ghpages-cleanup.yml- GitHub Pages クリーンアップ ❌ 削除予定smalruby3-gui の CI/CD 構成(参考)
.github/workflows/ci-cd.ymlnpm run setup-scratch-vmnpm run test:lintnpm run test:unitnpm run setup-scratch-vmnpm run buildnpm run test:integration移行後の CI/CD 要件
基本方針
ワークフロー構造を smalruby3-gui に倣う:
段階的アプローチ:
デプロイ先:
https://smalruby-jp.github.io/smalruby3-editor/(smalruby3-editor リポジトリの GitHub Pages)https://smalruby.app/(production)不要なワークフローを削除:
publish.yml- npm publish(必要になったら復元)update-i18n.yml- i18n 更新(必要になったら復元)signature-assistant.yml- CLA アシスタント(必要になったら復元)ghpages-cleanup.yml- GitHub Pages クリーンアップ(必要になったら復元)対象パッケージ
lint + unit test を実行するパッケージ:
task-herderscratch-svg-rendererscratch-renderscratch-vmscratch-guiintegration test を実行するパッケージ:
scratch-vmscratch-gui実装タスク
Phase 1: test ジョブの実装(最優先)
6.1.1. test ジョブの作成
.github/workflows/ci-cd.ymlの作成.nvmrc参照)npm run lint:gui(scratch-gui)npm run lint:vm(scratch-vm)npm run test:unit:gui(scratch-gui)npm run test:unit:vm(scratch-vm)6.1.2. package.json の確認
各パッケージの scripts 確認
packages/task-herder/package.json- lint, test:unit スクリプトpackages/scratch-svg-renderer/package.json- lint, test:unit スクリプトpackages/scratch-render/package.json- lint, test:unit スクリプトpackages/scratch-vm/package.json- lint, test:unit スクリプトpackages/scratch-gui/package.json- test:lint, test:unit スクリプトルート package.json の scripts 更新(必要に応じて)
lintスクリプトで全パッケージの lint を実行test:unitスクリプトで全パッケージの unit test を実行6.1.3. テストの動作確認
ローカルでのテスト実行確認
npm run lintが成功することnpm run test:unitが成功することPull request でのテスト実行確認
Phase 2: build-and-deploy ジョブの実装
6.2.1. build-and-deploy ジョブの作成
npm run build(全パッケージ)npm run test:integration:gui(scratch-gui)npm run test:integration:vm(scratch-vm)6.2.2. デプロイワークフローの実装
smalruby3-editor リポジトリへのデプロイ
https://smalruby-jp.github.io/smalruby3-editor/peaceiris/actions-gh-pages@v4アクション使用publish_dir:./packages/scratch-gui/buildsmalruby.app へのデプロイ
https://smalruby.app/GOOGLE_CLIENT_IDGOOGLE_API_KEYMESH_GRAPHQL_ENDPOINTMESH_API_KEYMESH_AWS_REGIONSMALRUBY_APP_DEPLOY_KEYpeaceiris/actions-gh-pages@v4アクション使用smalruby.app).nojekyllファイル作成external_repository:smalruby/smalruby.app6.2.3. ビルドプロセスの確認
ビルド成果物のパス確認
packages/scratch-gui/build/ディレクトリ環境変数の設定確認
6.2.4. integration test の動作確認
ローカルでの integration test 実行確認
npm run test:integration:guiが成功することnpm run test:integration:vmが成功することCI での integration test 実行確認
6.2.5. デプロイの動作確認
develop ブランチへのマージでの確認
デプロイ後の動作確認
https://smalruby-jp.github.io/smalruby3-editor/でアプリが正常に動作することhttps://smalruby.app/でアプリが正常に動作すること6.3. 不要なワークフローの削除
ワークフローファイルの削除
gui/smalruby3-editor/.github/workflows/publish.yml削除gui/smalruby3-editor/.github/workflows/update-i18n.yml削除gui/smalruby3-editor/.github/workflows/signature-assistant.yml削除gui/smalruby3-editor/.github/workflows/ghpages-cleanup.yml削除削除の確認
6.4. commitlint.yml の維持
6.5. gha-debug.yml の維持
技術的詳細
ディレクトリ構造
ワークフロー実行フロー(Phase 1)
graph TD A[Pull Request] --> B{test ジョブ} B --> C[npm ci] C --> D[Lint 全パッケージ] D --> E[Unit tests 全パッケージ] E --> F[テスト結果保存]ワークフロー実行フロー(Phase 2)
graph TD A[Push/PR] --> B{test ジョブ} B --> C[Lint + Unit tests] A --> H{build-and-deploy ジョブ} H --> I[npm ci] I --> J[Build 全パッケージ] J --> K[Integration tests] K --> L{develop/main/master?} L -->|Yes| M[Deploy to smalruby3-editor GH Pages] L -->|Yes| N[Deploy to smalruby.app] L -->|No| O[End]環境変数
GitHub Secrets (必要)
SMALRUBY_APP_DEPLOY_KEY: smalruby.app へのデプロイキーGOOGLE_CLIENT_ID: Google API クライアント IDGOOGLE_API_KEY: Google API キーMESH_GRAPHQL_ENDPOINT: Mesh GraphQL エンドポイントMESH_API_KEY: Mesh API キーMESH_AWS_REGION: Mesh AWS リージョンワークフロー内環境変数
NODE_OPTIONS: --max-old-space-size=4000NODE_ENV: production(ビルド時)DETECT_CHROMEDRIVER_VERSION: "true"(integration test 時)package.json scripts(ルート)
現在の scripts:
{ "build": "npm run build:vm && npm run build:gui", "lint": "npm run lint:gui && npm run lint:vm", "test": "npm run test:unit && npm run test:integration", "test:unit": "npm run test:unit:gui && npm run test:unit:vm", "test:integration": "npm run test:integration:gui && npm run test:integration:vm" }必要に応じて追加・修正:
デプロイアクション設定(Phase 2)
smalruby3-editor リポジトリへのデプロイ
smalruby.app へのデプロイ
テスト計画
Phase 1 のテスト
ローカルでのテスト
npm run lintが成功npm run test:unitが成功Pull request でのテスト
Phase 2 のテスト
ローカルでのテスト
npm run buildが成功npm run test:integrationが成功CI でのテスト
デプロイのテスト
デプロイ後の動作確認
https://smalruby-jp.github.io/smalruby3-editor/が正常に動作https://smalruby.app/が正常に動作移行チェックリスト
Phase 1
.github/workflows/ci-cd.yml作成(test ジョブのみ)Phase 2
.github/workflows/ci-cd.yml更新(build-and-deploy ジョブ追加)Phase 3
参考資料
現在のワークフローファイル(smalruby3-editor)
gui/smalruby3-editor/.github/workflows/ci.yml- 現在の CIgui/smalruby3-editor/.github/workflows/commitlint.yml- commitlintgui/smalruby3-editor/.github/workflows/gha-debug.yml- デバッグgui/smalruby3-editor/.github/path-filters.yml- パスフィルター参考ワークフローファイル(smalruby3-gui)
gui/smalruby3-gui/.github/workflows/ci-cd.yml- smalruby3-gui の CI/CDgui/smalruby3-gui/.github/workflows/commitlint.yml- commitlintpackage.json
gui/smalruby3-editor/package.json- ルート package.jsongui/smalruby3-editor/packages/*/package.json- 各パッケージの package.jsonビルドスクリプト
gui/smalruby3-gui/scripts/postbuild.mjs- ビルド後処理(PUBLIC_PATH 対応)完了条件
Phase 1
Phase 2
Phase 3
推定工数
1-2日 (Phase 6 全体)