@@ -2,45 +2,102 @@ name: e2e-test
22
33on :
44 workflow_dispatch :
5- pull_request :
5+ push :
6+ branches :
7+ - dev
8+ - master
9+
10+ concurrency :
11+ group : " e2e-test"
12+ cancel-in-progress : true
613
714jobs :
815 test :
916 runs-on : ubuntu-latest
1017 strategy :
1118 matrix :
12- browser : [chrome, firefox]
19+ browser : [firefox] # [ chrome, firefox]
1320
1421 steps :
1522 - name : Checkout this repository
1623 uses : actions/checkout@v4
1724 with :
1825 path : pubky-app
1926
20- - name : Checkout skunk-works
27+ - name : Checkout pubky-docker
2128 uses : actions/checkout@v4
2229 with :
23- repository : pubky/skunk-works
24- path : skunk-works
25- ssh-key : ${{ secrets.DEPLOY_KEY }}
30+ repository : pubky/pubky-docker
31+ ref : catch-21/update
32+ path : pubky-docker
33+ submodules : true
34+ token : ${{ secrets.READ_REPOS }}
35+ # cannot use ssh-key (deploy key) for private submodules due to the
36+ # limitation where only a single key can be used per repo checkout
37+ # see https://github.com/actions/checkout/issues/183
2638
27- - name : Run skunk-works
28- working-directory : skunk-works
39+ - name : Modify pubky-docker docker-compose.yml
40+ working-directory : pubky-docker/development
2941 run : |
30- npm install
31- npm run link
32- cp ./.env.example ./services/backend/.env
33- npm run backend &
42+ YQ_BINARY=yq_linux_amd64
43+ YQ_VERSION=v4.44.3
44+ wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - | tar xz && sudo mv ${YQ_BINARY} /usr/bin/yq
45+ yq -i 'del(.services.pkarr)' docker-compose.yml
46+ yq -i 'del(.services.client)' docker-compose.yml
47+ yq -i 'del(.services.homeserver.depends_on)' docker-compose.yml
48+
49+ - name : Modify homeserver.config.toml
50+ working-directory : pubky-docker/development
51+ run : sed -i 's/secret_key = "0123000000000000000000000000000000000000000000000000000000000000"/secret_key = "${{ secrets.HOMESERVER_SECRET_KEY }}"/' homeserver.config.toml
52+
53+ # reduce neo4j memory to prevent
54+ # ERROR Invalid memory configuration - exceeds physical memory. Check the configured values for server.memory.pagecache.size and server.memory.heap.max_size
55+ - name : Modify neo4j.env
56+ working-directory : pubky-docker/development
57+ run : |
58+ sed -i 's/NEO4J_server_memory_pagecache_size=2G/NEO4J_server_memory_pagecache_size=1G/' neo4j.env
59+ sed -i 's/NEO4J_server_memory_heap_initial__size=4G/NEO4J_server_memory_heap_initial__size=1G/' neo4j.env
60+ sed -i 's/NEO4J_server_memory_heap_max__size=8G/NEO4J_server_memory_heap_max__size=2G/' neo4j.env
61+
62+ - name : Build and run pubky-docker
63+ working-directory : pubky-docker/development
64+ run : docker compose up -d
65+
66+ - name : Wait for pubky-docker to start
67+ run : |
68+ PORT=8080
69+ MAX_WAIT=300 # Maximum wait time in seconds (5 minutes)
70+ WAIT_INTERVAL=5 # Interval between checks in seconds
71+ ELAPSED=0
72+
73+ while ! curl -s http://localhost:$PORT; do
74+ if [ $ELAPSED -ge $MAX_WAIT ]; then
75+ echo "Service did not start within 5 minutes."
76+ exit 1
77+ fi
78+ echo "Waiting for service on port $PORT to be ready... ($ELAPSED seconds elapsed)"
79+ sleep $WAIT_INTERVAL
80+ ELAPSED=$((ELAPSED + WAIT_INTERVAL))
81+ done
82+
83+ echo "Service is ready."
3484
3585 - name : Build pubky-app frontend
3686 working-directory : pubky-app
3787 run : |
38- cp ./.env.example ./.env
88+ echo "NEXT_PUBLIC_HOMESERVER=${{ secrets.HOMESERVER_PUBKY }}
89+ NEXT_PUBLIC_NEXUS=http://localhost:8080
90+ NEXT_PUBLIC_TESTNET=false
91+ NEXT_PUBLIC_DEFAULT_HTTP_RELAY=https://demo.httprelay.io/link/
92+ BASE_URL_SUPPORT=${{ secrets.BASE_URL_SUPPORT }}
93+ SUPPORT_API_ACCESS_TOKEN=${{ secrets.SUPPORT_API_ACCESS_TOKEN }}
94+ SUPPORT_ACCOUNT_ID=1" > .env
3995 npm install
40- npm link @pubky/sdk
4196
4297 - name : Run e2e tests (${{ matrix.browser }})
4398 uses : cypress-io/github-action@v6
99+ env :
100+ DEBUG : ' @cypress/github-action'
44101 with :
45102 working-directory : pubky-app/apps/web-e2e
46103 config-file : cypress.config.ts
51108 install : false
52109 start : npm run start:prod
53110 wait-on : ' http://localhost:4200'
111+ wait-on-timeout : 180
54112
55113 - name : Upload ${{ matrix.browser }} screenshots
56114 if : ${{ always() }}
65123 with :
66124 name : videos-${{ matrix.browser }}
67125 path : pubky-app/dist/cypress/apps/web-e2e/videos
126+
127+ - name : Dump docker logs on failure
128+ if : failure()
129+ uses : jwalton/gh-docker-logs@v2
0 commit comments