mcpField
R
rust-node-ci

rust-node-ci

github.com/onsager-aiクラウド・DevOps761 回インストール2 週間前に更新
リポジトリ

rust-node-ci について

rust-node-ciは、RustとNode.jsを組み合わせたプロジェクト向けのGitHub Actionsワークフローと複合アクションを提供します。テンプレートを使い、CIやクロスプラットフォームビルド、npm公開を構成できます。

主な機能

  1. 01RustとNode.jsのCIワークフロー
  2. 02セットアップ・ビルド用複合アクション
  3. 03クロスプラットフォームのバイナリビルド
  4. 04アーティファクトのアップロードと取得
  5. 05開発版・リリース版のバージョン管理

活用シーン

  1. 01RustとNode.jsのリポジトリでCIを開始
  2. 02プラットフォーム別ビルドと成果物処理の追加
  3. 03プラットフォームパッケージのnpm公開
  4. 04キャッシュやワークフローの問題調査

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/onsager-ai/dev-skills --skill rust-node-ci

インストール後、Claude Code で/rust-node-ciを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
troubleshooting.md
templates/actions/compute-version/
action.yml
README.md
templates/actions/rust-cross-build/
action.yml
README.md
templates/actions/setup-workspace/
action.yml
README.md
templates/actions/wait-npm-propagation/
action.yml
README.md
templates/workflows/
ci.yml
copilot-setup-steps.yml
publish.yml

詳細

Rust+Node.js CI/CD

Rust+Node.js ハイブリッドプロジェクト向けの GitHub Actions ワークフローとコンポジットアクションです。

このスキルを使う場面

次のいずれかに該当する場合に有効化します。

  • Cargo.toml と package.json の両方があるリポジトリで .github/workflows/ を扱う場合
  • CI/CD パイプラインを設定、修正、または拡張する場合
  • プロジェクトにコンポジットアクションをインストールする場合
  • ユーザーが「CI」「workflow」「GitHub Actions」「cross-build」「artifact」に言及した場合

判断ツリー

What does the user need?

Set up CI from scratch?
  → Copy templates/workflows/ into .github/workflows/
  → Install composite actions from templates/actions/ into .github/actions/
  → Customize platform matrix for your targets

Fix a failing CI job?
  → Node job → CI Jobs section
  → Rust build/cross-compile → Composite Actions section + references/troubleshooting.md
  → Publish workflow → see rust-npm-publish skill

Add a new platform to the build matrix?
  → Publish Workflow Matrix section
  → Full platform reference → see rust-npm-publish skill

Understand dev vs release versioning in CI?
  → Dev Versioning section

ワークフローのアーキテクチャ

┌─────────────┐     ┌──────────────────┐
│  Node Build  │     │   Rust Build     │
│  (test/lint) │     │  (per platform)  │
└──────┬──────┘     └────────┬─────────┘
       │                     │
       │   ┌─────────────┐   │
       └──►│  Artifacts   │◄──┘
           └──────┬──────┘
                  │
           ┌──────▼──────┐
           │   Publish    │
           └─────────────┘

ワークフロー

ワークフロートリガー実行内容
ci.ymlPR、main への pushNode のビルド+テスト+lint、Rust の fmt+clippy+テスト
publish.ymlリリース、dispatchクロスビルド → npm への公開
copilot-setup-steps.ymlrepository_dispatchCopilot エージェントのオンボーディング

テンプレート:templates/workflows/

CI ジョブ

Node ジョブ
steps:
  - uses: ./.github/actions/setup-workspace
  - run: pnpm build
  - run: pnpm test
  - run: pnpm typecheck
Rust ジョブ
steps:
  - uses: actions/checkout@v4
  - uses: dtolnay/rust-toolchain@stable
    with:
      components: clippy, rustfmt
  - run: cargo fmt --all -- --check
  - run: cargo clippy --workspace -- -D warnings
  - run: cargo test --workspace

コンポジットアクション

プロジェクトの .github/actions/<name>/action.yml にインストールし、uses: ./.github/actions/<name> として参照します。

テンプレート:templates/actions/

アクションインストール先目的
setup-workspace.github/actions/setup-workspace/Checkout + pnpm + Node.js + キャッシュ + インストール
rust-cross-build.github/actions/rust-cross-build/ターゲットプラットフォーム向けに Rust バイナリをビルド
compute-version.github/actions/compute-version/開発版/リリース版のバージョンと npm タグを算出
wait-npm-propagation.github/actions/wait-npm-propagation/プラットフォームパッケージが表示されるまで npm をポーリング

公開ワークフローのマトリックス

strategy:
  matrix:
    include:
      - { os: macos-latest,   target: x86_64-apple-darwin,      platform: darwin-x64 }
      - { os: macos-latest,   target: aarch64-apple-darwin,     platform: darwin-arm64 }
      - { os: ubuntu-22.04,   target: x86_64-unknown-linux-gnu, platform: linux-x64 }
      - { os: windows-latest, target: x86_64-pc-windows-msvc,   platform: windows-x64 }

各マトリックス項目で rust-cross-build を実行し、バイナリをアーティファクトとしてアップロードします。

アーティファクトの流れ

# Upload from build job (one per platform)
- uses: actions/upload-artifact@v4
  with:
    name: binary-${{ matrix.platform }}
    path: target/${{ matrix.target }}/release/my-cli${{ matrix.platform == 'windows-x64' && '.exe' || '' }}
    retention-days: 1

# Download in publish job (all platforms)
- uses: actions/download-artifact@v4
  with:
    pattern: binary-*
    path: artifacts/
    merge-multiple: false

キャッシュ

ツール方法
pnpmactions/setup-node@v4 に cache: 'pnpm' を指定
RustSwatinem/rust-cache@v2 に shared-key: ${{ matrix.platform }} を指定
Turbo.turbo パスに対して actions/cache@v4 を使用

CI での開発版バージョニング

リリース以外のビルドでは、一意のプレリリースバージョンを算出します。

base version: 0.2.15
compute-version (is-release: false) → 0.2.16-dev.{github_run_id}
npm-tag: dev

compute-version アクションを使用します。

- uses: ./.github/actions/compute-version
  id: version
  with:
    base-version: ${{ steps.pkg.outputs.version }}
    is-release: ${{ github.event_name == 'release' }}
# outputs: version, npm-tag, is-dev

トラブルシューティング

問題対処方法
macOS ARM で Rust ビルドが失敗するmacos-latest を使用し、rustup target add aarch64-apple-darwin を実行
pnpm のロックファイルが一致しないCI では --frozen-lockfile を使用し、ローカルで再生成
Cargo キャッシュが大きすぎるrust-cache に shared-key を追加し、main でのみ save-if を使用
後続処理でアーティファクトが見つからないneeds: の連鎖を確認し、アーティファクト名が一致することを確認

詳しい診断については、references/troubleshooting.md を参照してください。

テンプレート

ディレクトリ内容
templates/workflows/ci.yml、publish.yml、copilot-setup-steps.yml
templates/actions/action.yml と README を含む4つのコンポジットアクション

セットアップと有効化

npx skills add -g onsager-ai/dev-skills --skill rust-node-ci -a claude-code -y

Rust+Node.js リポジトリに .github/workflows/ ディレクトリがある場合、またはユーザーが「CI」「workflow」「GitHub Actions」「cross-build」に言及した場合に自動的に有効化されます。

コメント