nucypher/.circleci/config.yml

455 lines
14 KiB
YAML
Raw Normal View History

version: 2.0
workflows:
version: 2
test:
jobs:
- pipenv_install:
filters:
tags:
only: /.*/
- pip_install:
filters:
tags:
only: /.*/
- eth_contract_unit:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- config_unit:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- crypto_unit:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- network_unit:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- keystore_unit:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- blockchain_interface_unit:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- blockchain_entities:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- character:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- pip_install
- pipenv_install
- intercontract_integration:
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- eth_contract_unit
- mypy_type_check:
filters:
tags:
only: /.*/
requires:
- config_unit
- crypto_unit
- network_unit
- keystore_unit
- character
- cli_tests:
2018-12-01 20:53:00 +00:00
context: "NuCypher Tests"
filters:
tags:
only: /.*/
requires:
- blockchain_entities
- blockchain_interface_unit
- config_unit
- crypto_unit
- network_unit
- keystore_unit
- character
- test_deploy:
context: "NuCypher PyPI"
requires:
- mypy_type_check
- cli_tests
filters:
tags:
only: /v[0-9]+.*/
branches:
ignore: /.*/
- request_publication_approval:
type: approval
requires:
- test_deploy
filters:
tags:
only: /v[0-9]+.*/
branches:
ignore: /.*/
- deploy:
context: "NuCypher PyPI"
requires:
- request_publication_approval
filters:
tags:
only: /v[0-9]+.*/
branches:
ignore: /.*/
python_36_base: &python_36_base
working_directory: ~/nucypher-depends
docker:
- image: circleci/python:3.6
jobs:
pipenv_install:
<<: *python_36_base
steps:
- checkout
- run:
name: Install Python Dependencies with Pipenv
command: |
pip3 install --user pip==18.0
pipenv install --three --dev --skip-lock --pre
- run:
name: Install Solidity Compiler
command: pipenv run ./scripts/install_solc.sh
2018-08-31 17:20:36 +00:00
- persist_to_workspace:
root: ~/.local/share/virtualenvs/
paths:
2018-08-31 17:20:36 +00:00
- nucypher-*
pip_install:
<<: *python_36_base
steps:
- checkout
- run:
name: Install Python Dependencies with Pip
command: |
pip3 install --user .
- run:
name: Install Python Development Dependencies with Pip
command: |
pip3 install --user -e .[testing]
- run:
name: Install Solidity Compiler
command: ./scripts/install_solc.sh
- run:
name: Check Python Entrypoint
command: python3 -c "import nucypher; print(nucypher.__version__)"
blockchain_interface_unit:
<<: *python_36_base
parallelism: 2
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Blockchain Interface Tests
command: |
pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow $(circleci tests glob tests/blockchain/eth/interfaces/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/blockchain_interface_results.xml
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
pipenv run coveralls
- store_test_results:
path: ./reports/pytest/
blockchain_entities:
<<: *python_36_base
2018-12-01 21:08:08 +00:00
parallelism: 6
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Blockchain Interface Tests
2018-11-28 05:24:17 +00:00
command: |
pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow $(circleci tests glob tests/blockchain/eth/entities/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/blockchain_interface_results.xml
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
2018-06-30 07:05:46 +00:00
- store_test_results:
path: ./reports/pytest/
eth_contract_unit:
<<: *python_36_base
parallelism: 4
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Ethereum Contract Unit Tests
command: |
pipenv run pytest --junitxml=./reports/pytest/eth-contract-unit-report.xml -v --runslow $(circleci tests glob tests/blockchain/eth/contracts/**/**/test_*.py | circleci tests split --split-by=timings)
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
- store_test_results:
path: ./reports/pytest/
config_unit:
<<: *python_36_base
2018-12-01 21:08:08 +00:00
parallelism: 2
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Node Configuration Tests
2018-11-28 05:24:17 +00:00
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest --cov=nucypher/config -v --runslow $(circleci tests glob tests/config/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/config_results.xml
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
- store_test_results:
path: ./reports/pytest/
crypto_unit:
<<: *python_36_base
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Crypto Character Tests
2018-11-28 05:24:17 +00:00
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest --cov=nucypher/crypto -v --runslow tests/crypto --junitxml=./reports/pytest/crypto_results.xml
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
2018-06-30 07:05:46 +00:00
- store_test_results:
path: ./reports/pytest/
network_unit:
<<: *python_36_base
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Network Tests
2018-11-28 05:24:17 +00:00
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest --cov=nucypher/network -v --runslow $(circleci tests glob tests/network/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/network_results.xml
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
2018-06-30 07:05:46 +00:00
- store_test_results:
path: ./reports/pytest/
keystore_unit:
<<: *python_36_base
2018-12-01 21:08:08 +00:00
parallelism: 2
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Keystore Tests
2018-11-28 05:24:17 +00:00
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest --cov=nucypher/keystore -v --runslow $(circleci tests glob tests/keystore/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/keystore_results.xml
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
2018-06-30 07:05:46 +00:00
- store_test_results:
path: ./reports/pytest/
character:
<<: *python_36_base
2018-12-01 21:08:08 +00:00
parallelism: 4
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Character Tests
2018-11-28 05:24:17 +00:00
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest --cov=nucypher -v --runslow $(circleci tests glob tests/characters/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/character_results.xml
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
2018-11-28 05:24:17 +00:00
pipenv run coveralls
2018-06-30 07:05:46 +00:00
- store_test_results:
path: ./reports/pytest/
intercontract_integration:
<<: *python_36_base
steps:
- checkout
2018-08-31 17:20:36 +00:00
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Ethereum Inter-Contract Integration Test
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest -v --runslow tests/blockchain/eth/contracts/main/test_intercontract_integration.py --junitxml=./reports/pytest/intercontract_integration_results.xml
2018-06-30 07:05:46 +00:00
- store_test_results:
path: ./reports/pytest/
cli_tests:
<<: *python_36_base
2018-12-01 21:08:08 +00:00
parallelism: 4
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Nucypher CLI Tests
command: |
2018-12-01 21:08:08 +00:00
pipenv run pytest --cov=nucypher/cli.py -v --runslow $(circleci tests glob tests/cli/**/test_*.py | circleci tests split --split-by=timings) --junitxml=./reports/pytest/cli_results.xml
2018-12-01 20:53:00 +00:00
- run:
name: Upload Coverage Report
command: |
echo -e "COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN" >> .env
pipenv run coveralls
- store_test_results:
path: ./reports/pytest/
mypy_type_check:
<<: *python_36_base
steps:
- checkout
- attach_workspace:
at: ~/.local/share/virtualenvs/
- run:
name: Install lxml
command: |
pipenv run pip install lxml
- run:
name: Run Mypy Static Type Checks (Always Succeed)
command: |
mkdir ./mypy_reports ./mypy_results
export MYPYPATH=./nucypher
2018-12-01 21:08:08 +00:00
pipenv run mypy ./nucypher --config-file=mypy.ini --xslt-html-report ./mypy_reports/html/ --linecount-report ./mypy_reports/linecount || true
- store_artifacts:
path: ./mypy_reports
test_deploy:
<<: *python_36_base
steps:
- checkout
- run:
name: Install Dependencies (Test Deploy)
command: |
pipenv install --three --dev --skip-lock --pre
pipenv install --dev --skip-lock twine
- run:
name: Verify git tag == __version__ (Test Deploy)
command: pipenv run python setup.py verify
- run:
name: Initialize .pypirc (Test Deploy)
command: |
echo -e "[distutils]" >> ~/.pypirc
echo -e "index-servers = " >> ~/.pypirc
echo -e " pypi" >> ~/.pypirc
echo -e " testpypi" >> ~/.pypirc
echo -e "" >> ~/.pypirc
echo -e "[testpypi]" >> ~/.pypirc
echo -e "repository: https://test.pypi.org/legacy/" >> ~/.pypirc
echo -e "username: $TEST_PYPI_USERNAME" >> ~/.pypirc
echo -e "password: $TEST_PYPI_PASSWORD" >> ~/.pypirc
- run:
name: Build Python Wheel (Test Deploy)
command: |
pipenv run python setup.py sdist
pipenv run python setup.py bdist_wheel
- run:
name: upload to TestPyPI
command: pipenv run twine upload --repository testpypi dist/* --verbose
- run:
name: pip install from TestPyPI
command: |
pip install --user --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple nucypher --verbose
python -c "import nucypher; print(nucypher.__version__)"
deploy:
<<: *python_36_base
steps:
- checkout
- run:
name: Install dependencies
command: |
pipenv install --three --dev --skip-lock --pre
pipenv install --dev --skip-lock twine
- run:
name: Verify git tag == __version__
command: pipenv run python setup.py verify
- run:
name: Initialize .pypirc
command: |
echo -e "[distutils]" >> ~/.pypirc
echo -e "index-servers = " >> ~/.pypirc
echo -e " pypi" >> ~/.pypirc
echo -e "" >> ~/.pypirc
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: Build Python Wheel
command: |
pipenv run python setup.py sdist
pipenv run python setup.py bdist_wheel
- run:
name: Upload to PyPI
command: pipenv run twine upload dist/* --verbose
- run:
name: pip install from PyPI
command: |
pip install --user nucypher --verbose
python -c "import nucypher; print(nucypher.__version__)"