Skip to content

Commit

Permalink
Add an e2e test that uses upstream bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Feb 2, 2024
1 parent abfafdc commit 9a79d47
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci_4337.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- run: |
npm ci
npm run test:e2e -w modules/4337
lint:
runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/ci_4337_upstream_bundler.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions modules/4337/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion modules/4337/docker/bundler/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
1 change: 1 addition & 0 deletions modules/4337/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 7 additions & 1 deletion modules/4337/test/e2e/run.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 9a79d47

Please sign in to comment.