From adfa564ca90169cd92ace43c488a0991a976cdc0 Mon Sep 17 00:00:00 2001 From: denislav-mladenov Date: Thu, 18 Jul 2024 12:22:16 +0300 Subject: [PATCH] Testing deployment --- .github/workflows/.2.yml.swo | Bin 0 -> 4096 bytes .github/workflows/.2.yml.swp | Bin 0 -> 4096 bytes .github/workflows/3.yml | 86 +++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 .github/workflows/.2.yml.swo create mode 100644 .github/workflows/.2.yml.swp create mode 100644 .github/workflows/3.yml diff --git a/.github/workflows/.2.yml.swo b/.github/workflows/.2.yml.swo new file mode 100644 index 0000000000000000000000000000000000000000..deff803f558e1a4b9aeabb19e021fc845b66db8b GIT binary patch literal 4096 zcmYc?2=nw+u+TGP00IF9hIbccq-i{3V`ySwU?|GZF98V?0^zy=ZpJ>Q9^PO>aI4n$ z$;?f4&PdG63rQ@_)=$sZO)betElMrT)z?eUEXgQM(l5_1%1+D4FE7?N(yPqP!EM&4 z%xDOVh5)G{z{_B4WM}}=rL3f=AS@J0ssW?wM?+vV1V%$(Gz3ONU^E0qLtr!nMnhmU J1cq=3008m&A7B6g literal 0 HcmV?d00001 diff --git a/.github/workflows/.2.yml.swp b/.github/workflows/.2.yml.swp new file mode 100644 index 0000000000000000000000000000000000000000..09c856b4099b1000302becc13799eb1513a08f59 GIT binary patch literal 4096 zcmYc?2=nw+u+TGP00IF9hIbccq-i{3V=!Z3U?|GZF98V?0^zy=ZpJ>Q9^PO>aI4n$ z$;?f4&PdG63rQ@_)=$sZO)betElMrT)z?eUEXgQM(l5_1%1+D4FE7?N(yPqP!EM&4 z%xDOVh5)G{z{_B4WM}}=rL3f=AS@J0ssW?wM?+vV1V%$(Gz3ONU^E0qLtr!nMnhmU J1cq=30021N9~1xp literal 0 HcmV?d00001 diff --git a/.github/workflows/3.yml b/.github/workflows/3.yml new file mode 100644 index 0000000000..80659f8df2 --- /dev/null +++ b/.github/workflows/3.yml @@ -0,0 +1,86 @@ +name: deploy-hardhat + +on: + pull_request: + branches: [ "master" ] + types: [ labeled ] + + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: denislav-mladenov/go-ethereum + +jobs: + deploy-hardhat: + if: github.event.label.name == 'CI:Deploy' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Pull image + run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + + - name: Running image container + run: | + echo "Workspace path: /workspace/hardhat" + docker run -d --name go-ethereum -p 8545:8545 -p 8546:8546 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ + --dev \ + --http \ + --http.addr 0.0.0.0 \ + --http.port 8545 \ + --http.corsdomain "*" \ + --http.api personal,db,eth,net,web3 \ + --ws \ + --ws.addr 0.0.0.0 \ + --ws.port 8546 \ + --ws.origins "*" \ + --ws.api personal,db,eth,net,web3 + + - name: Copying the hardhat files to the container + run: | + docker exec go-ethereum mkdir -p /workspace/hardhat + docker cp ${{ github.workspace }}/hardhat go-ethereum:/workspace/hardhat + docker exec go-ethereum ls -larth /workspace/hardhat + + - name: Installing the required Node.js and npm + run: | + docker exec go-ethereum apk add --no-cache nodejs npm + + - name: Installation of hardhat + run: docker exec go-ethereum sh -c "cd /workspace/hardhat && npm install --save-dev hardhat && npm install ethers@5" + + - name: Checking the hardhat version to verify that its working properly + run: docker exec go-ethereum npx hardhat --version + + - name: Deploy hardhat sample project + run: | + docker exec go-ethereum npx hardhat ignition deploy ./ignition/modules/Token.js --network devnet + + - name: Testing contracts + run: | + docker exec go-ethereum sh -c "cd /workspace/hardhat && npx hardhat test" + + - name: Build a new docker image + run: | + docker commit go-ethereum go-eth-hardhat:latest + docker tag go-eth-hardhat:latest ${{ env.REGISTRY }}/${{ github.repository_owner }}/go-eth-hardhat:latest + + - name: Push new image to ghcr.io + run: docker push ${{ env.REGISTRY }}/${{ github.repository_owner }}/go-eth-hardhat:latest +