From 115481acf9339e3e1dac29979d6d822e0e167da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Wed, 12 Dec 2018 23:30:26 +0100 Subject: [PATCH 1/4] Renaming CircleCI jobs --- .circleci/config.yml | 91 ++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c4569a03..ca705784 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,81 +4,81 @@ workflows: version: 2 build_test_deploy: jobs: - - bundle_dependencies-35: + - pipenv_install_35: filters: tags: only: /.*/ - - bundle_dependencies-36: + - pipenv_install_36: filters: tags: only: /.*/ - - bundle_dependencies-37: + - pipenv_install_37: filters: tags: only: /.*/ - - run_tests-35: + - run_tests_35: filters: tags: only: /.*/ requires: - - bundle_dependencies-35 - - run_tests-36: + - pipenv_install_35 + - run_tests_36: filters: tags: only: /.*/ requires: - - bundle_dependencies-36 - - run_tests-37: + - pipenv_install_36 + - run_tests_37: filters: tags: only: /.*/ requires: - - bundle_dependencies-37 - - mypy_type_check-36: + - pipenv_install_37 + - mypy_type_check_36: filters: tags: only: /.*/ requires: - - run_tests-35 - - run_tests-36 - - run_tests-37 - - doctests-36: + - run_tests_35 + - run_tests_36 + - run_tests_37 + - doctests_36: filters: tags: only: /.*/ requires: - - run_tests-35 - - run_tests-36 - - run_tests-37 - - notebook_tests-36: + - run_tests_35 + - run_tests_36 + - run_tests_37 + - notebook_tests_36: filters: tags: only: /.*/ requires: - - run_tests-35 - - run_tests-36 - - run_tests-37 - - reencryption_memory_profile-36: + - run_tests_35 + - run_tests_36 + - run_tests_37 + - reencryption_memory_profile_36: filters: tags: only: /.*/ requires: - - run_tests-35 - - run_tests-36 - - run_tests-37 - - reencryption_benchmark-36: + - run_tests_35 + - run_tests_36 + - run_tests_37 + - reencryption_benchmark_36: filters: tags: only: /.*/ requires: - - run_tests-35 - - run_tests-36 - - run_tests-37 + - run_tests_35 + - run_tests_36 + - run_tests_37 - test_deploy: context: "NuCypher PyPI" requires: - - mypy_type_check-36 - - doctests-36 + - mypy_type_check_36 + - doctests_36 filters: tags: only: /v[0-9]+.*/ @@ -104,22 +104,23 @@ workflows: ignore: /.*/ python_35_base: &python_35_base - working_directory: ~/pyUmbral-35 + working_directory: ~/pyUmbral_35 docker: - image: circleci/python:3.5 python_36_base: &python_36_base - working_directory: ~/pyUmbral-36 + working_directory: ~/pyUmbral_36 docker: - image: circleci/python:3.6 python_37_base: &python_37_base - working_directory: ~/pyUmbral-37 + working_directory: ~/pyUmbral_37 docker: - image: circleci/python:3.7 jobs: - bundle_dependencies-35: + + pipenv_install_35: <<: *python_35_base steps: - checkout @@ -134,7 +135,7 @@ jobs: - "~/.local/share/virtualenvs/" key: v2-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile.lock" }}-py35 - bundle_dependencies-36: + pipenv_install_36: <<: *python_36_base steps: - checkout @@ -149,7 +150,7 @@ jobs: - "~/.local/share/virtualenvs/" key: v2-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile.lock" }}-py36 - bundle_dependencies-37: + pipenv_install_37: <<: *python_37_base steps: - checkout @@ -164,7 +165,7 @@ jobs: - "~/.local/share/virtualenvs/" key: v2-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile.lock" }}-py37 - run_tests-35: + run_tests_35: <<: *python_35_base steps: - checkout @@ -181,7 +182,7 @@ jobs: - store_artifacts: path: ./htmlcov - run_tests-36: + run_tests_36: <<: *python_36_base steps: - checkout @@ -196,7 +197,7 @@ jobs: - store_artifacts: path: ./htmlcov - run_tests-37: + run_tests_37: <<: *python_37_base steps: - checkout @@ -212,7 +213,7 @@ jobs: path: ./htmlcov - mypy_type_check-36: + mypy_type_check_36: <<: *python_36_base steps: - checkout @@ -227,7 +228,7 @@ jobs: - store_artifacts: path: ./mypy_report - doctests-36: + doctests_36: <<: *python_36_base steps: - checkout @@ -243,7 +244,7 @@ jobs: - store_artifacts: path: ./docs/build/doctest/output.txt - notebook_tests-36: + notebook_tests_36: <<: *python_36_base steps: - checkout @@ -258,7 +259,7 @@ jobs: - store_test_results: path: /reports/pytest - reencryption_memory_profile-36: + reencryption_memory_profile_36: <<: *python_36_base steps: - checkout @@ -278,7 +279,7 @@ jobs: - store_artifacts: path: ./reencryption_memory_profile.massif.out - reencryption_benchmark-36: + reencryption_benchmark_36: <<: *python_36_base steps: - checkout From 69cb47a49dcbd5097da52985d22e5c25af28508c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Wed, 12 Dec 2018 23:42:08 +0100 Subject: [PATCH 2/4] Introduce reusable commands in CircleCI config --- .circleci/config.yml | 157 ++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 93 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca705784..6f479fbb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2.0 +version: 2.1 workflows: version: 2 @@ -104,122 +104,97 @@ workflows: ignore: /.*/ python_35_base: &python_35_base - working_directory: ~/pyUmbral_35 + working_directory: ~/pyUmbral-35 docker: - image: circleci/python:3.5 python_36_base: &python_36_base - working_directory: ~/pyUmbral_36 + working_directory: ~/pyUmbral-36 docker: - image: circleci/python:3.6 python_37_base: &python_37_base - working_directory: ~/pyUmbral_37 + working_directory: ~/pyUmbral-37 docker: - image: circleci/python:3.7 -jobs: - - pipenv_install_35: - <<: *python_35_base +commands: + pipenv_install: + description: "Install Python dependencies with Pipenv" steps: - checkout - run: name: Install Python dependencies with Pipenv - command: pipenv sync --three --dev + command: | + pip3 install --user pip==18.0 + pipenv install --three --dev --skip-lock --pre - run: name: Check PEP 508 Requirements command: pipenv check - - save_cache: + - persist_to_workspace: + root: ~/.local/share/virtualenvs/ paths: - - "~/.local/share/virtualenvs/" - key: v2-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile.lock" }}-py35 + - pyUmbral-* + + 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 --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_35: + <<: *python_35_base + steps: + - pipenv_install pipenv_install_36: <<: *python_36_base steps: - - checkout - - run: - name: Install Python dependencies with Pipenv - command: pipenv sync --three --dev - - run: - name: Check PEP 508 Requirements - command: pipenv check - - save_cache: - paths: - - "~/.local/share/virtualenvs/" - key: v2-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile.lock" }}-py36 + - pipenv_install pipenv_install_37: <<: *python_37_base steps: - - checkout - - run: - name: Install Python dependencies with Pipenv - command: pipenv sync --three --dev - - run: - name: Check PEP 508 Requirements - command: pipenv check - - save_cache: - paths: - - "~/.local/share/virtualenvs/" - key: v2-deps-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "Pipfile.lock" }}-py37 + - pipenv_install run_tests_35: <<: *python_35_base steps: - - checkout - - run: - name: Install dependencies - command: | - pipenv sync --three --dev - pipenv install --dev pytest - - run: - name: pyUmbral Tests (Python 3.5) - command: pipenv run pytest --cov=. --cov-report=html --junitxml=./reports/pytest/python35-results.xml - - store_test_results: - path: /reports/pytest - - store_artifacts: - path: ./htmlcov + - run_tests: + python_version: "3.5" run_tests_36: <<: *python_36_base steps: - - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev - - run: - name: pyUmbral Tests (Python 3.6) - command: pipenv run pytest --cov=. --cov-report=html --junitxml=./reports/pytest/python36-results.xml - - store_test_results: - path: /reports/pytest - - store_artifacts: - path: ./htmlcov + - run_tests: + python_version: "3.6" run_tests_37: <<: *python_37_base steps: - - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev - - run: - name: pyUmbral Tests (Python 3.7) - command: pipenv run pytest --cov=. --cov-report=html --junitxml=./reports/pytest/python37-results.xml - - store_test_results: - path: /reports/pytest - - store_artifacts: - path: ./htmlcov - + - run_tests: + python_version: "3.7" mypy_type_check_36: <<: *python_36_base steps: - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: name: Run Mypy Static Type Checks command: | @@ -232,9 +207,8 @@ jobs: <<: *python_36_base steps: - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: name: Run Documentation Tests command: | @@ -248,9 +222,8 @@ jobs: <<: *python_36_base steps: - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: name: Run py.test on Jupyter Notebook stored output command: | @@ -263,9 +236,8 @@ jobs: <<: *python_36_base steps: - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: name: Install Profiling Tools command: | @@ -283,9 +255,8 @@ jobs: <<: *python_36_base steps: - checkout - - run: - name: Install dependencies - command: pipenv sync --three --dev + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: name: Benchmark Key Splitting and Reencryption command: | @@ -304,11 +275,11 @@ jobs: <<: *python_36_base steps: - checkout + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: - name: Install Dependencies (Test Deploy) - command: | - pipenv sync --three --dev - pipenv install --dev --skip-lock twine + 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 @@ -342,11 +313,11 @@ jobs: <<: *python_36_base steps: - checkout + - attach_workspace: + at: ~/.local/share/virtualenvs/ - run: - name: Install dependencies - command: | - pipenv sync --three --dev - pipenv install --dev --skip-lock twine + name: Install twine + command: pipenv install --dev --skip-lock twine - run: name: Verify git tag == __version__ command: pipenv run python setup.py verify From 1931604cc22bdeb07e2b3539078ecd353cf2fb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Thu, 13 Dec 2018 01:53:28 +0100 Subject: [PATCH 3/4] No need for getting pip==18.0 with pipenv --- .circleci/config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f479fbb..51c21e1d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,9 +125,7 @@ commands: - checkout - run: name: Install Python dependencies with Pipenv - command: | - pip3 install --user pip==18.0 - pipenv install --three --dev --skip-lock --pre + command: pipenv install --three --dev --skip-lock --pre - run: name: Check PEP 508 Requirements command: pipenv check @@ -338,7 +336,7 @@ jobs: pipenv run python setup.py bdist_wheel - run: name: upload to PyPI - command: pipenv run twine upload dist/* --verbose + command: pipenv run twine upload dist/* --verbose - run: name: pip install from PyPI command: | From 331aea4420bbf20929760be3b55f90ff282c9b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Thu, 13 Dec 2018 01:54:25 +0100 Subject: [PATCH 4/4] Testing pip builds with CircleCI --- .circleci/config.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 51c21e1d..2a4c95ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,24 +16,39 @@ workflows: filters: tags: only: /.*/ + - pip_install_35: + filters: + tags: + only: /.*/ + - pip_install_36: + filters: + tags: + only: /.*/ + - pip_install_37: + filters: + tags: + only: /.*/ - run_tests_35: filters: tags: only: /.*/ requires: - pipenv_install_35 + - pip_install_35 - 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: @@ -134,6 +149,22 @@ commands: 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: @@ -169,6 +200,21 @@ jobs: steps: - pipenv_install + pip_install_35: + <<: *python_35_base + steps: + - pip_install + + pip_install_36: + <<: *python_36_base + steps: + - pip_install + + pip_install_37: + <<: *python_37_base + steps: + - pip_install + run_tests_35: <<: *python_35_base steps: