Skip to content

Commit 1ce1a17

Browse files
committed
ci: fix circular dependency in build stage
Signed-off-by: Tomás Migone <[email protected]>
1 parent cdf3fb4 commit 1ce1a17

File tree

7 files changed

+46
-7
lines changed

7 files changed

+46
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"postinstall": "husky install",
2323
"clean": "yarn workspaces foreach --all --parallel --verbose run clean",
2424
"clean:all": "yarn clean && rm -rf node_modules packages/*/node_modules",
25-
"build": "yarn workspaces foreach --all --verbose run build",
25+
"build": "chmod +x ./scripts/build && ./scripts/build",
2626
"lint": "yarn workspaces foreach --all --parallel --verbose run lint",
2727
"test": "yarn workspaces foreach --all --parallel --verbose --interlaced run test"
2828
},

packages/hardhat-graph-protocol/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"types": "dist/src/index.d.ts",
1818
"scripts": {
1919
"build": "tsc",
20+
"clean": "rm -rf dist",
2021
"lint": "eslint '**/*.{js,ts}' --fix",
2122
"test": "mocha --exit --recursive 'test/**/*.test.ts'",
2223
"prepublishOnly": "npm run build"

packages/horizon/hardhat.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import '@nomicfoundation/hardhat-ignition-ethers'
44
import 'hardhat-storage-layout'
55
import 'hardhat-contract-sizer'
66
import 'hardhat-secure-accounts'
7-
import 'hardhat-graph-protocol'
87

98
import type { HardhatUserConfig } from 'hardhat/config'
109

10+
if (process.env.BUILD_RUN !== 'true') {
11+
require('hardhat-graph-protocol')
12+
}
13+
1114
const config: HardhatUserConfig = {
1215
solidity: {
1316
version: '0.8.27',

packages/horizon/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"lint:ts": "eslint '**/*.{js,ts}' --fix",
1515
"lint:sol": "prettier --write contracts/**/*.sol && solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js",
1616
"lint": "yarn lint:ts && yarn lint:sol",
17-
"clean": "rm -rf build cache typechain-types",
18-
"build": "forge build && hardhat compile",
17+
"clean": "rm -rf build dist cache cache_forge typechain-types",
18+
"build": "forge build --skip test && SKIP_LOAD=true hardhat compile",
1919
"test": "forge test && hardhat test"
2020
},
2121
"devDependencies": {

packages/subgraph-service/hardhat.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import 'hardhat-contract-sizer'
55
import 'hardhat-storage-layout'
66
import 'hardhat-secure-accounts'
77
import 'solidity-docgen'
8-
import 'hardhat-graph-protocol'
98

109
import { HardhatUserConfig } from 'hardhat/config'
1110

11+
if (process.env.BUILD_RUN !== 'true') {
12+
require('hardhat-graph-protocol')
13+
}
14+
1215
const config: HardhatUserConfig = {
1316
solidity: {
1417
version: '0.8.27',

packages/subgraph-service/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"lint:ts": "eslint '**/*.{js,ts}' --fix",
1515
"lint:sol": "prettier --write contracts/**/*.sol && solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js",
1616
"lint": "yarn lint:ts && yarn lint:sol",
17-
"clean": "rm -rf build cache typechain-types",
18-
"build": "forge build && hardhat compile",
17+
"clean": "rm -rf build dist cache cache_forge typechain-types",
18+
"build": "forge build --skip test && SKIP_LOAD=true hardhat compile",
1919
"test": "forge test && hardhat test"
2020
},
2121
"devDependencies": {

scripts/build

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# List of packages to build - order matters!
4+
packages=(
5+
"packages/eslint-graph-config"
6+
# "packages/solhint-graph-config" -- disabled since it doesn't have a build script
7+
# "packages/solhint-plugin-graph" -- disabled since it doesn't have a build script
8+
"packages/contracts"
9+
"packages/horizon"
10+
"packages/subgraph-service"
11+
"packages/hardhat-graph-protocol"
12+
"packages/data-edge"
13+
"packages/sdk"
14+
"packages/token-distribution"
15+
)
16+
17+
for package in "${packages[@]}"; do
18+
echo -e "\n\n==== Building $package..."
19+
20+
cd "$package" || { echo "Failed to navigate to $package"; exit 1; }
21+
22+
if BUILD_RUN=true yarn build; then
23+
echo "Successfully built $package"
24+
else
25+
echo "Build failed for $package" >&2
26+
exit 1
27+
fi
28+
29+
cd - > /dev/null
30+
done
31+
32+
echo "All packages built successfully!"

0 commit comments

Comments
 (0)