From eb4f63d653d8b40e8c5fea9ef060e52fd50b165a Mon Sep 17 00:00:00 2001 From: Kasinhou <129340513+Kasinhou@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:00:10 +0100 Subject: [PATCH] Revert "UFAL/Refactor running rest tests in deploy" --- .github/workflows/deploy.yml | 72 ++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index befb653c9cd..951a56d570c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -200,13 +200,38 @@ jobs: secrets: inherit rest-tests-after-deploy8: + runs-on: ubuntu-latest needs: playwright-after-deploy8 - if: '!inputs.IMPORT' - uses: dataquest-dev/dspace-rest-test/.github/workflows/run_unittests.yml@master - with: - CUSTOMER: ${{ github.ref_name }} - URL: http://dev-5.pc:88/repository/server/api - secrets: inherit + timeout-minutes: 120 + steps: + - name: run rest-tests + run: | + curl -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \ + --request POST \ + https://api.github.com/repos/dataquest-dev/\ + dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \ + --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null + + # wait for it to start + sleep 30s + + # get result of last job + 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) + + # while job did not finish, sleep + while [[ $RES == 'null' ]]; do + sleep 10s + 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) + done; + + echo $RES + # if last result is not success, return -1 and fail + if [[ $RES != \"success\" ]]; then + echo "rest-tests have failed! check appropriate action run in the dspace-rest-test repository" + exit 1 + fi; + playwright-after-import8: needs: import-8 @@ -215,9 +240,34 @@ jobs: secrets: inherit rest-tests-after-import8: + runs-on: ubuntu-latest needs: playwright-after-import8 - uses: dataquest-dev/dspace-rest-test/.github/workflows/run_unittests.yml@master - with: - CUSTOMER: ${{ github.ref_name }} - URL: http://dev-5.pc:88/repository/server/api - secrets: inherit + timeout-minutes: 120 + steps: + - name: run rest-tests + run: | + curl -H "Accept: application/vnd.github.everest-preview+json" \ + -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \ + --request POST \ + https://api.github.com/repos/dataquest-dev/\ + dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \ + --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null + + # wait for it to start + sleep 30s + + # get result of last job + 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) + + # while job did not finish, sleep + while [[ $RES == 'null' ]]; do + sleep 10s + 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) + done; + + echo $RES + # if last result is not success, return -1 and fail + if [[ $RES != \"success\" ]]; then + echo "rest-tests have failed! check appropriate action run in the dspace-rest-test repository" + exit 1 + fi;