-
Notifications
You must be signed in to change notification settings - Fork 62
141 lines (120 loc) · 4.3 KB
/
frontend-e2e.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Cypress Frontend E2E tests
on:
pull_request:
branches:
- "*"
jobs:
get-cypress-tests:
runs-on: ubuntu-latest
steps:
- name: Clone Sphinx Tribes Frontend
run: |
git clone https://github.com/stakwork/sphinx-tribes-frontend.git
- name: List Cypress test files
id: list-tests
working-directory: ./sphinx-tribes-frontend
run: |
tests=$(find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))')
if [ -z "$tests" ]; then
echo "No Cypress test files found."
tests="[]"
fi
echo "tests=$tests" >> $GITHUB_OUTPUT
outputs:
tests: ${{ steps.list-tests.outputs.tests }}
cypress-run:
runs-on: ubuntu-latest
needs: get-cypress-tests
strategy:
fail-fast: false
matrix:
file: ${{ fromJson(needs.get-cypress-tests.outputs.tests) }}
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
run: pwd && ls && docker build -t sphinxlightning/sphinx-tribes:latest .
# change_v2_ports
- name: Clone Stack
run: |
git clone --single-branch --branch change_v2_ports https://github.com/stakwork/sphinx-stack.git stack
- name: Clone Sphinx Tribes Frontend
run: |
git clone https://github.com/stakwork/sphinx-tribes-frontend.git sphinx-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/v1v2.yml --project-directory ./stack up -d;
sleep 240;
docker ps
docker logs meme.sphinx
docker logs dave.sphinx
docker logs db.sphinx
docker logs tribes.sphinx
docker wait stack-relaysetup-1
cat stack/relay/NODES.json;
cat stack/relay/V2NODES.json;
- name: Copy Node.json
uses: canastro/copy-file-action@master
with:
source: "stack/relay/NODES.json"
target: "sphinx-tribes-frontend/cypress/fixtures/nodes.json"
- name: Copy V2Node.json
uses: canastro/copy-file-action@master
with:
source: "stack/relay/V2NODES.json"
target: "sphinx-tribes-frontend/cypress/fixtures/v2nodes.json"
- name: Sanitize Test File Path
run: echo "SANITIZED_FILE=$(echo ${{ matrix.file }} | sed 's/\//_/g')" >> $GITHUB_ENV
- name: Install Frontend Dependencies
working-directory: ./sphinx-tribes-frontend
run: yarn install
- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v6
with:
working-directory: ./sphinx-tribes-frontend
install-command: yarn --immutable
browser: chrome
headless: true
start: yarn run start:cypress
spec: ${{ matrix.file }}
wait-on: "http://localhost:3007" # Waits for above
wait-on-timeout: 120 # Waits for 2 minutes
record: false
video: true
# - name: Start Server
# working-directory: ./sphinx-tribes-frontend
# run: yarn run start:cypress &
# - name: Run Cypress Test
# working-directory: ./sphinx-tribes-frontend
# run: |
# sleep 20
# yarn run cypress:run
- name: Upload Cypress logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: "${{ env.SANITIZED_FILE }}-cypress-logs"
path: sphinx-tribes-frontend/cypress/videos
- name: Stop Stack
working-directory: ./stack
run: docker compose down