From 7ba61dfbe0c38a583407483b67964286bba180b2 Mon Sep 17 00:00:00 2001 From: Nick DeLuca Date: Wed, 28 Aug 2024 23:51:43 +0000 Subject: [PATCH] chore: Finish e2e-evm continuous integration This refactors the e2e-evm tests to run in a single job with the hardhat network running first to fail fast and trigger any type errors. In addition, contracts used to test against kvtool may be unit testing only in the hardhat network, etc. In addition, a curl check is added to ensure the EVM JSON-RPC is serving requests. This endpoint can take ~30 seconds to come online after the kvtool server starts. Curl is configured to check every 5 seconds and retry 12 times over 60 seconds if the first request is not successful. Linting and formatting checks are also added via eslint, typescript-eslint with advanced type check rules, and prettier. Solhint is installed, but errors without any files so is not configured to run in CI yet. --- .github/workflows/ci-default.yml | 35 +++++++------------------------- .github/workflows/ci-lint.yml | 22 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci-default.yml b/.github/workflows/ci-default.yml index b71311e4d5..cb100aedf8 100644 --- a/.github/workflows/ci-default.yml +++ b/.github/workflows/ci-default.yml @@ -35,7 +35,7 @@ jobs: run: make test - name: run e2e tests run: make docker-build test-e2e - test-e2e-evm-hardhat: + test-e2e-evm: runs-on: ubuntu-latest steps: - name: Checkout current commit @@ -58,29 +58,9 @@ jobs: - name: Install npm dependencies run: npm install working-directory: tests/e2e-evm - - name: Run hardhat test suite - run: npx hardhat test --network hardhat + - name: Run test suite against hardhat network + run: npm run test-hardhat working-directory: tests/e2e-evm - test-e2e-evm-kvtool: - runs-on: ubuntu-latest - steps: - - name: Checkout current commit - uses: actions/checkout@v4 - with: - submodules: true - - name: Setup nodejs - uses: actions/setup-node@v3 - with: - cache: npm - node-version-file: .tool-versions - cache-dependency-path: tests/e2e-evm/package-lock.json - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version-file: go.mod - cache-dependency-path: | - go.sum - tests/e2e/kvtool/go.sum - name: Build local image run: make docker-build - name: Install kvtool @@ -89,11 +69,10 @@ jobs: run: kvtool testnet gen-config kava --kava.configTemplate $(sed -nr "s/E2E_KVTOOL_KAVA_CONFIG_TEMPLATE=\"(.*)\"/\1/p" tests/e2e/.env) - name: Start kava chain run: kvtool testnet up -d - - name: Install npm dependencies - run: npm install - working-directory: tests/e2e-evm - - name: Run hardhat test suite - run: npx hardhat test --network kvtool + - name: Wait for JSON RPC to start + run: "curl --retry-all-errors --retry 12 --retry-delay 5 -X POST -H \"Content-Type: application/json\" http://127.0.0.1:8545" + - name: Run test suite against kvtool network + run: npm run test-kvtool working-directory: tests/e2e-evm - name: Shutdown kava if: always() diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 6580586c80..9678d93032 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -29,3 +29,25 @@ jobs: with: version: ${{ env.GOLANGCI_VERSION }} args: -v -c .golangci.yml --new-from-rev ${{ env.REV }} + e2e-evm-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout current commit + uses: actions/checkout@v4 + with: + submodules: true + - name: Setup nodejs + uses: actions/setup-node@v3 + with: + cache: npm + node-version-file: .tool-versions + cache-dependency-path: tests/e2e-evm/package-lock.json + - name: Install npm dependencies + run: npm install + working-directory: tests/e2e-evm + - name: Run linter + run: npm run lint + working-directory: tests/e2e-evm + - name: Run formatter + run: npm run prettier + working-directory: tests/e2e-evm