Skip to content

Commit 39abed3

Browse files
authored
Revert "UFAL/Refactor running rest tests in deploy" (#1238)
1 parent b920059 commit 39abed3

1 file changed

Lines changed: 61 additions & 11 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,38 @@ jobs:
200200
secrets: inherit
201201

202202
rest-tests-after-deploy8:
203+
runs-on: ubuntu-latest
203204
needs: playwright-after-deploy8
204-
if: '!inputs.IMPORT'
205-
uses: dataquest-dev/dspace-rest-test/.github/workflows/run_unittests.yml@master
206-
with:
207-
CUSTOMER: ${{ github.ref_name }}
208-
URL: http://dev-5.pc:88/repository/server/api
209-
secrets: inherit
205+
timeout-minutes: 120
206+
steps:
207+
- name: run rest-tests
208+
run: |
209+
curl -H "Accept: application/vnd.github.everest-preview+json" \
210+
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
211+
--request POST \
212+
https://api.github.com/repos/dataquest-dev/\
213+
dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \
214+
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
215+
216+
# wait for it to start
217+
sleep 30s
218+
219+
# get result of last job
220+
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
221+
222+
# while job did not finish, sleep
223+
while [[ $RES == 'null' ]]; do
224+
sleep 10s
225+
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
226+
done;
227+
228+
echo $RES
229+
# if last result is not success, return -1 and fail
230+
if [[ $RES != \"success\" ]]; then
231+
echo "rest-tests have failed! check appropriate action run in the dspace-rest-test repository"
232+
exit 1
233+
fi;
234+
210235
211236
playwright-after-import8:
212237
needs: import-8
@@ -215,9 +240,34 @@ jobs:
215240
secrets: inherit
216241

217242
rest-tests-after-import8:
243+
runs-on: ubuntu-latest
218244
needs: playwright-after-import8
219-
uses: dataquest-dev/dspace-rest-test/.github/workflows/run_unittests.yml@master
220-
with:
221-
CUSTOMER: ${{ github.ref_name }}
222-
URL: http://dev-5.pc:88/repository/server/api
223-
secrets: inherit
245+
timeout-minutes: 120
246+
steps:
247+
- name: run rest-tests
248+
run: |
249+
curl -H "Accept: application/vnd.github.everest-preview+json" \
250+
-H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \
251+
--request POST \
252+
https://api.github.com/repos/dataquest-dev/\
253+
dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \
254+
--data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null
255+
256+
# wait for it to start
257+
sleep 30s
258+
259+
# get result of last job
260+
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
261+
262+
# while job did not finish, sleep
263+
while [[ $RES == 'null' ]]; do
264+
sleep 10s
265+
RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion)
266+
done;
267+
268+
echo $RES
269+
# if last result is not success, return -1 and fail
270+
if [[ $RES != \"success\" ]]; then
271+
echo "rest-tests have failed! check appropriate action run in the dspace-rest-test repository"
272+
exit 1
273+
fi;

0 commit comments

Comments
 (0)