Skip to content

Commit

Permalink
ci: setting up ci workflow for running e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Mar 19, 2024
1 parent a433bba commit c60192c
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 21 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: E2E Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run E2E Tests
run: |
docker-compose -f test/e2e/docker-compose.yml --profile synpress up --build --exit-code-from synpress
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_DEFAULT_PLATFORM: linux/amd64
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
NGROK_BASIC_AUTH: ${{ secrets.NGROK_BASIC_AUTH }}
CYPRESS_PRIVATE_KEY_WITH_FUNDS: ${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }}
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-artifacts
path: |
test/e2e/cypress/videos
test/e2e/cypress/screenshots
continue-on-error: true
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# syntax=docker/dockerfile:1
FROM --platform=linux/amd64 synthetixio/docker-e2e:18.16-ubuntu as base

RUN mkdir /app
WORKDIR /app

COPY . .

RUN yarn install --frozen-lockfile
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"lint": "yarn lint:types && yarn lint:eslint",
"lint:types": "tsc -p jsconfig.json",
"lint:eslint": "eslint '**/*.js'",
"test:e2e": "EXTENSION=keplr synpress run --configFile=test/e2e/synpress.config.cjs"
"test:e2e": "EXTENSION=keplr synpress run --configFile=test/e2e/synpress.config.cjs",
"test:e2e:ci": "yarn build && start-server-and-test 'yarn preview' http-get://localhost:3001 'yarn test:e2e'"
},
"exports": {
"./package.json": "./package.json",
Expand Down Expand Up @@ -60,6 +61,7 @@
"rollup-plugin-summary": "^1.3.0",
"rollup-plugin-terser": "^7.0.2",
"ses": "^1.3.0",
"start-server-and-test": "^2.0.3",
"typescript": "^4.2.3"
},
"eslintConfig": {
Expand Down
81 changes: 81 additions & 0 deletions test/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: '3.9'

services:
synpress:
profiles:
- synpress
container_name: synpress
build: ../..
environment:
- DISPLAY=display:0.0
- CYPRESS_PRIVATE_KEY_WITH_FUNDS=${CYPRESS_PRIVATE_KEY_WITH_FUNDS}
- DEBUG=${DEBUG}
- CYPRESS_DOCKER_RUN=true
- GH_PAT=${GH_PAT}
- GH_USERNAME=${GH_USERNAME}
- CI=${CI}
# Cypress Dashboard
- CYPRESS_GROUP=${CYPRESS_GROUP}
- GITHUB_TOKEN=${GITHUB_TOKEN}
- CYPRESS_PROJECT_ID=${CYPRESS_PROJECT_ID}
- CYPRESS_RECORD_KEY=${CYPRESS_RECORD_KEY}
- COMMIT_INFO_MESSAGE=${COMMIT_INFO_MESSAGE}
- COMMIT_INFO_SHA=${COMMIT_INFO_SHA}
# CI variables
- GITHUB_ACTIONS=${GITHUB_ACTIONS}
- GITHUB_WORKFLOW=${GITHUB_WORKFLOW}
- GITHUB_ACTION=${GITHUB_ACTION}
- GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME}
- GITHUB_RUN_ID=${GITHUB_RUN_ID}
- GITHUB_RUN_ATTEMPT=${GITHUB_RUN_ATTEMPT}
- GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
- GH_BRANCH=${GH_BRANCH}
- GITHUB_SHA=${GITHUB_SHA}
- GITHUB_REF=${GITHUB_REF}
- GITHUB_BASE_REF=${GITHUB_BASE_REF}
- GITHUB_HEAD_REF=${GITHUB_HEAD_REF}
- SECRET_WORDS="orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology"
depends_on:
- display
entrypoint: []
working_dir: /app
volumes:
- ./cypress/videos:/app/test/e2e/videos
- ./cypress/screenshots:/app/test/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 && yarn test:e2e:ci'
networks:
- x11

display:
profiles:
- synpress
container_name: display
image: synthetixio/display:016121eafdfff448414894d0ca5a50b1d72b62eb-base
environment:
- RUN_XTERM=no
- DISPLAY_WIDTH=1920
- DISPLAY_HEIGHT=1080
ports:
- '8080:8080'
networks:
- x11

ngrok:
profiles:
- ngrok
container_name: ngrok
image: synthetixio/ngrok:016121eafdfff448414894d0ca5a50b1d72b62eb-base
ports:
- '4040:4040'
command: ['ngrok', 'http', 'display:8080', '--authtoken', '${NGROK_AUTH}']
environment:
- NGROK_AUTH=${NGROK_AUTH}
- NGROK_BASIC_AUTH=${NGROK_BASIC_AUTH}
depends_on:
- display
networks:
- x11

networks:
x11:
2 changes: 2 additions & 0 deletions wallet/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
cypress
105 changes: 85 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6799,7 +6799,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.1.tgz#df70e302b471d7473489acf26a93d63b53f874de"
integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==

bluebird@^3.5.5, bluebird@^3.7.2:
bluebird@3.7.2, bluebird@^3.5.5, bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
Expand Down Expand Up @@ -7145,7 +7145,7 @@ chardet@^0.7.0:
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==

check-more-types@^2.24.0:
check-more-types@2.24.0, check-more-types@^2.24.0:
version "2.24.0"
resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600"
integrity sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==
Expand Down Expand Up @@ -8626,7 +8626,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
integrity sha512-sxNZ+ljy+RA1maXoUReeqBBpBC6RLKmg5ewzV+x+mSETmWNoKdZN6vcQjpFROemza23hGFskJtFNoUWUaQ+R4Q==

duplexer@^0.1.2:
duplexer@^0.1.2, duplexer@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6"
integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==
Expand Down Expand Up @@ -9559,6 +9559,19 @@ etherscan-api@^10.3.0:
gh-pages "4.0.0"
querystring "0.2.1"

event-stream@=3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571"
integrity sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==
dependencies:
duplexer "~0.1.1"
from "~0"
map-stream "~0.1.0"
pause-stream "0.0.11"
split "0.3"
stream-combiner "~0.0.4"
through "~2.3.1"

[email protected]:
version "6.4.7"
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d"
Expand Down Expand Up @@ -9589,20 +9602,7 @@ [email protected]:
signal-exit "^3.0.2"
strip-final-newline "^2.0.0"

execa@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==
dependencies:
cross-spawn "^6.0.0"
get-stream "^4.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

execa@^5.0.0:
[email protected], execa@^5.0.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd"
integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==
Expand All @@ -9617,6 +9617,19 @@ execa@^5.0.0:
signal-exit "^3.0.3"
strip-final-newline "^2.0.0"

execa@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==
dependencies:
cross-spawn "^6.0.0"
get-stream "^4.0.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

execa@^7.1.1:
version "7.2.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9"
Expand Down Expand Up @@ -10138,6 +10151,11 @@ from2@^2.1.1:
inherits "^2.0.1"
readable-stream "^2.0.0"

from@~0:
version "0.1.7"
resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"
integrity sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==

fromentries@^1.2.0:
version "1.3.2"
resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a"
Expand Down Expand Up @@ -12590,7 +12608,7 @@ launch-editor@^2.6.0:
picocolors "^1.0.0"
shell-quote "^1.8.1"

lazy-ass@^1.6.0:
lazy-ass@1.6.0, lazy-ass@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513"
integrity sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==
Expand Down Expand Up @@ -13007,6 +13025,11 @@ [email protected]:
dependencies:
tmpl "1.0.5"

map-stream@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
integrity sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==

[email protected]:
version "2.0.14"
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50"
Expand Down Expand Up @@ -14003,6 +14026,13 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

[email protected]:
version "0.0.11"
resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445"
integrity sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==
dependencies:
through "~2.3"

pend@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50"
Expand Down Expand Up @@ -14913,6 +14943,13 @@ proxy-from-env@^1.1.0:
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

[email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.2.0.tgz#5e7425b89508736cdd4f2224d028f7bb3f722ebd"
integrity sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==
dependencies:
event-stream "=3.3.4"

psl@^1.1.33:
version "1.9.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7"
Expand Down Expand Up @@ -16296,6 +16333,13 @@ [email protected]:
dependencies:
chalk "^4.1.0"

[email protected]:
version "0.3.3"
resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f"
integrity sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==
dependencies:
through "2"

split@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9"
Expand Down Expand Up @@ -16345,6 +16389,20 @@ stackframe@^1.3.4:
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310"
integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==

start-server-and-test@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/start-server-and-test/-/start-server-and-test-2.0.3.tgz#15c53c85e23cba7698b498b8a2598cab95f3f802"
integrity sha512-QsVObjfjFZKJE6CS6bSKNwWZCKBG6975/jKRPPGFfFh+yOQglSeGXiNWjzgQNXdphcBI9nXbyso9tPfX4YAUhg==
dependencies:
arg "^5.0.2"
bluebird "3.7.2"
check-more-types "2.24.0"
debug "4.3.4"
execa "5.1.1"
lazy-ass "1.6.0"
ps-tree "1.2.0"
wait-on "7.2.0"

[email protected]:
version "2.0.1"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"
Expand All @@ -16362,6 +16420,13 @@ stop-iteration-iterator@^1.0.0:
dependencies:
internal-slot "^1.0.4"

stream-combiner@~0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14"
integrity sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==
dependencies:
duplexer "~0.1.1"

strict-uri-encode@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
Expand Down Expand Up @@ -16884,7 +16949,7 @@ throttleit@^1.0.0:
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.1.tgz#304ec51631c3b770c65c6c6f76938b384000f4d5"
integrity sha512-vDZpf9Chs9mAdfY046mcPt8fg5QSZr37hEH4TXYBnDF+izxgrbRGUAAaBvIk/fJm9aOFCGFd1EsNg5AZCbnQCQ==

through@2, through@^2.3.6, through@^2.3.8:
through@2, through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1:
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
Expand Down Expand Up @@ -17484,7 +17549,7 @@ w3c-xmlserializer@^2.0.0:
dependencies:
xml-name-validator "^3.0.0"

wait-on@^7.0.1:
wait-on@7.2.0, wait-on@^7.0.1:
version "7.2.0"
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-7.2.0.tgz#d76b20ed3fc1e2bebc051fae5c1ff93be7892928"
integrity sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==
Expand Down

0 comments on commit c60192c

Please sign in to comment.