diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 25dae32133..327147df8a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -325,21 +325,14 @@ jobs: - name: Pre e2e env: - FRONTEND_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.frontend_sha_short }}' - PROCESSOR_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.processor_sha_short }}' - NGINX_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.nginx_sha_short }}' - GITEA_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.gitea_sha_short }}' + FRONTEND_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.frontend_sha }}' + PROCESSOR_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.processor_sha }}' + NGINX_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.nginx_sha }}' + GITEA_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.gitea_sha }}' shell: bash run: | - auto_gen_fixtures_path=e2e/cypress/fixtures/auto-gen - mkdir $auto_gen_fixtures_path - truncate -s "${MAX_FILE_SIZE}" "${auto_gen_fixtures_path}/big.txt" - # generate admin token used for importing projects during e2e tests - docker-compose -f docker-compose.yml -f docker-compose.deploy.yml up -d - until docker logs kitspace_gitea_1 | grep 'ORM engine initialization successful' ; do sleep 3s; done - token="$(deno run --allow-env --allow-net --allow-run ./scripts/importBoardsTxt.ts --tokenOnly)" + token="$(scripts/pre_e2e.sh)" echo "CYPRESS_GITEA_ADMIN_TOKEN=${token}" >> $GITHUB_ENV - docker-compose stop - name: e2e timeout-minutes: 40 diff --git a/scripts/pre_e2e.sh b/scripts/pre_e2e.sh index 3bb4066a33..fe2661e9a6 100755 --- a/scripts/pre_e2e.sh +++ b/scripts/pre_e2e.sh @@ -4,5 +4,20 @@ set -Eeuo pipefail # Generate big files which are used during testing # `uploadProject.spec.js` -> should reject files bigger than `MAX_FILE_SIZE` auto_gen_fixtures_path=e2e/cypress/fixtures/auto-gen -mkdir $auto_gen_fixtures_path -truncate -s "${MAX_FILE_SIZE}" "${auto_gen_fixtures_path}/big.txt" +rm -rf $auto_gen_fixtures_path && mkdir $auto_gen_fixtures_path +truncate -s "${MAX_FILE_SIZE:-6M}" "${auto_gen_fixtures_path}/big.txt" + +# generate admin token used for importing projects during e2e tests +if [[ "${CI:-}" = "true" ]]; then + docker-compose -f docker-compose.yml -f docker-compose.deploy.yml up -d + until docker logs kitspace_gitea_1 | grep 'ORM engine initialization successful' ; do sleep 3s; done +else + # The tests are running locally. + docker-compose up -d +fi + +token="$(deno run --allow-env --allow-net --allow-run ./scripts/importBoardsTxt.ts --tokenOnly)" +docker-compose stop + +# reutrn the token so it can be used as $(./scripts/pre_e2e.sh) +echo $token