Skip to content

Commit ad9ff43

Browse files
committed
Fix CI
1 parent 32fd0e5 commit ad9ff43

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,34 @@ 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+
- name: Wait for Anvil to start
70+
run: |
71+
timeout=30
72+
interval=1
73+
echo "Waiting for Anvil to start..."
74+
for ((i=0; i<timeout; i++)); do
75+
if nc -z localhost 8545; then
76+
echo "Anvil is operational."
77+
exit 0
78+
fi
79+
echo "Attempt $((i+1)) of $timeout: Anvil is not ready, waiting ${interval}s..."
80+
sleep $interval
81+
done
82+
echo "Error: Anvil did not start within the timeout period."
83+
exit 1
84+
6685
# TODO check why the CI does not fail when the following error occurs:
6786
# 1) Uncaught error outside test suite
6887
- name: Hardhat Tests
6988
working-directory: packages/sharing-smart-contract
70-
run: npm run test # runs on local forked hardhat network
89+
run: npm run test -- --network bellecour-fork # runs on local forked hardhat network
7190

7291
- name: Upgrade Test
7392
working-directory: packages/sharing-smart-contract
74-
run: npm run upgrade-local-fork
93+
run: npm run upgrade-local-fork -- --network bellecour-fork
7594

7695
- name: Set Directory Permissions
7796
working-directory: packages/sharing-smart-contract

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ const bellecourBase = {
1717
* @type import('hardhat/config').HardhatUserConfig
1818
*/
1919
module.exports = {
20-
// run `npx hardhat node` to start the forked bellecour node "local-bellecour-fork"
21-
defaultNetwork: 'local-bellecour-fork',
20+
// run `npx hardhat node` to start the forked bellecour node "bellecour-fork"
2221
networks: {
2322
hardhat: {
2423
...bellecourBase,
@@ -28,7 +27,7 @@ module.exports = {
2827
url: 'https://bellecour.iex.ec',
2928
},
3029
},
31-
'local-bellecour-fork': {
30+
'bellecour-fork': {
3231
...bellecourBase,
3332
url: 'http://localhost:8545',
3433
},

0 commit comments

Comments
 (0)