mirror of
https://github.com/redwoodjs/local-ci.git
synced 2026-09-19 07:54:29 +08:00
7a349fdb43
## Problem Agent CI still depended on the TypeScript runner as the main execution path. That made it harder to ship a small native binary and harder to prove the Rust path matched the TypeScript path. Review also found places where Rust and TypeScript could drift before the Rust path becomes the default. ## Solution This PR adds the opt-in Rust native `agent-ci` binary and platform npm packages while keeping the TypeScript fallback. It splits the Rust code into `agent-ci-core`, `agent-ci-runtime`, and a thin CLI/orchestration crate. Pure planning, reusable workflow expansion, event contracts, and run-result contracts now live in core; runtime owns Docker, DTU, runner, macOS VM, workspace, execution-plan adapters, and the generic wave worker pool. The fixture checks now use real TypeScript helpers instead of a shadow planner. Shared fixtures cover plans, events, run results, Docker socket resolution, and default job-limit CPU/memory vectors. The Rust runner honors `--jobs`, probes Docker memory for the default job limit, supports macOS VM concurrency limits, avoids nested runner container name collisions, has `--all` smoke coverage, and stages `bin/agent-ci` in every platform package. ## Validation - `cargo check --workspace --all-targets` - `cargo fmt --all -- --check` - `cargo clippy --workspace --all-targets -- -D warnings` - `cargo test --workspace --all-targets` - `pnpm check` - `pnpm fixtures:check` - `pnpm golden:cli` - `pnpm rust:smoke:parity` - `pnpm agent-ci-dev run --all -q -p --json --github-token` ## Notes Rust execution is still opt-in. The TypeScript implementation and fallback remain in place until the later default-switch and removal gates pass.
66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, labeled, synchronize]
|
|
paths-ignore:
|
|
- "**/*.md"
|
|
- "docs/**"
|
|
- ".docs/**"
|
|
- "LICENSE"
|
|
|
|
jobs:
|
|
test:
|
|
if: '!github.event.pull_request.draft && (contains(fromJSON(''["MEMBER", "OWNER", "COLLABORATOR"]''), github.event.pull_request.author_association) || contains(github.event.pull_request.labels.*.name, ''safe-to-run''))'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
|
|
with:
|
|
version: 10.30.1
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
with:
|
|
node-version: 24
|
|
cache: "pnpm"
|
|
- run: pnpm install
|
|
- run: pnpm check
|
|
- name: Setup Rust
|
|
run: |
|
|
if ! command -v cargo >/dev/null 2>&1; then
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --profile minimal --default-toolchain stable
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
fi
|
|
if [ -f "$HOME/.cargo/env" ]; then
|
|
. "$HOME/.cargo/env"
|
|
fi
|
|
rustup component add rustfmt clippy
|
|
- name: Check Rust
|
|
run: |
|
|
pnpm rust:fmt:check
|
|
pnpm rust:check
|
|
pnpm rust:clippy
|
|
pnpm rust:test
|
|
- name: Check fixture contracts
|
|
run: |
|
|
cargo test -p agent-ci-core fixture
|
|
cargo test -p agent-ci-runtime docker_socket_fixture_contracts_match_snapshots
|
|
pnpm fixtures:check
|
|
- name: Check native CLI golden output
|
|
run: pnpm golden:cli
|
|
- name: Check Rust smoke parity
|
|
run: |
|
|
if [ "${AGENT_CI_LOCAL:-}" = "true" ]; then
|
|
echo "Skipping nested Rust smoke parity inside agent-ci local validation."
|
|
exit 0
|
|
fi
|
|
pnpm rust:smoke:parity
|
|
- name: Test DTU
|
|
run: pnpm --filter dtu-github-actions test
|
|
- name: Test CLI
|
|
run: pnpm --filter agent-ci test
|