diff --git a/.github/workflows/solidity.yml b/.github/workflows/solidity.yml index 9e8c807f31..3d41291c8b 100644 --- a/.github/workflows/solidity.yml +++ b/.github/workflows/solidity.yml @@ -267,7 +267,9 @@ jobs: - name: Run tests and generate gas report working-directory: './packages/${{matrix.package}}' # Run separate set of tests (no fuzzing) to get accurate average gas cost estimates - run: forge test --mc GasBenchmark --gas-report > "../../gas-report-${{ matrix.package }}.ansi" + # Note: we use `npm run` with `--if-present` flag, allows not to define a gas:bench script in every package + # This is not natively supported by yarn yet, see: https://github.com/yarnpkg/yarn/pull/7159 + run: npm run gas:bench --if-present > "../../gas-report-${{ matrix.package }}.ansi" - name: Compare gas reports uses: Rubilmax/foundry-gas-diff@v3.18 diff --git a/packages/contracts-rfq/package.json b/packages/contracts-rfq/package.json index 09d3dd387e..715fcf5152 100644 --- a/packages/contracts-rfq/package.json +++ b/packages/contracts-rfq/package.json @@ -20,6 +20,7 @@ "build:slither": "forge build --out=out --build-info --force", "test:coverage": "echo 'Please use foundry'", "test": "forge test", + "gas:bench": "forge test --mc GasBenchmark --gas-report", "lint": "forge fmt && npm run solhint", "lint:check": "forge fmt --check && npm run solhint:check", "ci:lint": "npm run lint:check",