|
|
|
@ -1,25 +1,35 @@ |
|
|
|
version: 1 |
|
|
|
version: 3 |
|
|
|
jobs: |
|
|
|
build: |
|
|
|
docker: |
|
|
|
- image: circleci/python:3.9-buster-node-browsers |
|
|
|
environment: |
|
|
|
DATABASE_URL: postgresql://myUsr:somePwd@localhost:5432/psdb |
|
|
|
FLASK_APP: autoapp.py |
|
|
|
CONDUIT_SECRET: 'something-really-secret' |
|
|
|
FLASK_DEBUG: 1 |
|
|
|
- image: circleci/postgres:9.6.5-alpine-ram |
|
|
|
environment: |
|
|
|
POSTGRES_USER: myUsr |
|
|
|
POSTGRES_DB: psdb |
|
|
|
POSTGRES_PASSWORD: somePwd |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- restore_cache: |
|
|
|
key: deps-{{ checksum "requirements/dev.txt"}}-{{ .Environment.CACHE_VERSION }} |
|
|
|
- run: |
|
|
|
name: Dependances python |
|
|
|
command: | |
|
|
|
python3 -m venv venv |
|
|
|
. venv/bin/activate |
|
|
|
pip install -r requirements/dev.txt |
|
|
|
|
|
|
|
- save_cache: |
|
|
|
key: deps-{{ checksum "requirements/dev.txt"}}-{{ .Environment.CACHE_VERSION }} |
|
|
|
paths: |
|
|
|
- "venv" |
|
|
|
test: |
|
|
|
test-phase: |
|
|
|
docker: |
|
|
|
- image: circleci/python:3.9 |
|
|
|
- image: circleci/python:3.9-buster-node-browsers |
|
|
|
environment: |
|
|
|
DATABASE_URL: postgresql://myUsr:somePwd@localhost:5432/psdb |
|
|
|
FLASK_APP: autoapp.py |
|
|
|
@ -35,21 +45,20 @@ jobs: |
|
|
|
- restore_cache: |
|
|
|
key: deps-{{ checksum "requirements/dev.txt"}}-{{ .Environment.CACHE_VERSION }} |
|
|
|
- run: |
|
|
|
name: Waiting for postgresql |
|
|
|
command : dockerize -wait tcp://localhost:5432 -timeout 1m |
|
|
|
- run: |
|
|
|
name: Launching tests |
|
|
|
command: | |
|
|
|
. venv/bin/activate |
|
|
|
python -m flask db upgrade |
|
|
|
python -m flask test |
|
|
|
pip install -r requirements/dev.txt |
|
|
|
python3.7 -m flask db upgrade |
|
|
|
python3.7 -m flask test |
|
|
|
deploy-heroku: |
|
|
|
docker: |
|
|
|
- image : buildpack-deps:trusty |
|
|
|
steps: |
|
|
|
- checkout |
|
|
|
- run: |
|
|
|
name: Deployer vers Heroku |
|
|
|
command: | |
|
|
|
git config --global push.default matching |
|
|
|
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git main |
|
|
|
@ -61,15 +70,10 @@ jobs: |
|
|
|
echo "heroku app not responding, failing deploy" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
|
|
|
|
workflows: |
|
|
|
version: 2 |
|
|
|
test_deploy: |
|
|
|
build_test_deploy: |
|
|
|
jobs: |
|
|
|
- build |
|
|
|
- test: |
|
|
|
requires: |
|
|
|
- build |
|
|
|
- deploy-heroku: |
|
|
|
requires: |
|
|
|
- build |