Skip to content

Commit 8fed9da

Browse files
committed
fix: update CI workflow to include genesis block retrieval and health checks for Graph Node
1 parent c11ac45 commit 8fed9da

File tree

2 files changed

+41
-23
lines changed

2 files changed

+41
-23
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
ports:
4242
- 8080:8080
4343
- 5001:5001
44-
44+
4545
blockchain-fork:
4646
image: ghcr.io/foundry-rs/foundry:v1.0.0
4747
ports:
@@ -64,28 +64,7 @@ jobs:
6464
--chain-id 134
6565
--gas-limit 6700000
6666
--gas-price 0
67-
68-
graphnode:
69-
image: graphprotocol/graph-node:v0.37.0
70-
ports:
71-
- 8000:8000
72-
- 8020:8020
73-
env:
74-
postgres_host: graphnode-postgres
75-
postgres_port: 5432
76-
postgres_user: graphnode
77-
postgres_pass: password
78-
postgres_db: graphnode-db
79-
ipfs: ipfs:5001
80-
ethereum: bellecour:http://blockchain-fork:8545
81-
GRAPH_ETHEREUM_GENESIS_BLOCK_NUMBER: 33334802
82-
options: >-
83-
--health-cmd "netcat -w 1 localhost 8020"
84-
--health-interval 10s
85-
--health-timeout 5s
86-
--health-retries 5
87-
--health-start-period 30s
88-
67+
8968
steps:
9069
- name: Checkout
9170
uses: actions/checkout@v4
@@ -112,6 +91,44 @@ jobs:
11291
id: prepare
11392
run: npx tsx test/scripts/prepare-test-env.ts
11493

94+
- name: Fetch genesis block number
95+
id: fetch_block
96+
run: |
97+
BLOCK_NUMBER=$(cat /local-stack-env/FORK_BLOCK)
98+
echo "BLOCK=$BLOCK_NUMBER" >> $GITHUB_OUTPUT
99+
100+
- name: Start Graph Node
101+
run: |
102+
docker run -d \
103+
--name graphnode \
104+
--network graphnet \
105+
-p 8000:8000 \
106+
-p 8020:8020 \
107+
-e POSTGRES_HOST=graphnode-postgres \
108+
-e POSTGRES_PORT=5432 \
109+
-e POSTGRES_USER=graphnode \
110+
-e POSTGRES_PASSWORD=password \
111+
-e POSTGRES_DB=graphnode-db \
112+
-e IPFS=ipfs:5001 \
113+
-e ETHEREUM=bellecour:http://blockchain-fork:8545 \
114+
-e GRAPH_ETHEREUM_GENESIS_BLOCK_NUMBER="${{ steps.fetch_block.outputs.BLOCK }}" \
115+
--health-cmd "nc -w 1 localhost 8020" \
116+
--health-interval 10s \
117+
--health-timeout 5s \
118+
--health-retries 5 \
119+
--health-start-period 30s \
120+
graphprotocol/graph-node:v0.37.0
121+
122+
- name: Wait for services
123+
run: |
124+
# Wait for blockchain-fork to be ready
125+
echo "Waiting for blockchain-fork to be ready..."
126+
timeout 60 bash -c 'until (echo >/dev/tcp/localhost/8545) &>/dev/null; do sleep 2; done'
127+
128+
# Wait for graph-node to be ready
129+
echo "Waiting for graph-node to be ready..."
130+
timeout 60 bash -c 'until curl -s http://localhost:8020/graphql > /dev/null; do sleep 2; done'
131+
115132
- name: Build and run subgraph deployer
116133
run: |
117134
cd test-stack

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ subgraph.test.yaml
66
test-stack/.env
77
tests/.bin
88
tests/.latest.json
9+
.idea

0 commit comments

Comments
 (0)