You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.1 KiB
72 lines
2.1 KiB
version: 2.1
|
|
workflows:
|
|
version: 2
|
|
devopsTP4:
|
|
jobs:
|
|
- build
|
|
- bddPostgres:
|
|
requires:
|
|
- build
|
|
- test:
|
|
requires:
|
|
- build
|
|
|
|
jobs:
|
|
build:
|
|
docker: &config
|
|
- image: cimg/python:3.9.1
|
|
auth:
|
|
username: mydockerhub-user
|
|
password: $DOCKERHUB_PASSWORD
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- npm-v1-dependencies-{{ checksum "Pipfile.lock" }}
|
|
- run: pip install -r requirements/dev.txt --user
|
|
- save_cache:
|
|
key: npm-v1-dependencies-{{ checksum "Pipfile.lock" }}
|
|
paths:
|
|
- ./bin
|
|
bddPostgres:
|
|
docker:
|
|
- image: cimg/python:3.9.1
|
|
environment:
|
|
DATABASE_URL: postgres://dutoit_louis:pswdevopstpfinal@localhost:5432/devopstpfinal
|
|
JWT_SECRET: some string
|
|
API_HOST: localhost
|
|
API_PROTOCOL: http
|
|
API_PORT: 3000
|
|
- image: circleci/postgres:9.6.2-alpine
|
|
environment:
|
|
POSTGRES_USER: dutoit_louis
|
|
POSTGRES_DB: devopstpfinal
|
|
POSTGRES_PASSWORD: pswdevopstpfinal
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
keys:
|
|
- npm-v1-dependencies-{{ checksum "Pipfile.lock" }}
|
|
test:
|
|
docker:
|
|
- image: cimg/python:3.9.1
|
|
environment:
|
|
CONDUIT_SECRET: 'something-really-secret'
|
|
FLASK_APP: /autoapp.py
|
|
FLASK_DEBUG: 1
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker
|
|
- restore_cache:
|
|
keys:
|
|
- npm-v1-dependencies-{{ checksum "Pipfile.lock" }}
|
|
- run: pip install Flask
|
|
- run: pip install Flask-Migrate
|
|
- run: docker container run --name flask_db_test -e POSTGRES_PASSWORD=somePwd -e POSTGRES_USER=myUsr -p 5432:5432 -d postgres
|
|
- run: sleep 1
|
|
- run: export DATABASE_URL=postgresql://myUsr:somePwd@localhost:5432/myUsr
|
|
- run: flask db upgrade
|
|
- run: flask test
|
|
- run: docker container stop flask_db_test
|
|
- run: docker container rm flask_db_test
|
|
- run: unset DATABASE_URL
|