skillbox/bitbucket-pipelines.yml

91 lines
2.0 KiB
YAML

# This is a sample build configuration for Python.
# Check our guides at https://confluence.atlassian.com/x/x4UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: iterativ/skillbox-test
clone:
depth: full
definitions:
services:
postgres:
image: postgres
aliases:
- &unittest-python
name: run python unit tests
caches:
- pip
services:
- postgres
script: # Modify the commands below to build your repository.
- &setup-tests source setup-for-tests.sh
- ./server/run_unittests_coverage.sh
- &cypress-test
name: run cypress tests
caches:
- pip
- node
artifacts:
- client/cypress/**/*.png
- client/cypress/**/*.mp4
services:
- postgres
script:
- echo "This pipeline rules!"
- *setup-tests
- npm install --prefix client
# - npm run "install:cypress" --prefix client
- psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME"
- python server/manage.py dummy_data
- python server/manage.py runserver &
- npm run dev --prefix client &
- cd client
- /node_modules/.bin/cypress run
- &jest-test
name: run jest tests
caches:
- node
script:
- echo "This pipeline rules!"
- *setup-tests
- npm install --prefix client
- cd client
- npm run test:unit
- &deploy-prod
name: deploy to prod on Heroku
script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-prod.git HEAD:master
pipelines:
default:
- step: *unittest-python
- step: *cypress-test
- step: *jest-test
branches:
master:
- step: *unittest-python
- step: *cypress-test
- step: *jest-test
develop:
- step: *unittest-python
- step: *cypress-test
- step: *jest-test
- step:
name: deploy to stage on Heroku
script:
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/skillbox-stage.git develop:master
custom:
prod:
- step: *unittest-python
- step: *cypress-test
- step: *jest-test
- step: *deploy-prod