From 932fa69eea01e694936024c2e7c3dd7137abdf09 Mon Sep 17 00:00:00 2001 From: Marco Tabasco Date: Mon, 6 May 2024 00:03:24 +0200 Subject: [PATCH] test fix CI --- .github/workflows/tests-forked.yaml | 2 +- hardhat.config.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests-forked.yaml b/.github/workflows/tests-forked.yaml index 656ce3b2..3a2b419f 100644 --- a/.github/workflows/tests-forked.yaml +++ b/.github/workflows/tests-forked.yaml @@ -5,7 +5,7 @@ on: [push] jobs: ci: runs-on: ubuntu-latest - name: Hardhat unit test + name: Hardhat unit test (forked network) env: # Set environment variables for all steps in this job GH_TOKEN: ${{ secrets.github_token }} FORK_TESTING_ENABLED: true diff --git a/hardhat.config.ts b/hardhat.config.ts index 0b3d97df..6c25e64b 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -49,11 +49,6 @@ const config: HardhatUserConfig = { ssvToken: process.env.SSVTOKEN_ADDRESS, // if empty, deploy SSV mock token } as SSVNetworkConfig, hardhat: { - forking: { - enabled: process.env.FORK_TESTING_ENABLED === 'true', - url: process.env.MAINNET_ETH_NODE_URL, - blockNumber: 19621100, - }, allowUnlimitedContractSize: true, gas: 5000000, }, @@ -144,4 +139,18 @@ if (process.env.MAINNET_ETH_NODE_URL) { }; } +if (process.env.FORK_TESTING_ENABLED) { + config.networks = { + ...config.networks, + hardhat: { + ...config.networks?.hardhat, + forking: { + enabled: process.env.FORK_TESTING_ENABLED === 'true', + url: process.env.MAINNET_ETH_NODE_URL ? process.env.MAINNET_ETH_NODE_URL : '', + blockNumber: 19621100, + }, + }, + }; +} + export default config;