Skip to content

feat(deploy): --no-contract-build flag for CI without contract toolchains#86

Merged
EnderOfWorlds007 merged 4 commits into
mainfrom
feat/skip-contract-build
May 2, 2026
Merged

feat(deploy): --no-contract-build flag for CI without contract toolchains#86
EnderOfWorlds007 merged 4 commits into
mainfrom
feat/skip-contract-build

Conversation

@EnderOfWorlds007

@EnderOfWorlds007 EnderOfWorlds007 commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds `--no-contract-build` to `dot deploy`. When set alongside `--contracts`, the deploy skips the toolchain spawn (`forge build --resolc`, `npx hardhat compile`, `cargo-contract build` via `@dotdm/contracts`) and uses existing on-disk artifacts under the project's standard output dir.
  • Throws with a clear error message (including the path and a hint to remove the flag or build manually) when no artifacts are found.
  • Use case: CI environments without the contract compilers installed. The fixture projects under `e2e/cli/fixtures/projects/{foundry,hardhat,rust-cdm}` ship pre-built artefacts; the new flag lets E2E deploy tests use them directly.

What changes

  • `src/commands/deploy/index.ts` — declares `--no-contract-build`; `contractBuild?: boolean` added to `DeployOpts`; `skipContractBuild` plumbed to `runDeploy`
  • `src/utils/deploy/run.ts` — `skipContractBuild?: boolean` added to `RunDeployOptions`; forwarded to `runContractsPhase` as `skipBuild`
  • `src/utils/deploy/contracts.ts` — `skipBuild?: boolean` added to `RunContractsPhaseOptions`; `compileFoundry` / `compileHardhat` skip `runStreamed` when set; `compileCdm` branches to a new `compileCdmSkipBuild` helper that uses `detectContracts` + checks `target/.release.polkavm`
  • `src/utils/deploy/contracts.test.ts` — 6 new integration tests for the skip path (3 foundry + 3 hardhat), covering the happy path and two error paths each
  • `README.md` — CI/automation flags table added under `dot deploy`
  • `.changeset/feat-skip-contract-build.md` — minor bump

CDM skip-build implementation

`@dotdm/contracts` does not have a discover-only mode in `buildContracts`. Instead, `compileCdmSkipBuild` calls the exported `detectContracts(rootDir)` (reads `cargo metadata`, no build required), then checks `target/.release.polkavm` — the exact path `buildContracts` writes per the upstream source at `dist/index.js:674`. No `.contract` JSON parsing needed.

CDM skip-build is implemented but not unit-tested — `detectContracts` requires a real Cargo workspace or a heavy mock; correctness is exercised through e2e in the follow-up.

Interactive path

`--no-contract-build` is headless-only by design. The flag is parsed but not forwarded to the interactive TUI path (`runInteractive`), consistent with how the flag is described as CI-only in the README.

Test plan

  • `pnpm exec tsc --noEmit` — clean
  • `pnpm test` — 445 passing (6 new integration tests added)
  • `bun run src/index.ts deploy --help` shows `--no-contract-build` with description
  • `--no-contract-build` without `--contracts` is a no-op (the `deployContracts` gate in `maybeRunContracts` already short-circuits before `runContractsPhase` is called)

…olchains

When --no-contract-build is passed alongside --contracts, the deploy
skips the toolchain subprocess (forge build --resolc, npx hardhat compile,
cargo-contract build) and reads pre-existing artifacts from the project's
standard output directories. Throws with a clear error if no artifacts are
found, pointing the user to remove the flag or build manually first.

Supports foundry (out/), hardhat (artifacts/contracts/), and cdm
(target/<crate>.release.polkavm via detectContracts).
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/feat/skip-contract-build bash

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

E2E Test Pass · ❌ FAIL

Tag: e2e-ci-pr · Branch: feat/skip-contract-build · Commit: ae551c1 · Run logs

Cell Result Time
current ❌ FAIL 26m59s
❌ Failed tests (1)
  • e2e/cli/install.test.ts › dot install &gt; dot update succeeds and returns updated version
    expected 1 to be +0 // Object.is equality

Sentry traces: view spans for this run

@EnderOfWorlds007 EnderOfWorlds007 merged commit 8d02aa4 into main May 2, 2026
8 of 9 checks passed
EnderOfWorlds007 added a commit that referenced this pull request May 3, 2026
#85)

* ci(e2e): split into 7-cell matrix (Phase 4); add foundry+CDM full-deploy tests

* docs(claude): update tool reference after Phase 3 rename (mod-fixture → e2e-fixtures)

* test(e2e): add --no-build to foundry+CDM full-deploy tests so CI doesn't need forge/cargo-contract

* test(e2e): use --no-contract-build for foundry+CDM cells (depends on PR #86)

* test(e2e): drop --no-build from foundry/CDM cells; let fixture build script run

* test(e2e): skip pr-deploy-cdm cell pending fixture upgrade (Phase 5 follow-up)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant