Skip to content

Commit

Permalink
Updates to CI/CD to use Agoric chain and Offer up DApp (#4)
Browse files Browse the repository at this point in the history
* feat(ci): Included ui/ and contract/ from offer-up-dapp (with changes)

* feat(ci): Updated CI to use agoric chain + offer up dapp

* fix(ci): updated scripts in package.json

* refactor(ci): Moved ui/ and contract/ to tools/

* refactor: moved json-server-db.json to tools folder
  • Loading branch information
frazarshad authored Mar 4, 2024
1 parent f35b3fe commit fcbd07f
Show file tree
Hide file tree
Showing 14 changed files with 6,989 additions and 2,501 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 5 additions & 11 deletions .github/workflows/e2e_debug.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: E2E (debug)

on:
push:
pull_request:
branches: [master, dev]
on: [push, pull_request]

concurrency:
group:
Expand All @@ -13,9 +10,6 @@ concurrency:

jobs:
e2e:
if:
github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' ||
github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:
Expand All @@ -24,6 +18,8 @@ jobs:

- name: Install pnpm
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # [email protected]
with:
version: 8.15.3

- name: Setup node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # [email protected]
Expand All @@ -32,9 +28,7 @@ jobs:

- name: Run anvil
run: |
docker-compose -f docker-compose.ci.yml --profile foundry up --build --detach
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
docker-compose -f docker-compose.yml --profile synpress up --build --detach
- name: Set pnpm cache directory
run: pnpm config set store-dir .pnpm-store
Expand Down Expand Up @@ -79,7 +73,7 @@ jobs:
echo -n "======> remote noVNC URL: "
sleep 5
curl -s localhost:4040/api/tunnels | jq -r .tunnels[0].public_url
pnpm test:e2e:anvil
pnpm test:e2e:keplr
env:
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
NGROK_BASIC_AUTH: ${{ secrets.NGROK_BASIC_AUTH }}
Expand Down
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ RUN apt update && apt install -y nginx

COPY nginx.conf /etc/nginx/sites-available/default

COPY package.json ./
COPY pnpm-lock.yaml ./

FROM base as test
COPY . .

RUN pnpm install --frozen-lockfile --prefer-offline

COPY . .
38 changes: 16 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ services:
depends_on:
- display
- video
- agd
entrypoint: []
working_dir: /app
volumes:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && pnpm test:e2e:anvil'
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && VITE_RUN_ENV=agoric_chain pnpm test:e2e:keplr'
networks:
- x11

Expand Down Expand Up @@ -71,32 +72,25 @@ services:
networks:
- x11

foundry:
agd:
profiles:
- foundry
container_name: foundry
image: synthetixio/foundry:457bb48776c3b14de232d9dda620ba9188dc40ac-base
command: [ 'anvil --no-cors --fork-url ${ANVIL_FORK_URL}' ]
environment:
- ANVIL_IP_ADDR=0.0.0.0
- synpress
container_name: agoric_chain
image: frazarshad/offerup-test-chain:1.0.0
platform: linux/amd64
ports:
- '8545:8545'
networks:
- x11

foundry-metamask-test-dapp:
profiles:
- foundry
container_name: foundry-metamask-test-dapp
image: synthetixio/foundry:457bb48776c3b14de232d9dda620ba9188dc40ac-base
# Port and chain id as required by the MetaMask Test Dapp
command: [ 'anvil --no-cors --port 8546 --chain-id 1338' ]
- 26656:26656
- 26657:26657
- 1317:1317
environment:
- ANVIL_IP_ADDR=0.0.0.0
ports:
- '8546:8546'
DEST: 1
DEBUG: "SwingSet:ls,SwingSet:vat"
volumes:
- ./tools/contract:/workspace
entrypoint: /workspace/scripts/run-chain.sh
networks:
- x11


networks:
x11:
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@synthetixio/synpress",
"version": "3.7.2-beta.9",
"packageManager": "[email protected]",
"description": "Synpress is e2e testing framework based around Cypress.io & playwright with included MetaMask support. Test your dapps with ease.",
"keywords": [
"Synpress",
Expand Down Expand Up @@ -41,16 +40,20 @@
"release:patch": "release-it patch --disable-metrics",
"update:deps": "ncu -u -x 'node-fetch' && pnpm install",
"start:server": "serve node_modules/@metamask/test-dapp/dist -p 3000",
"start:contract": "cd tools/contract && pnpm start",
"start:ui": "cd tools/ui && pnpm dev",
"start:json-server": "json-server tools/json-server-db.json --port 3004",
"synpress:run:metamask": "EXTENSION=metamask SKIP_EXTENSION_SETUP=true SYNPRESS_LOCAL_TEST=true node synpress.js run --configFile=synpress.config.js",
"test:e2e:metamask": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'pnpm synpress:run:metamask'",
"test:e2e:metamask": "start-server-and-test 'pnpm start:server' http-get://localhost:3000 'pnpm synpress:run:metamask'",
"test:e2e:anvil": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'CYPRESS_USE_ANVIL=true pnpm synpress:run'",
"test:e2e:headless": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'pnpm synpress:run --headless'",
"test:e2e:headless:anvil": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'CYPRESS_USE_ANVIL=true pnpm synpress:run --headless'",
"test:e2e:ci": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'pnpm synpress:run --record --group'",
"test:e2e:ci": "start-server-and-test 'VITE_LOCAL_ENV=agoric_chain pnpm start:ui' http-get://localhost:3000 'pnpm start:json-server' http-get://localhost:3004 'pnpm synpress:run --record --group'",
"test:e2e:ci:anvil": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'CYPRESS_USE_ANVIL=true pnpm synpress:run --record --group'",
"test:e2e:ci:cypress-action": "CYPRESS_USE_ANVIL=true pnpm synpress:run",
"synpress:run:keplr": "EXTENSION=keplr SKIP_EXTENSION_SETUP=true SYNPRESS_LOCAL_TEST=true node synpress.js run --configFile=synpress.config.js",
"test:e2e:keplr": "start-server-and-test 'turbo start:server' http-get://localhost:3000 'pnpm synpress:run:keplr'"
"test:e2e:keplr": "start-server-and-test 'pnpm start:ui' http-get://localhost:3000 'pnpm start:json-server' http-get://localhost:3004 'pnpm synpress:run:keplr'"

},
"dependencies": {
"@cypress/code-coverage": "^3.11.0",
Expand Down Expand Up @@ -103,6 +106,7 @@
"eslint-plugin-testing-library": "^6.0.0",
"eslint-plugin-ui-testing": "^2.0.1",
"eslint-plugin-unicorn": "^48.0.1",
"json-server": "1.0.0-alpha.23",
"npm-check-updates": "^16.12.2",
"prettier": "^3.0.2",
"release-it": "^16.1.5",
Expand All @@ -114,7 +118,10 @@
"gh-pages": "5.0.0",
"http-cache-semantics": "4.1.1",
"ansi-regex": "5.0.1",
"@testing-library/dom": "8.20.0"
"@testing-library/dom": "8.20.0",
"ses": "1.3.0",
"@endo/eventual-send": "0.17.2",
"@agoric/xsnap": "0.14.3-u13.0"
},
"engines": {
"node": ">=14"
Expand Down
Loading

0 comments on commit fcbd07f

Please sign in to comment.