migra/.circleci/config.yml
2020-10-01 13:17:35 +10:00

92 lines
2.4 KiB
YAML

version: 2
jobs:
build:
working_directory: ~/circleci
docker:
- image: circleci/python:3.8.6
- image: circleci/postgres:12
environment:
POSTGRES_USER: circleci
POSTGRES_DB: circleci
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "pyproject.toml" }}
- run:
name: Wait for db
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: sudo apt-get update
- run: sudo apt-get install -y postgresql-client
- run:
name: create postgres user
command: psql postgresql://@localhost/circleci -c 'create role postgres'
- run:
name: Install poetry
command: |
sudo pip3 install poetry>=1.0.0
poetry config virtualenvs.create false
- run:
command: |
python3 -m venv ~/.venv
. ~/.venv/bin/activate
poetry install
- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "pyproject.toml" }}
paths:
- "~/.venv"
- run:
name: Check formatting
command: |
. ~/.venv/bin/activate
make lint
- run:
command: |
. ~/.venv/bin/activate
make test
- store_artifacts:
path: test-reports/
destination: tr1
publish:
working_directory: ~/circleci
docker:
- image: circleci/python:3.8.6
steps:
- setup_remote_docker
- checkout
- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "pyproject.toml" }}
- run:
name: Install poetry, deps
command: |
sudo pip3 install poetry>=1.0.0
poetry config virtualenvs.create false
python3 -m venv ~/.venv
. ~/.venv/bin/activate
poetry install
- run:
name: Bump version, build, install
command: |
. ~/.venv/bin/activate
python deploy/vbump.py
poetry build
poetry publish --username $PYPI_USERNAME --password $PYPI_PASSWORD
git tag `cat ~/version`
git push origin `cat ~/version`
workflows:
version: 2
build-then-publish:
jobs:
- build
- publish:
requires:
- build
filters:
branches:
only: master