Skip to content

Commit

Permalink
Make the pre_e2e script echo the token
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulrhmnGhanem committed Jun 29, 2023
1 parent a6a8d21 commit e71cdb0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,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
Expand Down
19 changes: 17 additions & 2 deletions scripts/pre_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e71cdb0

Please sign in to comment.