Skip to content

Commit

Permalink
ci: fix circular dependency in build stage
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Migone <[email protected]>
  • Loading branch information
tmigone committed Nov 26, 2024
1 parent cdf3fb4 commit 1ce1a17
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"postinstall": "husky install",
"clean": "yarn workspaces foreach --all --parallel --verbose run clean",
"clean:all": "yarn clean && rm -rf node_modules packages/*/node_modules",
"build": "yarn workspaces foreach --all --verbose run build",
"build": "chmod +x ./scripts/build && ./scripts/build",
"lint": "yarn workspaces foreach --all --parallel --verbose run lint",
"test": "yarn workspaces foreach --all --parallel --verbose --interlaced run test"
},
Expand Down
1 change: 1 addition & 0 deletions packages/hardhat-graph-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"types": "dist/src/index.d.ts",
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"lint": "eslint '**/*.{js,ts}' --fix",
"test": "mocha --exit --recursive 'test/**/*.test.ts'",
"prepublishOnly": "npm run build"
Expand Down
5 changes: 4 additions & 1 deletion packages/horizon/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import '@nomicfoundation/hardhat-ignition-ethers'
import 'hardhat-storage-layout'
import 'hardhat-contract-sizer'
import 'hardhat-secure-accounts'
import 'hardhat-graph-protocol'

import type { HardhatUserConfig } from 'hardhat/config'

if (process.env.BUILD_RUN !== 'true') {
require('hardhat-graph-protocol')
}

const config: HardhatUserConfig = {
solidity: {
version: '0.8.27',
Expand Down
4 changes: 2 additions & 2 deletions packages/horizon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"lint:ts": "eslint '**/*.{js,ts}' --fix",
"lint:sol": "prettier --write contracts/**/*.sol && solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js",
"lint": "yarn lint:ts && yarn lint:sol",
"clean": "rm -rf build cache typechain-types",
"build": "forge build && hardhat compile",
"clean": "rm -rf build dist cache cache_forge typechain-types",
"build": "forge build --skip test && SKIP_LOAD=true hardhat compile",
"test": "forge test && hardhat test"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion packages/subgraph-service/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import 'hardhat-contract-sizer'
import 'hardhat-storage-layout'
import 'hardhat-secure-accounts'
import 'solidity-docgen'
import 'hardhat-graph-protocol'

import { HardhatUserConfig } from 'hardhat/config'

if (process.env.BUILD_RUN !== 'true') {
require('hardhat-graph-protocol')
}

const config: HardhatUserConfig = {
solidity: {
version: '0.8.27',
Expand Down
4 changes: 2 additions & 2 deletions packages/subgraph-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"lint:ts": "eslint '**/*.{js,ts}' --fix",
"lint:sol": "prettier --write contracts/**/*.sol && solhint --noPrompt --fix contracts/**/*.sol --config node_modules/solhint-graph-config/index.js",
"lint": "yarn lint:ts && yarn lint:sol",
"clean": "rm -rf build cache typechain-types",
"build": "forge build && hardhat compile",
"clean": "rm -rf build dist cache cache_forge typechain-types",
"build": "forge build --skip test && SKIP_LOAD=true hardhat compile",
"test": "forge test && hardhat test"
},
"devDependencies": {
Expand Down
32 changes: 32 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# List of packages to build - order matters!
packages=(
"packages/eslint-graph-config"
# "packages/solhint-graph-config" -- disabled since it doesn't have a build script
# "packages/solhint-plugin-graph" -- disabled since it doesn't have a build script
"packages/contracts"
"packages/horizon"
"packages/subgraph-service"
"packages/hardhat-graph-protocol"
"packages/data-edge"
"packages/sdk"
"packages/token-distribution"
)

for package in "${packages[@]}"; do
echo -e "\n\n==== Building $package..."

cd "$package" || { echo "Failed to navigate to $package"; exit 1; }

if BUILD_RUN=true yarn build; then
echo "Successfully built $package"
else
echo "Build failed for $package" >&2
exit 1
fi

cd - > /dev/null
done

echo "All packages built successfully!"

0 comments on commit 1ce1a17

Please sign in to comment.