Files
python-teos/.circleci/config.yml
2020-03-23 11:33:35 +01:00

92 lines
2.7 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:
- v2-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "cli/requirements.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 requirements.txt
pip install -r requirements-dev.txt
pip install -r cli/requirements.txt
- save_cache:
paths:
- ./venv
#- /snap
key: v2-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "cli/requirements.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: 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/cli/unit
# Setup teos for E2E testing
- run:
name: Setup teos
command: |
. venv/bin/activate
python3 -m generate_keys -d ~/.teos/
python3 -m generate_keys -n cli -d ~/.teos_cli/
cp ~/.teos/teos_pk.der ~/.teos_cli/
cp test/teos/e2e/teos.conf ~/.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