version: 2.0 workflows: version: 2 test: jobs: - bundle_dependencies-36: filters: tags: only: /.*/ - eth_contract_unit: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - config_unit: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - crypto_unit: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - network_unit: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - keystore_unit: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - blockchain_interface_unit: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - character: filters: tags: only: /.*/ requires: - bundle_dependencies-36 - intercontract_integration: 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: filters: tags: only: /.*/ requires: - 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: bundle_dependencies-36: <<: *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 - persist_to_workspace: root: ~/.local/share/virtualenvs/ paths: - nucypher-* blockchain_interface_unit: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Blockchain Interface Tests command: pipenv run pytest --cov=nucypher/blockchain/eth -v --runslow tests/blockchain/eth/interfaces tests/blockchain/eth/entities --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ eth_contract_unit: <<: *python_36_base parallelism: 4 steps: - checkout - 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) - store_test_results: path: ./reports/pytest/ config_unit: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Node Configuration Tests command: pipenv run pytest --cov=nucypher/config -v --runslow tests/config --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ crypto_unit: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Crypto Character Tests command: pipenv run pytest --cov=nucypher/crypto -v --runslow tests/crypto --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ network_unit: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Network Tests command: pipenv run pytest --cov=nucypher/network -v --runslow tests/network --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ keystore_unit: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Keystore Tests command: pipenv run pytest --cov=nucypher/keystore -v --runslow tests/keystore --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ character: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Character Tests command: pipenv run pytest --cov=nucypher -v --runslow tests/characters --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ intercontract_integration: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Ethereum Inter-Contract Integration Test command: | pipenv run pytest -v --runslow tests/blockchain/eth/contracts/main/test_intercontract_integration.py --junitxml=./reports/pytest/results.xml - store_test_results: path: ./reports/pytest/ cli_tests: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Nucypher CLI Tests command: | pipenv run pytest -v --runslow tests/cli --junitxml=./reports/pytest/results.xml - 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 pipenv run mypy ./nucypher --config-file=mypy.ini --xslt-html-report ./mypy_reports/html/ --linecount-report ./mypy_reports/linecount --junit-xml ./mypy_results/results.xml || true - store_artifacts: path: ./mypy_reports - store_test_results: path: ./mypy_results 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__)"