|
|
|
@ -0,0 +1,60 @@ |
|
|
|
jobs: |
|
|
|
install: |
|
|
|
docker: |
|
|
|
- image: circleci/python:3.6.4 |
|
|
|
- image: circleci/postgres:9.6.2 |
|
|
|
working_directory: ~/repo |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- restore_cache: |
|
|
|
keys: |
|
|
|
- dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} |
|
|
|
- dependencies- |
|
|
|
- run: |
|
|
|
name: install python and dependencies |
|
|
|
command: | |
|
|
|
python3 -m venv venv |
|
|
|
. venv/bin/activate |
|
|
|
pip install -r requirements/dev.txt |
|
|
|
|
|
|
|
- run: |
|
|
|
name: db upgrade |
|
|
|
environment: |
|
|
|
FLASK_APP: /home/circleci/repo/autoapp.py |
|
|
|
FLASK_DEBUG: 1 |
|
|
|
POSTGRES_USER: postgres |
|
|
|
POSTGRES_DB: bdtest |
|
|
|
POSTGRES_PASSWORD: somePwd |
|
|
|
POSTGRES_PORT: 5432 |
|
|
|
DATABASE_URL: postgresql://postgres:somePwd@localhost:5432/postgres |
|
|
|
command: | |
|
|
|
echo $FLASK_APP |
|
|
|
echo $FLASK_DEBUG |
|
|
|
echo $DATABASE_URL |
|
|
|
. venv/bin/activate |
|
|
|
flask db upgrade |
|
|
|
- run: |
|
|
|
name: flask test |
|
|
|
environment: |
|
|
|
FLASK_APP: /home/circleci/repo/autoapp.py |
|
|
|
FLASK_DEBUG: 1 |
|
|
|
POSTGRES_USER: postgres |
|
|
|
POSTGRES_DB: bdtest |
|
|
|
POSTGRES_PASSWORD: somePwd |
|
|
|
POSTGRES_PORT: 5432 |
|
|
|
DATABASE_URL: postgresql://postgres:somePwd@localhost:5432/postgres |
|
|
|
TESTENV: "pour tester les var env" |
|
|
|
command: | |
|
|
|
echo $DATABASE_URL |
|
|
|
echo $TESTENV |
|
|
|
. venv/bin/activate |
|
|
|
flask test |
|
|
|
- save_cache: |
|
|
|
paths: |
|
|
|
- ./venv |
|
|
|
key: dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} |
|
|
|
workflows: |
|
|
|
version: 2 |
|
|
|
build-back: |
|
|
|
jobs: |
|
|
|
- install |