Test contracts

This commit is contained in:
Dimitar Manov 2025-06-11 13:51:19 +03:00
parent 84d1f51edb
commit 303f8eee31
2 changed files with 22 additions and 6 deletions

View file

@ -39,11 +39,7 @@ jobs:
- name: Deploy Contracts - name: Deploy Contracts
working-directory: ./hardhat working-directory: ./hardhat
run: npx hardhat ignition deploy ./ignition/modules/Lock.ts --network localhost run: npx hardhat ignition deploy ./ignition/modules/Lock.ts --network local
- name: Test Contracts
working-directory: ./hardhat
run: npx hardhat test test/Lock.ts --network localhost
- name: Autotag - name: Autotag
id: autotag id: autotag
@ -78,3 +74,19 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-latest,${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-${{ steps.autotag.outputs.tag }} tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-latest,${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-${{ steps.autotag.outputs.tag }}
labels: ${{ steps.metadata.outputs.labels }} labels: ${{ steps.metadata.outputs.labels }}
- name: Start Geth Devnet
run: |
docker run -it --rm 
-p 8546:8545
-p 30303:30303
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPO_NAME }}:${{ env.ENVIRONMENT }}-contracts-latest
--dev \
--http --http.addr 0.0.0.0
--http.api eth,net,web3,personal
--allow-insecure-unlock
echo "Waiting for Geth JSON-RPC..."
until curl -s http://localhost:8546; do sleep 1; done
- name: Test Contracts
working-directory: ./hardhat
run: npx hardhat test test/Lock.ts --network localcontracts

View file

@ -4,10 +4,14 @@ import "@nomicfoundation/hardhat-toolbox";
const config: HardhatUserConfig = { const config: HardhatUserConfig = {
solidity: "0.8.28", solidity: "0.8.28",
networks: { networks: {
localhost: { local: {
url: "http://127.0.0.1:8545", url: "http://127.0.0.1:8545",
chainId: 1337 chainId: 1337
}, },
localcontracts: {
url: "http://127.0.0.1:8546",
chainId: 1337
},
node: { node: {
url: "http:127.0.0.1:8545", url: "http:127.0.0.1:8545",
chainId: 31337 chainId: 31337