diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 25dae32133..c8f56076cb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -331,15 +331,8 @@ jobs: GITEA_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.gitea_sha_short }}' 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..8ba3ce3351 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 &> /dev/null + 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 &> /dev/null +fi + +token="$(deno run --allow-env --allow-net --allow-run ./scripts/importBoardsTxt.ts --tokenOnly)" +docker-compose stop &> /dev/null + +# reutrn the token so it can be used as $(./scripts/pre_e2e.sh) +echo $token