Skip to content

Commit 32fd0e5

Browse files
committed
Run tests on hardhat network (forked)
1 parent 0c2f2e7 commit 32fd0e5

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

.github/workflows/sharing-smart-contract-test.yml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,15 @@ jobs:
6363
fail-on: none
6464
target: 'packages/sharing-smart-contract/'
6565

66-
- name: Start Anvil
67-
run: |
68-
anvil --host 0.0.0.0 --port 8545 --hardfork berlin --fork-url https://bellecour.iex.ec --chain-id 134 --gas-limit 6700000 --gas-price 0 &
69-
70-
- name: Wait for Anvil to start
71-
run: |
72-
timeout=30
73-
interval=1
74-
echo "Waiting for Anvil to start..."
75-
for ((i=0; i<timeout; i++)); do
76-
if nc -z localhost 8545; then
77-
echo "Anvil is operational."
78-
exit 0
79-
fi
80-
echo "Attempt $((i+1)) of $timeout: Anvil is not ready, waiting ${interval}s..."
81-
sleep $interval
82-
done
83-
echo "Error: Anvil did not start within the timeout period."
84-
exit 1
85-
8666
# TODO check why the CI does not fail when the following error occurs:
8767
# 1) Uncaught error outside test suite
8868
- name: Hardhat Tests
8969
working-directory: packages/sharing-smart-contract
90-
# TODO run tests on hardhat forked network without using anvil.
91-
run: npm run test -- --network ci-bellecour-fork
70+
run: npm run test # runs on local forked hardhat network
9271

9372
- name: Upgrade Test
9473
working-directory: packages/sharing-smart-contract
95-
run: npm run upgrade-local-fork -- --network local-bellecour-fork
74+
run: npm run upgrade-local-fork
9675

9776
- name: Set Directory Permissions
9877
working-directory: packages/sharing-smart-contract

packages/sharing-smart-contract/hardhat.config.cjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ module.exports = {
2929
},
3030
},
3131
'local-bellecour-fork': {
32-
...bellecourBase,
33-
url: 'http://127.0.0.1:8545',
34-
},
35-
'ci-bellecour-fork': {
3632
...bellecourBase,
3733
url: 'http://localhost:8545',
3834
},

0 commit comments

Comments
 (0)