Add preprod deployment to release step

This commit is contained in:
Ramon Wenger 2023-03-27 17:50:52 +02:00
parent 5205e5a329
commit b0b723447a
1 changed files with 156 additions and 154 deletions

View File

@ -6,11 +6,9 @@
image: image:
name: iterativ/skillbox-test@sha256:60d6bb808a9f0ff7b158192866a18eb7a5381a12621184c17bf5a4fb55384362 name: iterativ/skillbox-test@sha256:60d6bb808a9f0ff7b158192866a18eb7a5381a12621184c17bf5a4fb55384362
clone: clone:
depth: full depth: full
definitions: definitions:
services: services:
postgres: postgres:
@ -22,171 +20,175 @@ definitions:
cypress: $HOME/.cache/Cypress cypress: $HOME/.cache/Cypress
clientmodules: client/node_modules clientmodules: client/node_modules
steps: steps:
- &lint - &lint
name: lint name: lint
caches: caches:
- clientmodules - clientmodules
script: script:
- npm install --prefix client - npm install --prefix client
- npm run lint --prefix client - npm run lint --prefix client
- &unittest-python - &unittest-python
name: run python unit tests name: run python unit tests
caches: caches:
- pip - pip
services: services:
- postgres - postgres
script: # Modify the commands below to build your repository. script: # Modify the commands below to build your repository.
- &setup-tests source setup-for-tests.sh - &setup-tests source setup-for-tests.sh
- ./server/run_unittests_coverage.sh - ./server/run_unittests_coverage.sh
- &cypress-test - &cypress-test
name: run cypress end-to-end tests name: run cypress end-to-end tests
caches: caches:
- pip - pip
- node - node
- clientmodules - clientmodules
- npm - npm
- cypress - cypress
artifacts: artifacts:
- client/cypress/**/*.png - client/cypress/**/*.png
- client/cypress/**/*.mp4 - client/cypress/**/*.mp4
services: services:
- postgres - postgres
script: script:
- echo "This pipeline rules!" - echo "This pipeline rules!"
- *setup-tests - *setup-tests
- npm ci --prefix client - npm ci --prefix client
- npm run "install:cypress" --prefix client - npm run "install:cypress" --prefix client
- psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME" - psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME"
- python server/manage.py dummy_data - python server/manage.py dummy_data
- python server/manage.py runserver 2>&1 > /dev/null & - python server/manage.py runserver 2>&1 > /dev/null &
- npm run build --prefix client - npm run build --prefix client
- curl http://localhost:8000/beta-login - curl http://localhost:8000/beta-login
- npm run --prefix client test:cypress:e2e - npm run --prefix client test:cypress:e2e
- &frontend-test - &frontend-test
name: run cypress frontend tests name: run cypress frontend tests
caches: caches:
- node - node
- clientmodules - clientmodules
- npm - npm
- cypress - cypress
artifacts: artifacts:
- client/cypress/**/*.png - client/cypress/**/*.png
- client/cypress/**/*.mp4 - client/cypress/**/*.mp4
script: script:
- npm ci --prefix client - npm ci --prefix client
- npm run "install:cypress" --prefix client - npm run "install:cypress" --prefix client
- npm run dev --prefix client 2>&1 > /dev/null & - npm run dev --prefix client 2>&1 > /dev/null &
- sleep 30 - sleep 30
- curl http://localhost:8080/beta-login - curl http://localhost:8080/beta-login
- npm run --prefix client test:cypress:frontend - npm run --prefix client test:cypress:frontend
- &frontend-test-parallel - &frontend-test-parallel
name: run cypress frontend tests name: run cypress frontend tests
caches: caches:
- node - node
- clientmodules - clientmodules
- npm - npm
- cypress - cypress
artifacts: artifacts:
- client/cypress/**/*.png - client/cypress/**/*.png
- client/cypress/**/*.mp4 - client/cypress/**/*.mp4
script: script:
- npm ci --prefix client - npm ci --prefix client
- npm run "install:cypress" --prefix client - npm run "install:cypress" --prefix client
- npm run dev --prefix client 2>&1 > /dev/null & - npm run dev --prefix client 2>&1 > /dev/null &
- sleep 30 - sleep 30
- curl http://localhost:8080/beta-login - curl http://localhost:8080/beta-login
- source bin/run-cypress-parallel.sh - source bin/run-cypress-parallel.sh
- &jest-test - &jest-test
name: run jest tests name: run jest tests
caches: caches:
- node - node
- clientmodules - clientmodules
script: script:
- echo "This pipeline rules!" - echo "This pipeline rules!"
- *setup-tests - *setup-tests
- npm install --prefix client - npm install --prefix client
- cd client - cd client
- npm run test:unit - npm run test:unit
- &deploy-dev - &deploy-dev
name: deploy to dev on Heroku name: deploy to dev on Heroku
deployment: dev deployment: dev
trigger: manual trigger: manual
script: script:
- git push --force https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-dev.git HEAD:master - git push --force https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-dev.git HEAD:master
- &deploy-academy - &deploy-academy
name: deploy to iterativ-academy on Heroku name: deploy to iterativ-academy on Heroku
deployment: academy-stage deployment: academy-stage
script: script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/iterativ-academy.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/iterativ-academy.git HEAD:master
- &deploy-stage - &deploy-stage
name: deploy to stage on Heroku name: deploy to stage on Heroku
deployment: stage deployment: stage
script: script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-stage.git develop:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-stage.git develop:master
- &deploy-preprod-manual - &deploy-preprod-manual
name: deploy to pre-prod environments on heroku name: deploy to pre-prod environments on heroku
trigger: manual trigger: manual
deployment: preprod deployment: preprod
script: script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-preprod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-preprod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-preprod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-preprod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-preprod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-preprod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-preprod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-preprod.git HEAD:master
- &deploy-prod-manual - &deploy-prod-manual
name: deploy to prod environments on heroku name: deploy to prod environments on heroku
trigger: manual trigger: manual
deployment: prod deployment: prod
script: script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-prod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-prod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-prod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-prod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-prod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-prod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-prod.git HEAD:master - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-prod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-preprod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-kv-preprod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dha-preprod.git HEAD:master
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/my-dhf-preprod.git HEAD:master
pipelines: pipelines:
default: default:
- parallel: - parallel:
- step: *lint - step: *lint
- step: *unittest-python - step: *unittest-python
- step: *cypress-test - step: *cypress-test
- step: *frontend-test - step: *frontend-test
- step: *jest-test - step: *jest-test
- step: *deploy-dev - step: *deploy-dev
branches: branches:
master: master:
- parallel: - parallel:
- step: *unittest-python - step: *unittest-python
- step: *cypress-test - step: *cypress-test
- step: *frontend-test - step: *frontend-test
- step: *jest-test - step: *jest-test
- step: *deploy-preprod-manual - step: *deploy-preprod-manual
develop: develop:
- parallel: - parallel:
- step: *lint - step: *lint
- step: *unittest-python - step: *unittest-python
- step: *cypress-test - step: *cypress-test
- step: *frontend-test - step: *frontend-test
- step: *jest-test - step: *jest-test
- parallel: - parallel:
- step: *deploy-stage - step: *deploy-stage
- step: *deploy-academy - step: *deploy-academy
- step: *deploy-preprod-manual - step: *deploy-preprod-manual
tags: tags:
v202*: v202*:
- parallel: - parallel:
- step: *unittest-python - step: *unittest-python
- step: *cypress-test - step: *cypress-test
- step: *jest-test - step: *jest-test
- step: *deploy-prod-manual - step: *deploy-prod-manual
custom: custom:
cypress-parallel: cypress-parallel:
- parallel: - parallel:
- step: *frontend-test-parallel - step: *frontend-test-parallel
- step: *frontend-test-parallel - step: *frontend-test-parallel
- step: *frontend-test-parallel - step: *frontend-test-parallel
- step: *frontend-test-parallel - step: *frontend-test-parallel
- step: *frontend-test-parallel - step: *frontend-test-parallel
- step: *frontend-test-parallel - step: *frontend-test-parallel