Loading...
Loading...
GitHub Actions CI/CD for Rust+Node.js hybrid repos. Covers workflow structure, installable composite actions, artifact flow, caching, and dev versioning. Use when: (1) setting up or fixing GitHub Actions workflows, (2) adding CI for a Rust+Node.js project, (3) working with composite actions (setup-workspace, rust-cross-build, compute-version, wait-npm-propagation), (4) debugging CI failures, (5) setting up the cross-platform build matrix. Triggers on "CI", "workflow", "GitHub Actions", "cross-build", "artifact", or work in .github/workflows/.
npx skill4agent add onsager-ai/dev-skills rust-node-ci.github/workflows/Cargo.tomlpackage.jsonWhat 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 │
└─────────────┘| Workflow | Trigger | What It Does |
|---|---|---|
| PR, push to main | Node build+test+lint, Rust fmt+clippy+test |
| Release, dispatch | Cross-build → publish to npm |
| repository_dispatch | Copilot agent onboarding |
steps:
- uses: ./.github/actions/setup-workspace
- run: pnpm build
- run: pnpm test
- run: pnpm typechecksteps:
- 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.ymluses: ./.github/actions/<name>| Action | Install path | Purpose |
|---|---|---|
| | Checkout + pnpm + Node.js + cache + install |
| | Build Rust binaries for a target platform |
| | Compute dev/release version + npm tag |
| | Poll npm until platform packages are visible |
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| Tool | How |
|---|---|
| pnpm | |
| Rust | |
| Turbo | |
base version: 0.2.15
compute-version (is-release: false) → 0.2.16-dev.{github_run_id}
npm-tag: devcompute-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| Problem | Fix |
|---|---|
| Rust build fails on macOS ARM | Use |
| pnpm lockfile mismatch | |
| Cargo cache too large | Add |
| Artifact not found downstream | Check |
| Directory | Contents |
|---|---|
| templates/workflows/ | |
| templates/actions/ | 4 composite actions with |
npx skills add -g onsager-ai/dev-skills --skill rust-node-ci -a claude-code -y.github/workflows/