Files
python-teos/.circleci/config.yml

97 lines
2.9 KiB
YAML

# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
machine:
image: ubuntu-1604:201903-01
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pisa/requirements.txt" }}-{{ checksum "pisa/requirements-dev.txt" }}-{{ checksum "apps/cli/requirements-dev.txt" }}-{{ checksum "test/pisa/e2e/bitcoind_snap.sh" }}
- run:
name: Install dependencies
command: |
sudo snap install `cat test/pisa/e2e/bitcoind_snap.sh`
pyenv local 3.7.0
python3 -m venv venv
. venv/bin/activate
sudo pip install --upgrade pip
pip install -r pisa/requirements.txt
pip install -r pisa/requirements-dev.txt
pip install -r apps/cli/requirements-dev.txt
- save_cache:
paths:
- ./venv
- /snap
key: v1-dependencies-{{ checksum "pisa/requirements.txt" }}-{{ checksum "pisa/requirements-dev.txt" }}-{{ checksum "apps/cli/requirements-dev.txt" }}-{{ checksum "test/pisa/e2e/bitcoind_snap.sh" }}
# Run bitcoind for E2E testing (running it early so it has time to bootstrap)
- run:
name: Run bitcoind
command: |
mkdir -p /home/circleci/snap/bitcoin-core/common/.bitcoin/
cp test/pisa/e2e/bitcoin.conf /home/circleci/snap/bitcoin-core/common/.bitcoin/
/snap/bin/bitcoin-core.daemon
# Run unit tests
- run:
name: Creates config files
command: |
cp pisa/sample_conf.py pisa/conf.py
cp apps/cli/sample_conf.py apps/cli/conf.py
- run:
name: Run pisa unit tests
command: |
. venv/bin/activate
pytest test/pisa/unit/
- run:
name: Run common unit tests
command: |
. venv/bin/activate
pytest test/common/unit
- run:
name: Run cli unit tests
command: |
. venv/bin/activate
pytest test/apps/cli/unit
# Setup pisa for E2E testing
- run:
name: Setup pisa
command: |
. venv/bin/activate
cp test/pisa/e2e/pisa-conf.py pisa/conf.py
python3 -m apps.generate_key -d ~/.pisa_btc/
python3 -m apps.generate_key -n cli -d ~/.pisa_btc/
# Run E2E tests
- run:
name: Run e2e tests
command: |
. venv/bin/activate
pytest test/pisa/e2e/
# - store_artifacts:
# path: test-reports
# destination: test-reports