From 152413cbfad069b386872cb40ef5bd19a3ee3da9 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Fri, 23 Feb 2024 19:46:42 +0100 Subject: [PATCH 1/4] feat: cypress e2e --- .github/workflows/frontend-e2e.yml | 85 ++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/frontend-e2e.yml diff --git a/.github/workflows/frontend-e2e.yml b/.github/workflows/frontend-e2e.yml new file mode 100644 index 000000000..9d53a6ef3 --- /dev/null +++ b/.github/workflows/frontend-e2e.yml @@ -0,0 +1,85 @@ +name: Cypress Frontend E2E tests +on: + pull_request: + branches: + - master + +jobs: + cypress-run: + runs-on: ubuntu-latest + steps: + - name: Enable docker.host.internal for Ubuntu + run: | + pwd && sudo bash -c 'echo "172.17.0.1 host.docker.internal" >> /etc/hosts' + + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Build Tribes Image + working-directory: ./sphinx-tribes + run: docker build -t sphinxlightning/sphinx-tribes:latest . + + - name: Clone Stack + run: | + git clone https://github.com/stakwork/sphinx-stack.git stack + + - name: Clone Sphinx Tribes Frontend + run: | + git clone https://github.com/stakwork/sphinx-tribes-frontend.git tribes-frontend + + - name: Give Permissions to Stack + working-directory: ./stack + run: | + chmod 777 ./bitcoind; + chmod 777 -R ./relay; + chmod 777 -R ./lnd; + chmod 777 -R ./proxy; + chmod 777 -R ./cln; + + - name: Check for NODES + uses: nick-fields/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + command: | + GITACTION_ENV=gitactionenv docker-compose -f ./stack/alts/proxy.yml --project-dir ./stack up -d; + sleep 240; + docker ps + docker logs meme.sphinx + docker logs dave.sphinx + docker wait stack_relaysetup_1 + cat stack/relay/NODES.json; + + - name: Copy Node.json + uses: canastro/copy-file-action@master + with: + source: 'stack/relay/NODES.json' + target: 'tribes-frontend/cypress/fixtures/nodes.json' + + - name: Install Frontend Dependencies + working-directory: ./tribes-frontend + run: yarn install + + - name: Start Server + run: yarn run start:cypress & + + - name: Run Cypress Test + run: | + sleep 20 + yarn run cypress:run + + - name: Upload Cypress logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: cypress-logs + path: tribes-frontend/cypress/videos + + - name: Stop Stack + working-directory: ./stack + run: docker-compose down \ No newline at end of file From ee15aa0802d4e631300cd5dcb4ae5636cfe8bc4e Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Fri, 23 Feb 2024 19:50:29 +0100 Subject: [PATCH 2/4] update: tring to debug --- .github/workflows/frontend-e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-e2e.yml b/.github/workflows/frontend-e2e.yml index 9d53a6ef3..857ef12da 100644 --- a/.github/workflows/frontend-e2e.yml +++ b/.github/workflows/frontend-e2e.yml @@ -22,7 +22,7 @@ jobs: - name: Build Tribes Image working-directory: ./sphinx-tribes - run: docker build -t sphinxlightning/sphinx-tribes:latest . + run: pwd && ls && docker build -t sphinxlightning/sphinx-tribes:latest . - name: Clone Stack run: | From e80cec76ff8108d173bf04bdeac3c49f14dc2712 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Fri, 23 Feb 2024 19:54:41 +0100 Subject: [PATCH 3/4] update: removed the working directory path --- .github/workflows/frontend-e2e.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/frontend-e2e.yml b/.github/workflows/frontend-e2e.yml index 857ef12da..cc879bfd1 100644 --- a/.github/workflows/frontend-e2e.yml +++ b/.github/workflows/frontend-e2e.yml @@ -21,7 +21,6 @@ jobs: node-version: 20 - name: Build Tribes Image - working-directory: ./sphinx-tribes run: pwd && ls && docker build -t sphinxlightning/sphinx-tribes:latest . - name: Clone Stack From 21b2a7b62b4398926de016eda19b72fc767b0966 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Fri, 23 Feb 2024 20:08:39 +0100 Subject: [PATCH 4/4] update: added correct working directory --- .github/workflows/frontend-e2e.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/frontend-e2e.yml b/.github/workflows/frontend-e2e.yml index cc879bfd1..2053dacbc 100644 --- a/.github/workflows/frontend-e2e.yml +++ b/.github/workflows/frontend-e2e.yml @@ -65,9 +65,11 @@ jobs: run: yarn install - name: Start Server + working-directory: ./tribes-frontend run: yarn run start:cypress & - name: Run Cypress Test + working-directory: ./tribes-frontend run: | sleep 20 yarn run cypress:run