Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to CI/CD to use Agoric chain and Offer up DApp #4

Merged
merged 5 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
frazarshad marked this conversation as resolved.
Show resolved Hide resolved
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 link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you needed to make this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COPY . . will do the same. no need to do it twice

COPY pnpm-lock.yaml ./

FROM base as test
COPY . .

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

COPY . .
frazarshad marked this conversation as resolved.
Show resolved Hide resolved
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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is anvil used for? Is this change going to disable metamask tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the file is currently only running our keplr tests. anvil is a tool used in the metamask tests

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frazarshad , Please add an issue in https://github.com/agoric-labs/synpress/issues to support metamask tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created the issue

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:
frazarshad marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to know that is frazarshad/offerup-test-chain:1.0.0 intended to be a permanent image for our deployments, or can we expect to switch to another image provided by the company?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no this a temporary solution until we have a better place to keep this image.

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:
13 changes: 13 additions & 0 deletions json-server-db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
frazarshad marked this conversation as resolved.
Show resolved Hide resolved
"agoric_chain":{
"chainName": "agoriclocal",
"rpcAddrs": ["http://agoric_chain:26657"],
"dappInterJumperBanner": "A Chrome update is affecting some users' dapp-wallet connection. If you're affected by this issue, please use Brave with shields down until the fix completes."
},
"localhost":{
"chainName": "agoriclocal",
"rpcAddrs": ["http://localhost:26657"],
"dappInterJumperBanner": "A Chrome update is affecting some users' dapp-wallet connection. If you're affected by this issue, please use Brave with shields down until the fix completes."
}

}
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 json-server-db.json --port 3004",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use dapp as the folder name instead of tools?
dapp is more intention revealing what the folder contents would be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the folder contains multiple things including the dapp. so it needed a more generic naming

"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'",
frazarshad marked this conversation as resolved.
Show resolved Hide resolved
"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