From 8fdd21d0af554227d4d4169c7bc71cf96be3ba10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Fri, 2 Feb 2024 15:55:31 +0100 Subject: [PATCH 1/5] chore: remove unused env vars --- .github/workflows/frontend:erc20-messaging.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/frontend:erc20-messaging.yml b/.github/workflows/frontend:erc20-messaging.yml index 8134414..153fd78 100644 --- a/.github/workflows/frontend:erc20-messaging.yml +++ b/.github/workflows/frontend:erc20-messaging.yml @@ -144,9 +144,6 @@ jobs: VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ env.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }} VITE_TOPOS_SUBNET_ENDPOINT_WS: ${{ vars.TOPOS_SUBNET_ENDPOINT_WS }} VITE_TOPOS_SUBNET_ENDPOINT_HTTP: ${{ vars.TOPOS_SUBNET_ENDPOINT_HTTP }} - VITE_ELASTIC_APM_ENDPOINT: ${{ secrets.ELASTIC_APM_ENDPOINT }} - VITE_TRACING_SERVICE_NAME: ${{ vars.TRACING_SERVICE_NAME }} - VITE_TRACING_SERVICE_VERSION: ${{ vars.TRACING_SERVICE_VERSION }} - name: Debug docker show infra containers if: failure() From 4393b935716573c43319081f2786b764e304f806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Fri, 2 Feb 2024 15:55:38 +0100 Subject: [PATCH 2/5] feat: add faucet e2e test --- .github/workflows/frontend:faucet.yml | 157 ++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 .github/workflows/frontend:faucet.yml diff --git a/.github/workflows/frontend:faucet.yml b/.github/workflows/frontend:faucet.yml new file mode 100644 index 0000000..ce3cf93 --- /dev/null +++ b/.github/workflows/frontend:faucet.yml @@ -0,0 +1,157 @@ +name: Frontend Faucet + +on: + pull_request: + branches: + - main + workflow_dispatch: + inputs: + local-erc20-messaging-infra-ref: + description: "Git ref of local-erc20-messaging-infra" + required: false + faucet-ref: + description: "Git ref of faucet" + required: false + topos-docker-tag: + description: "Docker tag of topos" + required: false + topos-smart-contracts-docker-tag: + description: "Docker tag of topos-smart-contracts" + required: false + +env: + TOPOS_DOCKER_TAG: ${{ inputs.topos-docker-tag || 'latest' }} + CONTRACTS_DOCKER_TAG: ${{ inputs.topos-smart-contracts-docker-tag || 'latest' }} + +jobs: + infra-metadata: + uses: ./.github/workflows/util:get-latest-release.yml + with: + organization: topos-protocol + repository: local-erc20-messaging-infra + + faucet-metadata: + uses: ./.github/workflows/util:get-latest-release.yml + with: + organization: topos-protocol + repository: faucet + + e2e: + runs-on: ubuntu-latest-16-core + environment: devnet-1 + env: + INFRA_REF: ${{ inputs.local-erc20-messaging-infra-ref || needs.infra-metadata.outputs.latest-release }} + FAUCET_REF: ${{ inputs.faucet-ref || needs.faucet-metadata.outputs.latest-release }} + needs: + - infra-metadata + - faucet-metadata + steps: + - name: Display stack component versions + run: | + echo "infra ref: ${{ env.INFRA_REF }}" + echo "faucet ref: ${{ env.FAUCET_REF }}" + echo "topos docker tag: ${{ env.TOPOS_DOCKER_TAG }}" + echo "contracts docker tag: ${{ env.CONTRACTS_DOCKER_TAG }}" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Checkout local-erc20-messaging-infra repo + uses: actions/checkout@v3 + with: + repository: topos-protocol/local-erc20-messaging-infra + ref: ${{ env.INFRA_REF }} + path: infra + + - name: Start local ERC20 messaging infra containers + run: > + cd infra && + docker compose up -d + env: + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }} + TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }} + TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }} + ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }} + SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }} + TOPOS_VERSION: ${{ env.TOPOS_DOCKER_TAG }} + TOPOS_MESSAGING_PROTOCOL_CONTRACTS_VERSION: ${{ env.CONTRACTS_DOCKER_TAG }} + + - name: Debug containers + if: failure() + run: docker inspect contracts-topos | grep Image && docker logs contracts-topos + + - name: Get contracts .env file and expose contract addresses for faucet + run: | + mkdir ./contracts + docker cp contracts-topos:/contracts/.env ./contracts/.env + source ./contracts/.env + echo "SUBNET_REGISTRATOR_CONTRACT_ADDRESS=${SUBNET_REGISTRATOR_CONTRACT_ADDRESS}" >> $GITHUB_ENV + echo "TOPOS_CORE_PROXY_CONTRACT_ADDRESS=${TOPOS_CORE_PROXY_CONTRACT_ADDRESS}" >> $GITHUB_ENV + + - name: Checkout faucet repo + uses: actions/checkout@v3 + with: + repository: topos-protocol/faucet + ref: ${{ env.FAUCET_REF }} + path: faucet + + - name: Run e2e tests + run: > + cd faucet && + npm run test:e2e + env: + CYPRESS_REMOTE_DEBUGGING_PORT: ${{ vars.CYPRESS_REMOTE_DEBUGGING_PORT }} + PORT: 3002 + AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }} + AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} + AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} + AUTH0_ISSUER_URL: ${{ secrets.AUTH0_ISSUER_URL }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ env.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }} + VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ env.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }} + VITE_TOPOS_SUBNET_ENDPOINT_WS: ${{ vars.TOPOS_SUBNET_ENDPOINT_WS }} + VITE_TOPOS_SUBNET_ENDPOINT_HTTP: ${{ vars.TOPOS_SUBNET_ENDPOINT_HTTP }} + + - name: Debug docker show infra containers + if: failure() + run: docker ps + + - name: Debug sending sequencer + if: failure() + run: docker logs topos-sequencer + + - name: Debug receiving sequencer + if: failure() + run: docker logs incal-sequencer + + - name: Debug topos node 1 + if: failure() + run: docker logs topos-node-1 + + - name: Debug topos node 2 + if: failure() + run: docker logs topos-node-2 + + - name: Debug topos node 3 + if: failure() + run: docker logs topos-node-3 + + - name: Debug topos node 4 + if: failure() + run: docker logs topos-node-4 + + - name: Debug incal node 1 + if: failure() + run: docker logs incal-node-1 From 1f551d105e4c78cb456544dd503f6675d4fe2a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Fri, 2 Feb 2024 18:13:35 +0100 Subject: [PATCH 3/5] fix: add missing env vars --- .github/workflows/frontend:faucet.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/frontend:faucet.yml b/.github/workflows/frontend:faucet.yml index ce3cf93..d64e559 100644 --- a/.github/workflows/frontend:faucet.yml +++ b/.github/workflows/frontend:faucet.yml @@ -107,10 +107,23 @@ jobs: ref: ${{ env.FAUCET_REF }} path: faucet + - name: Install dependencies + working-directory: faucet + run: npm ci + + - name: Build frontend + working-directory: faucet/frontend + run: npm run frontend:build + env: + VITE_RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }} + VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ env.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }} + VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ env.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }} + VITE_TOPOS_SUBNET_ENDPOINT_HTTP: ${{ vars.TOPOS_SUBNET_ENDPOINT_HTTP }} + VITE_TOPOS_SUBNET_ENDPOINT_WS: ${{ vars.TOPOS_SUBNET_ENDPOINT_WS }} + - name: Run e2e tests - run: > - cd faucet && - npm run test:e2e + working-directory: faucet + run: npm run test:e2e env: CYPRESS_REMOTE_DEBUGGING_PORT: ${{ vars.CYPRESS_REMOTE_DEBUGGING_PORT }} PORT: 3002 @@ -119,10 +132,8 @@ jobs: AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }} AUTH0_ISSUER_URL: ${{ secrets.AUTH0_ISSUER_URL }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - VITE_SUBNET_REGISTRATOR_CONTRACT_ADDRESS: ${{ env.SUBNET_REGISTRATOR_CONTRACT_ADDRESS }} - VITE_TOPOS_CORE_PROXY_CONTRACT_ADDRESS: ${{ env.TOPOS_CORE_PROXY_CONTRACT_ADDRESS }} - VITE_TOPOS_SUBNET_ENDPOINT_WS: ${{ vars.TOPOS_SUBNET_ENDPOINT_WS }} - VITE_TOPOS_SUBNET_ENDPOINT_HTTP: ${{ vars.TOPOS_SUBNET_ENDPOINT_HTTP }} + THROTTLER_TTL_SECONDS: ${{ vars.THROTTLER_TTL_SECONDS }} + - name: Debug docker show infra containers if: failure() From f028f5ea14354b332f63f8dfd4ec49624da921d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Fri, 2 Feb 2024 18:22:46 +0100 Subject: [PATCH 4/5] fix: update working dir for build step --- .github/workflows/frontend:faucet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend:faucet.yml b/.github/workflows/frontend:faucet.yml index d64e559..85ac60f 100644 --- a/.github/workflows/frontend:faucet.yml +++ b/.github/workflows/frontend:faucet.yml @@ -112,7 +112,7 @@ jobs: run: npm ci - name: Build frontend - working-directory: faucet/frontend + working-directory: faucet run: npm run frontend:build env: VITE_RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }} From e6a7c1cf11a343ce33fa5696d1a12374418e6558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Fri, 2 Feb 2024 18:29:32 +0100 Subject: [PATCH 5/5] chore: update github-script action to remove nodejs deprecation warnings --- .github/workflows/util:get-latest-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/util:get-latest-release.yml b/.github/workflows/util:get-latest-release.yml index 997695c..41d597b 100644 --- a/.github/workflows/util:get-latest-release.yml +++ b/.github/workflows/util:get-latest-release.yml @@ -22,7 +22,7 @@ jobs: outputs: latest-release: ${{ steps.script.outputs.result }} steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 id: script with: result-encoding: string