From 544f13273cc4f1adf517d5695dda0b6e196c6954 Mon Sep 17 00:00:00 2001 From: Radostina Lyubomirova Date: Tue, 3 Jun 2025 22:25:48 +0300 Subject: [PATCH] run test --- .github/workflows/ci-deploy.yml | 26 +++++++++++++++++++++++++- hardhat/hardhat.config.js | 5 +++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index ba482711ee..6a8b019b1c 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -34,7 +34,6 @@ jobs: working-directory: hardhat run: npx hardhat ignition deploy ./ignition/modules/Lock.js --network localhost - - name: Commit container as new image with contracts run: | docker commit geth-devnet ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts @@ -48,3 +47,28 @@ jobs: - name: Push new image run: docker push ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts + + ###################################### + # Step 4: Run tests against new image + ###################################### + + - name: Start devnet-with-contracts container + run: | + docker run -d --name geth-devnet-test -p 8545:8545 \ + ghcr.io/${{ github.repository_owner }}/go-ethereum:devnet-with-contracts \ + geth --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3 --dev + + - name: Wait for RPC to be ready + run: | + for i in {1..10}; do + curl -s http://localhost:8545 && break + echo "Waiting for Geth RPC for tests..." && sleep 3 + done + + - name: Reinstall Hardhat dependencies (for fresh context) + working-directory: hardhat + run: npm install + + - name: Run Hardhat tests against predeployed contracts + working-directory: hardhat + run: npx hardhat test --network localhost diff --git a/hardhat/hardhat.config.js b/hardhat/hardhat.config.js index b63f0c2f2e..a261e2c929 100644 --- a/hardhat/hardhat.config.js +++ b/hardhat/hardhat.config.js @@ -3,4 +3,9 @@ require("@nomicfoundation/hardhat-toolbox"); /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { solidity: "0.8.28", + networks: { + localhost: { + url: "http://127.0.0.1:8545" + } + } };