vbv/bitbucket-pipelines.yml

144 lines
4.2 KiB
YAML

# this test is based on the docker image described in env/bitbucket/Dockerfile
image: iterativ/vbv-lernwelt-bitbucket
## job definition for running Cypress tests in parallel
e2e: &e2e
name: Cypress test worker
max-time: 45
services:
- postgres
caches:
- node
- clientnode
- vbvpip
- cypress
script:
- export CURRENTS_KEY=etzp5VXtJcSX8Z4H
- export IT_SERVE_VUE=false
- export IT_ALLOW_LOCAL_LOGIN=true
- source ./env/bitbucket/prepare_for_test.sh
- npm run build
- source vbvvenv/bin/activate
- pip install -r server/requirements/requirements-dev.txt
- ./prepare_server_cypress.sh --start-background
- npm run cypress:ci
artifacts:
- cypress/**/*.png
- cypress/**/*.mp4
pipelines:
default:
- step:
name: install dependencies
services:
- postgres
caches:
- node
- clientnode
- vbvpip
- cypress
script:
- export IT_SERVE_VUE=false
- export IT_ALLOW_LOCAL_LOGIN=true
- source ./env/bitbucket/prepare_for_test.sh
- npm install
- npm run build
- python -m venv vbvvenv
- source vbvvenv/bin/activate
- pip install -r server/requirements/requirements-dev.txt
- parallel:
- step:
<<: *e2e
- step:
<<: *e2e
- step:
name: python tests
max-time: 15
services:
- postgres
caches:
- vbvpip
script:
- source ./env/bitbucket/prepare_for_test.sh
- python -m venv vbvvenv
- source vbvvenv/bin/activate
- pip install -r server/requirements/requirements-dev.txt
- ./server/run_tests_coverage.sh
- step:
name: python linting
max-time: 15
services:
- postgres
caches:
- vbvpip
script:
- source ./env/bitbucket/prepare_for_test.sh
- python -m venv vbvvenv
- source vbvvenv/bin/activate
- pip install -r server/requirements/requirements-dev.txt
- git-crypt status -e | sort > git-crypt-encrypted-files-check.txt && diff -w git-crypt-encrypted-files.txt git-crypt-encrypted-files-check.txt
- trufflehog --exclude_paths trufflehog-exclude-patterns.txt --allow trufflehog-allow.json --entropy=True --max_depth=100 .
- ufmt check server
- step:
name: js tests
max-time: 15
caches:
- node
- clientnode
script:
- cd client
- pwd
- npm install
- npm test
- step:
name: js linting
max-time: 15
caches:
- node
- clientnode
script:
- cd client
- pwd
- npm install
- npm run prettier:check
- npm run lint
- npm run typecheck
tags:
v202*:
- step:
name: Hello world
script:
- echo "Release ready!"
- step:
name: Deploy to PROD
deployment: prod
trigger: manual
script:
- ./deploy.sh --commit "$BITBUCKET_COMMIT" --token "$DEPLOY_TOKEN" --url https://myservicecrm.swisscom.ch/deploy-iesc-xxx
custom:
deploy-preprod:
- step:
name: Deploy to PREPROD
deployment: preprod
script:
- ./deploy.sh --commit "$BITBUCKET_COMMIT" --token "$DEPLOY_TOKEN" --url https://preprod.myservicecrm.ch/deploy-iesc-xxx
deploy-api:
- step:
name: Deploy to API
deployment: api
script:
- ./deploy.sh --commit "$BITBUCKET_COMMIT" --token "$DEPLOY_TOKEN" --url https://api.myservicecrm.ch/deploy-iesc-xxx
definitions:
caches:
cypress: /root/.cache/Cypress
vbvpip: /opt/atlassian/pipelines/agent/build/vbvvenv/
clientnode: /opt/atlassian/pipelines/agent/build/client/node_modules/
services:
postgres:
image: postgres
memory: 512
variables:
POSTGRES_HOST_AUTH_METHOD: trust