Skip to content

Commit c8b876a

Browse files
committed
Try to make separate steps
1 parent 0c163f3 commit c8b876a

2 files changed

Lines changed: 157 additions & 19 deletions

File tree

‎.github/actions/cypress-test-for-demo-app/action.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ inputs:
88
runs:
99
using: composite
1010
steps:
11+
- name: Set up Node.js
12+
uses: actions/setup-node@v6
13+
with:
14+
node-version: 'lts/*'
15+
16+
- name: Install XST
17+
run: npm i -g @existdb/xst
18+
1119
- name: Extract ${{ inputs.app-name }} app
1220
working-directory: demo
1321
shell: bash

‎.github/workflows/run-tests-for-apps.yml‎

Lines changed: 149 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ env:
1313
JINKS_IMAGE: ghcr.io/eeditiones/jinks
1414

1515
jobs:
16-
generate-and-test-apps:
17-
name: Generate and test Demo Apps
16+
generate-apps:
17+
name: Generate Demo Apps
1818
runs-on: ubuntu-latest
1919

2020
steps:
@@ -82,40 +82,170 @@ jobs:
8282
run: |
8383
jinks create -c tp_config.json
8484
85-
- name: Generate tp-serafin app
86-
working-directory: demo
85+
# - name: Generate tp-serafin app
86+
# working-directory: demo
87+
# run: |
88+
# jinks create -c ser_config.json
89+
90+
# - name: Generate tp-workbench app
91+
# working-directory: demo
92+
# run: |
93+
# jinks create -c workbench_config.json
94+
95+
- name: Tag docker container for reusing in next steps
8796
run: |
88-
jinks create -c ser_config.json
97+
docker image commit jinks-server temp/jinks-server:$GITHUB_SHA
98+
mkdir -p path/to/artifacts
99+
docker save temp/jinks-server:$GITHUB_SHA > path/to/artifacts/docker-image.tar
89100
90-
- name: Generate tp-workbench app
91-
working-directory: demo
101+
run-tests-for-tei-publisher:
102+
name: Run tests on tei publisher
103+
runs-on: ubuntu-latest
104+
needs: generate-apps
105+
steps:
106+
- name: Checkout
107+
uses: actions/checkout@v2
108+
- name: Retrieve saved Docker image
109+
uses: actions/download-artifact@v2
110+
with:
111+
name: docker-artifact
112+
path: path/to/artifacts
113+
- name: Docker load
92114
run: |
93-
jinks create -c workbench_config.json
115+
cd path/to/artifacts
116+
docker load < docker-image.tar
117+
118+
- name: Start jinks container
119+
run: |
120+
docker run -d \
121+
--name jinks-server \
122+
-p 8080:8080 \
123+
tmp/jinks-server:$GITHUB_SHA
124+
125+
- name: Wait for server to be ready
126+
run: |
127+
echo "Waiting for eXist-db to start..."
128+
timeout=120
129+
elapsed=0
130+
while [ $elapsed -lt $timeout ]; do
131+
if curl -s -f http://localhost:8080/exist/apps/jinks/api/configurations > /dev/null 2>&1; then
132+
echo "Server is ready!"
133+
exit 0
134+
fi
135+
echo "Still waiting... ($elapsed seconds)"
136+
sleep 5
137+
elapsed=$((elapsed + 5))
138+
done
139+
echo "Timeout waiting for server"
140+
exit 1
94141
95-
- name: Verify deployed apps
96-
run: jinks list
97142
98143
- name: Run Cypress tests on tei-publisher
99144
uses: ./.github/actions/cypress-test-for-demo-app
100145
with:
101146
app-name: tei-publisher
102147

103-
- name: Run Cypress tests on tp-serafin
104-
uses: ./.github/actions/cypress-test-for-demo-app
148+
- name: Stop jinks container
149+
if: always()
150+
run: docker stop jinks-server || true
151+
152+
run-tests-for-tp-workbench:
153+
name: Run tests on workbench
154+
runs-on: ubuntu-latest
155+
needs: generate-apps
156+
steps:
157+
- name: Checkout
158+
uses: actions/checkout@v2
159+
- name: Retrieve saved Docker image
160+
uses: actions/download-artifact@v2
105161
with:
106-
app-name: tp-serafin
162+
name: docker-artifact
163+
path: path/to/artifacts
164+
- name: Docker load
165+
run: |
166+
cd path/to/artifacts
167+
docker load < docker-image.tar
168+
169+
- name: Start jinks container
170+
run: |
171+
docker run -d \
172+
--name jinks-server \
173+
-p 8080:8080 \
174+
tmp/jinks-server:$GITHUB_SHA
175+
176+
- name: Wait for server to be ready
177+
run: |
178+
echo "Waiting for eXist-db to start..."
179+
timeout=120
180+
elapsed=0
181+
while [ $elapsed -lt $timeout ]; do
182+
if curl -s -f http://localhost:8080/exist/apps/jinks/api/configurations > /dev/null 2>&1; then
183+
echo "Server is ready!"
184+
exit 0
185+
fi
186+
echo "Still waiting... ($elapsed seconds)"
187+
sleep 5
188+
elapsed=$((elapsed + 5))
189+
done
190+
echo "Timeout waiting for server"
191+
exit 1
192+
107193
108-
- name: Run Cypress tests on tp-workbench
194+
- name: Run Cypress tests on tei-publisher
109195
uses: ./.github/actions/cypress-test-for-demo-app
110196
with:
111197
app-name: tp-workbench
112198

113-
- name: Upload XAR artifacts
114-
uses: actions/upload-artifact@v6
199+
- name: Stop jinks container
200+
if: always()
201+
run: docker stop jinks-server || true
202+
203+
run-tests-for-tp-serafin:
204+
name: Run tests on serafin
205+
runs-on: ubuntu-latest
206+
needs: generate-apps
207+
steps:
208+
- name: Checkout
209+
uses: actions/checkout@v2
210+
- name: Retrieve saved Docker image
211+
uses: actions/download-artifact@v2
212+
with:
213+
name: docker-artifact
214+
path: path/to/artifacts
215+
- name: Docker load
216+
run: |
217+
cd path/to/artifacts
218+
docker load < docker-image.tar
219+
220+
- name: Start jinks container
221+
run: |
222+
docker run -d \
223+
--name jinks-server \
224+
-p 8080:8080 \
225+
tmp/jinks-server:$GITHUB_SHA
226+
227+
- name: Wait for server to be ready
228+
run: |
229+
echo "Waiting for eXist-db to start..."
230+
timeout=120
231+
elapsed=0
232+
while [ $elapsed -lt $timeout ]; do
233+
if curl -s -f http://localhost:8080/exist/apps/jinks/api/configurations > /dev/null 2>&1; then
234+
echo "Server is ready!"
235+
exit 0
236+
fi
237+
echo "Still waiting... ($elapsed seconds)"
238+
sleep 5
239+
elapsed=$((elapsed + 5))
240+
done
241+
echo "Timeout waiting for server"
242+
exit 1
243+
244+
245+
- name: Run Cypress tests on tei-publisher
246+
uses: ./.github/actions/cypress-test-for-demo-app
115247
with:
116-
name: demo-apps-xars
117-
path: demo/*.xar
118-
retention-days: 30
248+
app-name: tp-serafin
119249

120250
- name: Stop jinks container
121251
if: always()

0 commit comments

Comments
 (0)