refactor: speed up the pipeline by directly deploying the review app from the build step

This commit is contained in:
2023-06-28 11:37:39 +02:00
parent 6a8b3d2fe2
commit f1bc41c4df
16 changed files with 344 additions and 296 deletions

View File

@@ -1,12 +1,8 @@
e2e:
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/
stage: test
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- !reference [default, before_script]
script:
- pnpm --filter=@openstapps/app install --prefer-offline
- pnpm --filter=@openstapps/app install
- pnpm --filter=@openstapps/app exec cypress install
- pnpm test:integration:app
artifacts:
@@ -24,37 +20,3 @@ e2e:
- BROWSER: firefox
rules:
- when: on_success
review:
stage: review
needs: ['build']
script:
# pretty sure this is deprecated?
# TODO: - .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
- cp www/index.html www/200.html
- pnpm dlx surge -p ./www -d https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
environment:
name: review/$DEPLOY_ID
url: https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
on_stop: stop review
rules: &deploy-rules
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables:
DEPLOY_ID: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- if: $CI_COMMIT_BRANCH == 'main'
variables:
DEPLOY_ID: production
- if: $CI_COMMIT_BRANCH == 'develop'
variables:
DEPLOY_ID: staging
stop review:
stage: review
needs: ['review']
script:
- pnpm dlx surge teardown $CI_PROJECT_NAME-$DEPLOY_ID.surge.sh
environment:
name: review/$DEPLOY_ID
action: stop
when: manual
rules: *deploy-rules