Skip to Content
Platform FeaturesCI/CDBuild Configuration

Build Configuration

When you connect a repository, the Stagenet asks how to install dependencies, compile contracts, and decide which artifacts count as “your contracts.” Standard Hardhat and Foundry projects work out of the box — the fields below only need attention when something about your project is non-default.

You can edit a repository’s Build Configuration any time from the repository’s Settings tab. Saving config changes triggers a fresh compilation.

Framework

Required. The project type:

  • Hardhat — uses npm install and npx hardhat compile by default.
  • Foundry — uses forge install and forge build by default.

This drives the defaults of the install and compile commands; if you override them explicitly, the framework choice doesn’t change behavior.

Project root

Optional. Defaults to ./ (the repository root).

Set this when your Hardhat or Foundry project lives in a subdirectory — for example, a monorepo where contracts live under packages/contracts/. The Stagenet runs install and compile commands from this directory.

See Working with monorepos for the multi-project case.

Install command

Optional. Defaults based on framework:

  • Hardhat: npm install
  • Foundry: forge install

Override when your project needs different install steps — for example yarn install, pnpm install, or a multi-step install like npm install && npm run prepare-contracts.

Compile command

Optional. Defaults based on framework:

  • Hardhat: npx hardhat compile
  • Foundry: forge build

Override when compilation is non-standard — for example a custom Hardhat task, profile flags (forge build --profile production), or pre-processing steps (npm run codegen && npx hardhat compile).

Environment variables

Optional. Key/value pairs available to your install and compile commands.

Use these for compiler config that’s normally pulled from .env files in local development — for example FOUNDRY_PROFILE, HARDHAT_NETWORK, or any custom variables your hardhat.config reads.

Artifact Selection (advanced)

Controls which compiled contracts the Stagenet imports as Workspaces. The defaults skip tests, scripts, mocks, libraries, and node_modules so your Workspaces stay focused on real contracts.

Both fields take one glob pattern per line.

Include patterns

Defaults:

contracts/**/*.sol src/**/*.sol

Override when your contracts live somewhere else (e.g. protocol/**/*.sol) or when you want to import a specific subset.

Exclude patterns

Defaults:

**/test/** **/tests/** **/script/** **/scripts/** **/mocks/** **/mock/** **/lib/** **/node_modules/** **/*.t.sol **/*.s.sol

The *.t.sol and *.s.sol patterns specifically catch Foundry test (Counter.t.sol) and script (Deploy.s.sol) files. Override when you actually do want to import test contracts (rare), or when the defaults skip something you need (e.g. you keep deployable contracts under lib/).

A contract is imported if its path matches an include pattern and does not match any exclude pattern.

Where this runs

The Stagenet clones your repository at the commit referenced by the push (or the default branch on initial setup), then runs install and compile commands inside an isolated build environment. Stdout, stderr, and exit status are captured and shown on the compilation page.

Last updated on