From 9a79d47ac2e1b7d6600de81c3ed3c6c1890a3e33 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev <16622558+mmv08@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:21:52 +0100 Subject: [PATCH] Add an e2e test that uses upstream bundler --- .github/workflows/ci_4337.yml | 1 + .../workflows/ci_4337_upstream_bundler.yml | 21 +++++++++++++++++++ modules/4337/docker-compose.yaml | 11 ++++++++++ modules/4337/docker/bundler/Dockerfile | 3 ++- modules/4337/package.json | 1 + modules/4337/test/e2e/run.sh | 8 ++++++- 6 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci_4337_upstream_bundler.yml diff --git a/.github/workflows/ci_4337.yml b/.github/workflows/ci_4337.yml index a7fad27ad..57bdf6d29 100644 --- a/.github/workflows/ci_4337.yml +++ b/.github/workflows/ci_4337.yml @@ -31,6 +31,7 @@ jobs: - run: | npm ci npm run test:e2e -w modules/4337 + lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/ci_4337_upstream_bundler.yml b/.github/workflows/ci_4337_upstream_bundler.yml new file mode 100644 index 000000000..06d05e20a --- /dev/null +++ b/.github/workflows/ci_4337_upstream_bundler.yml @@ -0,0 +1,21 @@ +name: 4337 Module End-to-End Tests With Upstream Bundler +on: + schedule: + # * is a special character in YAML so you have to quote this string + # There's no direct way to schedule the job run every 2 weeks, instead we schedule it on the 1st and 15th of every month. The trick is taken from https://stackoverflow.com/a/46233330/7820085 + - cron: '30 1 1,15 * *' + push: + +jobs: + e2e-upstream-bundler: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 20.x + cache: npm + cache-dependency-path: package-lock.json + - run: | + npm ci + npm run test:e2e:upstream -w modules/4337 diff --git a/modules/4337/docker-compose.yaml b/modules/4337/docker-compose.yaml index 0d189872f..fee33d682 100644 --- a/modules/4337/docker-compose.yaml +++ b/modules/4337/docker-compose.yaml @@ -22,3 +22,14 @@ services: command: ['--auto', '--network=http://geth:8545'] ports: - 3000:3000 + + bundler-upstream: + build: + context: . + dockerfile: docker/bundler/Dockerfile + args: + TAG: main + restart: always + command: ['--auto', '--network=http://geth:8545'] + ports: + - 3000:3000 diff --git a/modules/4337/docker/bundler/Dockerfile b/modules/4337/docker/bundler/Dockerfile index 6dec50a66..a011d0e7e 100644 --- a/modules/4337/docker/bundler/Dockerfile +++ b/modules/4337/docker/bundler/Dockerfile @@ -1,8 +1,9 @@ FROM docker.io/library/node:18 +ARG TAG=v0.6.1 RUN git clone https://github.com/eth-infinitism/bundler /src/bundler WORKDIR /src/bundler -RUN git checkout v0.6.1 +RUN git checkout ${TAG} RUN yarn && yarn preprocess ENTRYPOINT ["yarn", "bundler"] diff --git a/modules/4337/package.json b/modules/4337/package.json index 0aad20cd0..2dba52fc6 100644 --- a/modules/4337/package.json +++ b/modules/4337/package.json @@ -18,6 +18,7 @@ "build:ts": "npx rimraf dist && tsc", "test": "hardhat test --deploy-fixture", "test:e2e": "./test/e2e/run.sh", + "test:e2e:upstream": "USE_UPSTREAM_BUNDLER=1 ./test/e2e/run.sh", "test:all": "npm run test && npm run test:e2e", "coverage": "hardhat coverage --network hardhat", "benchmark": "npm run test benchmark/*.ts", diff --git a/modules/4337/test/e2e/run.sh b/modules/4337/test/e2e/run.sh index 8fdd42044..88ac9ce48 100755 --- a/modules/4337/test/e2e/run.sh +++ b/modules/4337/test/e2e/run.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash -docker compose up -d +bundler_container="bundler" + +if [[ -n "$USE_UPSTREAM_BUNDLER" ]]; then + bundler_container="bundler-upstream" +fi + +docker compose up -d geth "$bundler_container" # wait for containers to start up SECONDS=0 until curl -fs http://localhost:8545 >/dev/null && curl -fs http://localhost:3000 >/dev/null; do