.circleci/config.yml
version: 2
jobs:
dependencies:
docker:
- image: eventyay/circleci-python:py3.9
environment:
PIP_EXTRA_INDEX_URL: https://pypi.fury.io/fossasia/
working_directory: ~/code
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1.5.1-dependencies-
- run:
name: Install Python Dependencies
command: |
python3 -m venv venv
. venv/bin/activate
poetry export -f requirements.txt --without-hashes --with dev | pip install -r /dev/stdin
- run:
name: Install Node Dependencies
command: yarn
- save_cache:
paths:
- ./venv
- ./node_modules
- ~/.cache/yarn
- ~/.yarn/bin
key: v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
dredd:
docker:
- image: eventyay/circleci-python:py3.9
environment:
APP_CONFIG: config.TestingConfig
DATABASE_URL: postgresql://postgres@localhost/test
TEST_DATABASE_URL: postgresql://postgres@localhost/test
# Services
- image: circleci/postgres:12-postgis-ram
environment:
POSTGRES_USER: postgres
POSTGRES_DB: test
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5.0.6-alpine
working_directory: ~/code
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1.5.1-dependencies-
- run:
name: Create API blueprint
command: npx aglio --input docs/api/api_blueprint_source.apib --compile --output docs/api/api_blueprint.apib
- run:
name: Test API Doc
command: . venv/bin/activate && npx dredd
- add_ssh_keys:
fingerprints:
- "66:bd:79:0b:a9:ac:1d:0a:41:f3:26:dd:36:d9:a3:40"
- run:
name: Deploy API Docs
command: ./scripts/push_api_docs.sh
pytype:
docker:
- image: eventyay/circleci-python:py3.9
working_directory: ~/code
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1.5.1-dependencies-
- restore_cache:
keys:
- v1-pytype
- run:
name: Test pytype
command: ./venv/bin/pytype
- save_cache:
paths:
- ./.pytype
key: v1-pytype
test:
docker:
- image: eventyay/circleci-python:py3.9
environment:
APP_CONFIG: config.TestingConfig
DATABASE_URL: postgresql://postgres@localhost/test
TEST_DATABASE_URL: postgresql://postgres@localhost/test
SECRET_KEY: super secret key
# Services
- image: circleci/postgres:12-postgis-ram
environment:
POSTGRES_USER: postgres
POSTGRES_DB: test
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5.0.6-alpine
working_directory: ~/code
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1.5.1-dependencies-{{ checksum "poetry.lock" }}-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1.5.1-dependencies-
- run:
name: Test
command: |
. venv/bin/activate
./scripts/test_multiple_heads.sh
mkdir test-results
pytest tests -v --junitxml=test-results/junit.xml --cov=.
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
- run:
name: Upload Coverage
command: . venv/bin/activate && bash <(curl -s https://codecov.io/bash)
when: on_success
workflows:
version: 2
build-and-test:
jobs:
- dependencies
- dredd:
requires:
- dependencies
- pytype:
requires:
- dependencies
- test:
requires:
- dependencies