Files
python-teos/.circleci/config.yml
Sergi Delgado Segura 7c7ff909d7 pisa -> teos
2020-03-17 15:47:38 +01:00

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 "teos/requirements.txt" }}-{{ checksum "teos/requirements-dev.txt" }}-{{ checksum "apps/cli/requirements-dev.txt" }}-{{ checksum "test/teos/e2e/bitcoind_snap.sh" }}
- run:
name: Install dependencies
command: |
sudo snap install `cat test/teos/e2e/bitcoind_snap.sh`
pyenv local 3.7.0
python3 -m venv venv
. venv/bin/activate
sudo pip install --upgrade pip
pip install -r teos/requirements.txt
pip install -r teos/requirements-dev.txt
pip install -r apps/cli/requirements-dev.txt
- save_cache:
paths:
- ./venv
- /snap
key: v1-dependencies-{{ checksum "teos/requirements.txt" }}-{{ checksum "teos/requirements-dev.txt" }}-{{ checksum "apps/cli/requirements-dev.txt" }}-{{ checksum "test/teos/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/teos/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 teos/sample_conf.py teos/conf.py
cp apps/cli/sample_conf.py apps/cli/conf.py
- run:
name: Run teos unit tests
command: |
. venv/bin/activate
pytest test/teos/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 teos for E2E testing
- run:
name: Setup teos
command: |
. venv/bin/activate
cp test/teos/e2e/teos-conf.py teos/conf.py
python3 -m apps.generate_key -d ~/.teos/
python3 -m apps.generate_key -n cli -d ~/.teos/
# Run E2E tests
- run:
name: Run e2e tests
command: |
. venv/bin/activate
pytest test/teos/e2e/
# - store_artifacts:
# path: test-reports
# destination: test-reports