version: 2.1 workflows: version: 2 build_test_deploy: jobs: - pipenv_install_36: filters: tags: only: /.*/ - pipenv_install_37: filters: tags: only: /.*/ - pip_install_36: filters: tags: only: /.*/ - pip_install_37: filters: tags: only: /.*/ - run_tests_36: filters: tags: only: /.*/ requires: - pipenv_install_36 - pip_install_36 - run_tests_37: filters: tags: only: /.*/ requires: - pipenv_install_37 - pip_install_37 - mypy_type_check_36: filters: tags: only: /.*/ requires: - run_tests_36 - run_tests_37 - doctests_36: filters: tags: only: /.*/ requires: - run_tests_36 - run_tests_37 - notebook_tests_36: filters: tags: only: /.*/ requires: - run_tests_36 - run_tests_37 - reencryption_memory_profile_36: filters: tags: only: /.*/ requires: - run_tests_36 - run_tests_37 - reencryption_benchmark_36: filters: tags: only: /.*/ # requires: # Commented this section to speed up the build # - run_tests_36 # - run_tests_37 - test_deploy: context: "NuCypher PyPI" requires: - mypy_type_check_36 - doctests_36 - notebook_tests_36 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: ~/pyUmbral-36 docker: - image: circleci/python:3.6 python_37_base: &python_37_base working_directory: ~/pyUmbral-37 docker: - image: circleci/python:3.7 commands: pipenv_install: description: "Install Python dependencies with Pipenv" parameters: python_version: type: string default: "3.7" steps: - checkout - run: name: Install Python dependencies with Pipenv command: pipenv install --python << parameters.python_version >> --dev --skip-lock --pre # Workaround for pipenv check erroneously requiring pip>=21.1, # even if it is in fact installed and that version is fixed in Pipfile. # See https://github.com/pypa/pipenv/issues/4147 - run: name: Check PEP 508 Requirements command: pipenv check --ignore 40291 - persist_to_workspace: root: ~/.local/share/virtualenvs/ paths: - pyUmbral-* pip_install: description: "Install Umbral with pip" 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 .[testing] - run: name: Check Python Entrypoint command: python3 -c "import umbral; print(umbral.__version__)" run_tests: description: "Run pyUmbral Tests" parameters: python_version: type: string default: "3.7" steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: pyUmbral Tests (Python << parameters.python_version >>) command: pipenv run pytest $(circleci tests glob tests/**/test_*.py | circleci tests split --split-by=timings) --cov=. --cov-report=html --junitxml=./reports/pytest/python<< parameters.python_version >>-results.xml - store_test_results: path: reports/pytest - store_artifacts: path: htmlcov jobs: pipenv_install_36: <<: *python_36_base steps: - pipenv_install: python_version: "3.6" pipenv_install_37: <<: *python_37_base steps: - pipenv_install: python_version: "3.7" pip_install_36: <<: *python_36_base steps: - pip_install pip_install_37: <<: *python_37_base steps: - pip_install run_tests_36: <<: *python_36_base parallelism: 4 steps: - run_tests: python_version: "3.6" run_tests_37: <<: *python_37_base parallelism: 4 steps: - run_tests: python_version: "3.7" mypy_type_check_36: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Run Mypy Static Type Checks command: | pipenv install --dev --skip-lock lxml pipenv run mypy --xslt-html-report ./mypy_report ./umbral --config-file=mypy.ini - store_artifacts: path: ./mypy_report doctests_36: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Run Documentation Tests command: | pipenv install -e . --dev --skip-lock cd docs pipenv run make doctest - store_artifacts: path: ./docs/build/doctest/output.txt notebook_tests_36: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Run py.test on Jupyter Notebook stored output command: | pipenv install -e . --dev --skip-lock pipenv run pytest --nbval docs/notebooks/pyUmbral\ Simple\ API.ipynb --junitxml=./reports/pytest/nbval-results.xml - store_test_results: path: /reports/pytest reencryption_memory_profile_36: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Install Profiling Tools command: | sudo apt-get update sudo apt install -y valgrind sudo apt install -y massif-visualizer - run: name: Profile Re-Encryption Memory Usage command: | pipenv run valgrind --tool=massif --massif-out-file=./reencryption_memory_profile.massif.out python3 ./tests/metrics/reencryption_firehose.py - store_artifacts: path: ./reencryption_memory_profile.massif.out reencryption_benchmark_36: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Benchmark Key Splitting and Reencryption command: | pipenv install -e . --dev --skip-lock pipenv run pytest -v ./tests/metrics/reencryption_benchmark.py --junitxml=./reports/pytest/python36-results.xml --benchmark-verbose --benchmark-autosave --benchmark-histogram=./histograms/histogram - save_cache: paths: - "./.benchmarks" key: v2-benchmarks-py36-{{ checksum "benchmarks" }} - store_artifacts: path: ./histograms - store_test_results: path: ./reports/pytest test_deploy: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Install twine (Test Deploy) command: 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 umbral --verbose python -c "import umbral; print(umbral.__version__)" deploy: <<: *python_36_base steps: - checkout - attach_workspace: at: ~/.local/share/virtualenvs/ - run: name: Install twine command: 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 umbral --verbose python -c "import umbral; print(umbral.__version__)"