From 403579f6b41bedb01c0b85bd442dca4962de7616 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Sun, 12 Apr 2020 17:19:25 -0700 Subject: [PATCH 01/60] Add test circleci file --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12a4918..40ec19c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ jobs: - python/install-deps - python/save-cache - run: - command: ./manage.py test + command: python -c "import numpy; print(numpy.__version__)" name: Test workflows: From c2ba4e8d3f629b2501e54013153910a623c61ed4 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Sun, 12 Apr 2020 17:20:49 -0700 Subject: [PATCH 02/60] Add reqs file --- .gitignore | 1 - requirements.txt | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 27da15c..393b63f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ target project/target .idea -*.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..652302d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +# TODO bump torch>=1.5.0 when torch-1.5.0 releases +# See https://github.com/pytorch/elastic/issues/39 +# For now you MUST manually install torch-1.5.0 nightly +# conda: conda install pytorch torchvision -c pytorch +# pip (cpu): pip install torch==1.5.0 -f https://download.pytorch.org/whl/test/cpu/torch_test.html +# pip (gpu): pip install torch==1.5.0 -f https://download.pytorch.org/whl/test/cu101/torch_test.html +# pip (gpu): pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html +# See https://pytorch.org/ + +numpy + From 99faaffacb985197fd2ac5bfbbf74d23728e6ae5 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Sun, 12 Apr 2020 17:28:38 -0700 Subject: [PATCH 03/60] Add dockerfile --- .circleci/config.yml | 18 ++++++++++++++++++ Dockerfile | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 40ec19c..8c3dad7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,25 @@ jobs: command: python -c "import numpy; print(numpy.__version__)" name: Test + publish_docker: + environment: + IMAGE_NAME: aivanou/test + docker: + - image: circleci/buildpack-deps:stretch + + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:latest . + echo "DOCKER_PWD" | docker login -u "DOCKER_USERNAME" --password-stdin + docker push $IMAGE_NAME:latest + + workflows: main: jobs: - build-and-test + - publish_docker diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9396f51 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM alpine:3.8 + +ENTRYPOINT [ "echo" ] + From 556c7d03875a7f4fc495f26de605a097ee877aaa Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Sun, 12 Apr 2020 17:33:00 -0700 Subject: [PATCH 04/60] correct circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c3dad7..26f4c85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,7 @@ jobs: name: Build Docker image command: | docker build -t $IMAGE_NAME:latest . - echo "DOCKER_PWD" | docker login -u "DOCKER_USERNAME" --password-stdin + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin docker push $IMAGE_NAME:latest From 4fa480f9b09f43fb828640a019e06be679ddf41a Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:33:35 -0700 Subject: [PATCH 05/60] correct circleci --- .circleci/config.yml | 64 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 26f4c85..38b9a76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,23 @@ -version: 2.1 +version: 2 -orbs: - python: circleci/python@0.2.1 +#orbs: +# python: circleci/python@0.2.1 + +publish_docker: &publish_docker + environment: + IMAGE_NAME: aivanou/test + docker: + - image: circleci/buildpack-deps:stretch + + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:latest . + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker push $IMAGE_NAME:latest jobs: build-and-test: @@ -17,23 +33,49 @@ jobs: publish_docker: environment: - IMAGE_NAME: aivanou/test - docker: - - image: circleci/buildpack-deps:stretch + VERSION: latest + <<: *publish_docker + + upload_to_pypi: + + environment: + VERSION: 0.2.0rc1 steps: - checkout - - setup_remote_docker + + # Download and cache dependencies + - restore_cache: + keys: + - v2-cpu-dependencies-{{ checksum "requirements.txt" }} + # fallback to using the latest cache if no exact match is found + - v2-cpu-dependencies- + - run: - name: Build Docker image + name: Setup .pypirc command: | - docker build -t $IMAGE_NAME:latest . - echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker push $IMAGE_NAME:latest + echo -e "[pypi]" >> ~/.pypirc + echo -e "username = $PYPI_USERNAME" >> ~/.pypirc + echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc + - run: + name: Build packages + command: | + python3 setup.py sdist bdist_wheel + + - run: + name: Upload packages + command: | + python3 -m twine upload dist/* + - run: + name: Install and assert torchelastic + command: | + pip install torchelastic + python -c "import torchelastic; assert torchelastic.__version__, '$VERSION'" workflows: main: jobs: - build-and-test - publish_docker +# - upload_to_pypi \ No newline at end of file From 31cc2e15a941c029bb357eaa47f36c3e94c6b6e1 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:44:44 -0700 Subject: [PATCH 06/60] change circleci config --- .circleci/config.yml | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 38b9a76..6e550bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,20 +4,12 @@ version: 2 # python: circleci/python@0.2.1 publish_docker: &publish_docker - environment: - IMAGE_NAME: aivanou/test - docker: - - image: circleci/buildpack-deps:stretch - - steps: - - checkout - - setup_remote_docker - - run: - name: Build Docker image - command: | - docker build -t $IMAGE_NAME:latest . - echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker push $IMAGE_NAME:latest + - run: + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:latest . + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker push $IMAGE_NAME:latest jobs: build-and-test: @@ -31,10 +23,16 @@ jobs: command: python -c "import numpy; print(numpy.__version__)" name: Test - publish_docker: + build_publish_docker: environment: - VERSION: latest - <<: *publish_docker + IMAGE_NAME: aivanou/test + docker: + - image: circleci/buildpack-deps:stretch + + steps: + - checkout + - setup_remote_docker + - <<: *publish_docker upload_to_pypi: @@ -77,5 +75,5 @@ workflows: main: jobs: - build-and-test - - publish_docker + - build_publish_docker # - upload_to_pypi \ No newline at end of file From b5c281c72fe1f3a1e71cf56a0ae37651488638c0 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:45:19 -0700 Subject: [PATCH 07/60] change circleci config --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e550bd..8a8a2d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ -version: 2 +version: 2.1 -#orbs: -# python: circleci/python@0.2.1 +orbs: + python: circleci/python@0.2.1 publish_docker: &publish_docker - run: From ef6dd20d7ec36354ba03b1e16b2556a192e34e40 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:46:52 -0700 Subject: [PATCH 08/60] change circleci config --- .circleci/config.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a8a2d1..047e930 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,11 +5,11 @@ orbs: publish_docker: &publish_docker - run: - name: Build Docker image - command: | - docker build -t $IMAGE_NAME:latest . - echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker push $IMAGE_NAME:latest + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:latest . + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker push $IMAGE_NAME:latest jobs: build-and-test: @@ -31,7 +31,9 @@ jobs: steps: - checkout + - setup_remote_docker + - <<: *publish_docker upload_to_pypi: From adc2e79bc28b13442258b30b04892753b599fa0b Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:47:23 -0700 Subject: [PATCH 09/60] change circleci config --- .circleci/config.yml | 72 ++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 047e930..b448d77 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,42 +36,42 @@ jobs: - <<: *publish_docker - upload_to_pypi: - - environment: - VERSION: 0.2.0rc1 - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v2-cpu-dependencies-{{ checksum "requirements.txt" }} - # fallback to using the latest cache if no exact match is found - - v2-cpu-dependencies- - - - run: - name: Setup .pypirc - command: | - echo -e "[pypi]" >> ~/.pypirc - echo -e "username = $PYPI_USERNAME" >> ~/.pypirc - echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc - - run: - name: Build packages - command: | - python3 setup.py sdist bdist_wheel - - - run: - name: Upload packages - command: | - python3 -m twine upload dist/* - - - run: - name: Install and assert torchelastic - command: | - pip install torchelastic - python -c "import torchelastic; assert torchelastic.__version__, '$VERSION'" +# upload_to_pypi: +# +# environment: +# VERSION: 0.2.0rc1 +# +# steps: +# - checkout +# +# # Download and cache dependencies +# - restore_cache: +# keys: +# - v2-cpu-dependencies-{{ checksum "requirements.txt" }} +# # fallback to using the latest cache if no exact match is found +# - v2-cpu-dependencies- +# +# - run: +# name: Setup .pypirc +# command: | +# echo -e "[pypi]" >> ~/.pypirc +# echo -e "username = $PYPI_USERNAME" >> ~/.pypirc +# echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc +# - run: +# name: Build packages +# command: | +# python3 setup.py sdist bdist_wheel +# +# - run: +# name: Upload packages +# command: | +# python3 -m twine upload dist/* +# +# - run: +# name: Install and assert torchelastic +# command: | +# pip install torchelastic +# python -c "import torchelastic; assert torchelastic.__version__, '$VERSION'" workflows: main: From bcc4422aaada31a09a9967cc342555b6cbe58f3c Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:48:56 -0700 Subject: [PATCH 10/60] change circleci config --- .circleci/config.yml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b448d77..42717d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,12 +4,19 @@ orbs: python: circleci/python@0.2.1 publish_docker: &publish_docker - - run: - name: Build Docker image - command: | - docker build -t $IMAGE_NAME:latest . - echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker push $IMAGE_NAME:latest + docker: + - image: circleci/buildpack-deps:stretch + + steps: + - checkout + + - setup_remote_docker + - run: + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:latest . + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker push $IMAGE_NAME:latest jobs: build-and-test: @@ -26,13 +33,13 @@ jobs: build_publish_docker: environment: IMAGE_NAME: aivanou/test - docker: - - image: circleci/buildpack-deps:stretch - - steps: - - checkout - - - setup_remote_docker +# docker: +# - image: circleci/buildpack-deps:stretch +# +# steps: +# - checkout +# +# - setup_remote_docker - <<: *publish_docker From 05c3f7f072f00c575ed4f0c9bdc0afe356495c66 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:49:35 -0700 Subject: [PATCH 11/60] change circleci config --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 42717d2..0d19329 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -33,6 +33,9 @@ jobs: build_publish_docker: environment: IMAGE_NAME: aivanou/test + + - <<: *publish_docker + # docker: # - image: circleci/buildpack-deps:stretch # @@ -41,7 +44,6 @@ jobs: # # - setup_remote_docker - - <<: *publish_docker # upload_to_pypi: # From fbe447e9705df4d7c29e4ea936df9923c1a1aa5f Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 09:59:50 -0700 Subject: [PATCH 12/60] change circleci config --- .circleci/config.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d19329..963c99d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,19 +4,18 @@ orbs: python: circleci/python@0.2.1 publish_docker: &publish_docker - docker: - - image: circleci/buildpack-deps:stretch + docker: + - image: circleci/buildpack-deps:stretch - steps: - - checkout - - - setup_remote_docker - - run: - name: Build Docker image - command: | - docker build -t $IMAGE_NAME:latest . - echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker push $IMAGE_NAME:latest + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: | + docker build -t $IMAGE_NAME:$VERSION . + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker push $IMAGE_NAME:$VERSION jobs: build-and-test: @@ -33,8 +32,9 @@ jobs: build_publish_docker: environment: IMAGE_NAME: aivanou/test + VERSION: latest - - <<: *publish_docker + <<: *publish_docker # docker: # - image: circleci/buildpack-deps:stretch From 3748af1c5aaac1cf4855a3ab01ed62542c9cfcb8 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 10:01:13 -0700 Subject: [PATCH 13/60] change circleci config --- .circleci/config.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 963c99d..431d782 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,13 +29,20 @@ jobs: command: python -c "import numpy; print(numpy.__version__)" name: Test - build_publish_docker: + build_publish_docker_latest: environment: IMAGE_NAME: aivanou/test VERSION: latest <<: *publish_docker + build_publish_docker_version: + environment: + IMAGE_NAME: aivanou/test + VERSION: 0.2.0rc0 + + <<: *publish_docker + # docker: # - image: circleci/buildpack-deps:stretch # @@ -86,5 +93,6 @@ workflows: main: jobs: - build-and-test - - build_publish_docker + - build_publish_docker_latest + - build_publish_docker_version # - upload_to_pypi \ No newline at end of file From bfda769a2ab8dfd6fa07ff024585e2111320c98d Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 10:04:29 -0700 Subject: [PATCH 14/60] change circleci config --- .circleci/config.yml | 91 +++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 431d782..7044d8c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,56 +43,51 @@ jobs: <<: *publish_docker -# docker: -# - image: circleci/buildpack-deps:stretch -# -# steps: -# - checkout -# -# - setup_remote_docker - - -# upload_to_pypi: -# -# environment: -# VERSION: 0.2.0rc1 -# -# steps: -# - checkout -# -# # Download and cache dependencies -# - restore_cache: -# keys: -# - v2-cpu-dependencies-{{ checksum "requirements.txt" }} -# # fallback to using the latest cache if no exact match is found -# - v2-cpu-dependencies- -# -# - run: -# name: Setup .pypirc -# command: | -# echo -e "[pypi]" >> ~/.pypirc -# echo -e "username = $PYPI_USERNAME" >> ~/.pypirc -# echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc -# - run: -# name: Build packages -# command: | -# python3 setup.py sdist bdist_wheel -# -# - run: -# name: Upload packages -# command: | -# python3 -m twine upload dist/* -# -# - run: -# name: Install and assert torchelastic -# command: | -# pip install torchelastic -# python -c "import torchelastic; assert torchelastic.__version__, '$VERSION'" + + upload_to_pypi: + + docker: + - image: circleci/python:3.6 + + environment: + VERSION: 0.2.0rc1 + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v2-cpu-dependencies-{{ checksum "requirements.txt" }} + # fallback to using the latest cache if no exact match is found + - v2-cpu-dependencies- + + - run: + name: Setup .pypirc + command: | + echo -e "[pypi]" >> ~/.pypirc + echo -e "username = $PYPI_USERNAME" >> ~/.pypirc + echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc + - run: + name: Build packages + command: | + python3 setup.py sdist bdist_wheel + + - run: + name: Upload packages + command: | + python3 -m twine upload dist/* + + - run: + name: Install and assert torchelastic + command: | + pip install torchelastic + python -c "import torchelastic; assert torchelastic.__version__, '$VERSION'" workflows: main: jobs: - build-and-test - - build_publish_docker_latest - - build_publish_docker_version -# - upload_to_pypi \ No newline at end of file +# - build_publish_docker_latest +# - build_publish_docker_version + - upload_to_pypi \ No newline at end of file From 46cb9f5b09b96ace5d24bb4e8f14cad62a2b9657 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 10:11:54 -0700 Subject: [PATCH 15/60] change circleci config --- .circleci/config.yml | 2 +- requirements.txt | 9 --------- version.py | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 version.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 7044d8c..8c13234 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ jobs: command: | echo -e "[pypi]" >> ~/.pypirc echo -e "username = $PYPI_USERNAME" >> ~/.pypirc - echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc + echo -e "password = $PYPI_PWD" >> ~/.pypirc - run: name: Build packages command: | diff --git a/requirements.txt b/requirements.txt index 652302d..b26e81f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,2 @@ -# TODO bump torch>=1.5.0 when torch-1.5.0 releases -# See https://github.com/pytorch/elastic/issues/39 -# For now you MUST manually install torch-1.5.0 nightly -# conda: conda install pytorch torchvision -c pytorch -# pip (cpu): pip install torch==1.5.0 -f https://download.pytorch.org/whl/test/cpu/torch_test.html -# pip (gpu): pip install torch==1.5.0 -f https://download.pytorch.org/whl/test/cu101/torch_test.html -# pip (gpu): pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html -# See https://pytorch.org/ - numpy diff --git a/version.py b/version.py new file mode 100644 index 0000000..9ded3c6 --- /dev/null +++ b/version.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# Copyright (c) Facebook, Inc. and its affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +# Follows PEP-0440 version scheme guidelines +# https://www.python.org/dev/peps/pep-0440/#version-scheme +# +# Examples: +# 0.1.0.devN # Developmental release +# 0.1.0aN # Alpha release +# 0.1.0bN # Beta release +# 0.1.0rcN # Release Candidate +# 0.1.0 # Final release +__version__ = "0.1.0" From 3997b903afad5e20931a9a2750bae7ff420ab154 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 10:12:06 -0700 Subject: [PATCH 16/60] change circleci config --- setup.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2c6543a --- /dev/null +++ b/setup.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +# Copyright (c) Facebook, Inc. and its affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +import os +import re +import sys + +from setuptools import find_packages, setup + + +def get_version(): + # get version string from version.py + # TODO: ideally the version.py should be generated when setup is run + version_file = os.path.join(os.path.dirname(__file__), "version.py") + version_regex = r"__version__ = ['\"]([^'\"]*)['\"]" + with open(version_file, "r") as f: + version = re.search(version_regex, f.read(), re.M).group(1) + return version + + +if __name__ == "__main__": + if sys.version_info < (3, 6): + sys.exit("python >= 3.6 required") + + with open("README.md", encoding="utf8") as f: + readme = f.read() + + with open("requirements.txt") as f: + reqs = f.read() + + version = get_version() + print("-- Building version: " + version) + + setup( + # Metadata + name="aivanou/test", + version=version, + author="Aivanou", + author_email="csivanou@gmail.com", + description="Test project", + long_description=readme, + long_description_content_type="text/markdown", + url="https://github.com/tierex/algorithms", + license="BSD-3", + keywords=["test"], + python_requires=">=3.6", + install_requires=reqs.strip().split("\n"), + include_package_data=True, + packages=find_packages(exclude=("test", "test.*")), + test_suite="test.suites.unittests", + # PyPI package information. + classifiers=[ + ], + ) From 7980c39efcf5411617047c1de0c15f40da6eb89a Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 10:12:21 -0700 Subject: [PATCH 17/60] correct circleci --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 From 5979dbf58260d45477cd7fbaa1e3b58758d2d1c0 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 10:16:28 -0700 Subject: [PATCH 18/60] change circleci config --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c13234..465af84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,6 +62,11 @@ jobs: # fallback to using the latest cache if no exact match is found - v2-cpu-dependencies- + - run: + name: Install python deps + command: | + sudo pip install twine + - run: name: Setup .pypirc command: | @@ -78,11 +83,6 @@ jobs: command: | python3 -m twine upload dist/* - - run: - name: Install and assert torchelastic - command: | - pip install torchelastic - python -c "import torchelastic; assert torchelastic.__version__, '$VERSION'" workflows: main: From 416af1c8d96f92d8698184309a5a3bb79c4b6f95 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 11:45:17 -0700 Subject: [PATCH 19/60] change circleci config --- .circleci/config.yml | 8 ++++++-- setup.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 465af84..0eaf83e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,6 +88,10 @@ workflows: main: jobs: - build-and-test -# - build_publish_docker_latest + - build_publish_docker_latest + filters: + tags: + only: /.*/ + # - build_publish_docker_version - - upload_to_pypi \ No newline at end of file +# - upload_to_pypi \ No newline at end of file diff --git a/setup.py b/setup.py index 2c6543a..bde51a1 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ def get_version(): setup( # Metadata - name="aivanou/test", + name="aivanou", version=version, author="Aivanou", author_email="csivanou@gmail.com", From 0e02a241988cab30d832954b608b55ca59df7436 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 11:50:21 -0700 Subject: [PATCH 20/60] change circleci config --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0eaf83e..9472eed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,9 @@ workflows: main: jobs: - build-and-test - - build_publish_docker_latest + deploy: + jobs: + - build_publish_docker_latest: filters: tags: only: /.*/ From 6811051d6a296b6233c437f77e6865bd27bb0113 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 11:54:08 -0700 Subject: [PATCH 21/60] change circleci config --- .circleci/config.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9472eed..60be087 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,12 +88,20 @@ workflows: main: jobs: - build-and-test - deploy: + circleci-docs-workflow: jobs: - - build_publish_docker_latest: + - tag_test: filters: tags: only: /.*/ + - tag_test2: + requires: + - tag_test + filters: + tags: + only: /^config-test.*/ + branches: + ignore: /.*/ # - build_publish_docker_version # - upload_to_pypi \ No newline at end of file From 26ab7848b584026a2a13757216bb0f3cd75c37d9 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 11:55:12 -0700 Subject: [PATCH 22/60] change circleci config --- .circleci/config.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 60be087..4ae9142 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,6 +83,16 @@ jobs: command: | python3 -m twine upload dist/* + tag_test: + docker: + - image: circleci/python:3.6 + + steps: + - run: + command: echo hi + name: Test + + workflows: main: @@ -94,14 +104,6 @@ workflows: filters: tags: only: /.*/ - - tag_test2: - requires: - - tag_test - filters: - tags: - only: /^config-test.*/ - branches: - ignore: /.*/ # - build_publish_docker_version # - upload_to_pypi \ No newline at end of file From 5a7d97fe80c1ac45a8797c0085e02df1fa6374d1 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 11:56:19 -0700 Subject: [PATCH 23/60] change circleci config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ae9142..eb0b9f4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ workflows: - tag_test: filters: tags: - only: /.*/ + only: /^config-test.*/ # - build_publish_docker_version # - upload_to_pypi \ No newline at end of file From ef0981bea42acfb278f2df2356794a193edd6a67 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:00:02 -0700 Subject: [PATCH 24/60] change circleci config --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index eb0b9f4..042777f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,6 +102,8 @@ workflows: jobs: - tag_test: filters: + branches: + ignore: /.*/ tags: only: /^config-test.*/ From 2124d2a0a3c919ac793a928201051726b8563d2a Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:12:28 -0700 Subject: [PATCH 25/60] change circleci config --- .circleci/config.yml | 33 ++++++++++++++++----------------- setup.py | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 042777f..3bc5795 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,9 +49,6 @@ jobs: docker: - image: circleci/python:3.6 - environment: - VERSION: 0.2.0rc1 - steps: - checkout @@ -83,16 +80,6 @@ jobs: command: | python3 -m twine upload dist/* - tag_test: - docker: - - image: circleci/python:3.6 - - steps: - - run: - command: echo hi - name: Test - - workflows: main: @@ -100,12 +87,24 @@ workflows: - build-and-test circleci-docs-workflow: jobs: - - tag_test: + - build_publish_docker_version: + filters: + branches: + ignore: /.*/ + tags: + only: /^v*/ + + - build_publish_docker_latest: + filters: + branches: + ignore: /.*/ + tags: + only: /^v*/ + + - upload_to_pypi: filters: branches: ignore: /.*/ tags: - only: /^config-test.*/ + only: /^v*/ -# - build_publish_docker_version -# - upload_to_pypi \ No newline at end of file diff --git a/setup.py b/setup.py index bde51a1..bd5df89 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,22 @@ import sys from setuptools import find_packages, setup +from setuptools.command.install import install + + +class VerifyVersionCommand(install): + """Custom command to verify that the git tag matches our version""" + description = 'verify that the git tag matches our version' + + def run(self): + tag = os.getenv('CIRCLE_TAG') + tag_from_version = f"v{get_version()}" + + if tag != tag_from_version: + info = "Git tag: {0} does not match the version: {1}".format( + tag, get_version() + ) + sys.exit(info) def get_version(): @@ -56,4 +72,7 @@ def get_version(): # PyPI package information. classifiers=[ ], + cmdclass={ + 'verify': VerifyVersionCommand, + } ) From 6840319a9af252a5cd29e33c79e5c3c99bc3ecdc Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:15:09 -0700 Subject: [PATCH 26/60] change circleci config --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bc5795..1a59cde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,19 +92,19 @@ workflows: branches: ignore: /.*/ tags: - only: /^v*/ + only: /^v.*/ - build_publish_docker_latest: filters: branches: ignore: /.*/ tags: - only: /^v*/ + only: /^v.*/ - upload_to_pypi: filters: branches: ignore: /.*/ tags: - only: /^v*/ + only: /^v.*/ From 745bc02dc8b6ba52a7679fcb834c34d1bd3d2a51 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:19:12 -0700 Subject: [PATCH 27/60] correct circleci --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd5df89..93980ae 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def run(self): tag = os.getenv('CIRCLE_TAG') tag_from_version = f"v{get_version()}" - if tag != tag_from_version: + if tag == tag_from_version: info = "Git tag: {0} does not match the version: {1}".format( tag, get_version() ) From 23fa60e1b6ce3e90e9077b6932868d7dd12d0996 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:19:43 -0700 Subject: [PATCH 28/60] correct circleci --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 93980ae..bd5df89 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def run(self): tag = os.getenv('CIRCLE_TAG') tag_from_version = f"v{get_version()}" - if tag == tag_from_version: + if tag != tag_from_version: info = "Git tag: {0} does not match the version: {1}".format( tag, get_version() ) From 814095eb42174eb656dee865a306a115f352826e Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:23:49 -0700 Subject: [PATCH 29/60] change circleci config --- .circleci/config.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a59cde..4a6e4dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,7 @@ jobs: - python/install-deps - python/save-cache - run: - command: python -c "import numpy; print(numpy.__version__)" + command: python -c "import numpy; print(numpy.__version__)" name: Test build_publish_docker_latest: @@ -59,6 +59,11 @@ jobs: # fallback to using the latest cache if no exact match is found - v2-cpu-dependencies- + - run: + name: Verify git tag and version consistency + command: | + python3 setup.py verify + - run: name: Install python deps command: | From 87a1a8c7aadeaed76fd1f92e9f8da23c4b9e5f90 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:27:04 -0700 Subject: [PATCH 30/60] change circleci config --- .circleci/config.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a6e4dd..b3adfcd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,6 +44,19 @@ jobs: <<: *publish_docker + verify_correct_version: + docker: + - image: circleci/python:3.6 + + steps: + - checkout + + - run: + name: Verify git tag and version consistency + command: | + python3 setup.py verify + + upload_to_pypi: docker: @@ -59,11 +72,6 @@ jobs: # fallback to using the latest cache if no exact match is found - v2-cpu-dependencies- - - run: - name: Verify git tag and version consistency - command: | - python3 setup.py verify - - run: name: Install python deps command: | @@ -92,7 +100,16 @@ workflows: - build-and-test circleci-docs-workflow: jobs: + - verify_correct_version: + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + - build_publish_docker_version: + requires: + - verify_correct_version filters: branches: ignore: /.*/ @@ -100,6 +117,8 @@ workflows: only: /^v.*/ - build_publish_docker_latest: + requires: + - verify_correct_version filters: branches: ignore: /.*/ @@ -107,6 +126,8 @@ workflows: only: /^v.*/ - upload_to_pypi: + requires: + - verify_correct_version filters: branches: ignore: /.*/ From d58409e9201d54a1051408c78e942a78245e8935 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 13 Apr 2020 12:39:13 -0700 Subject: [PATCH 31/60] change circleci config --- .circleci/config.yml | 11 +++++++++-- version.py | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b3adfcd..3e1735f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,9 +13,16 @@ publish_docker: &publish_docker - run: name: Build Docker image command: | - docker build -t $IMAGE_NAME:$VERSION . + if [[ -z ${CIRCLE_TAG} ]]; then + echo "ERROR: the workflow should only be executed on the tag" + exit 1 + fi + publish_version=${CIRCLE_TAG#"v."} + echo "Buiding image $IMAGE_NAME:$publish_version" + docker build -t $IMAGE_NAME:$publish_version . echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker push $IMAGE_NAME:$VERSION + echo "Pushing image $IMAGE_NAME:$publish_version to docker hub" + docker push $IMAGE_NAME:$publish_version jobs: build-and-test: diff --git a/version.py b/version.py index 9ded3c6..ac34449 100644 --- a/version.py +++ b/version.py @@ -15,4 +15,4 @@ # 0.1.0bN # Beta release # 0.1.0rcN # Release Candidate # 0.1.0 # Final release -__version__ = "0.1.0" +__version__ = "0.3.4" From fa874d27421b63e14f4c99aa035c1c0f93b01fd6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 10:12:26 -0700 Subject: [PATCH 32/60] correct circleci --- .circleci/config.yml | 98 ++++++++++++++++++++++------------ scripts/setup_env_variables.sh | 39 ++++++++++++++ setup.py | 21 +++++--- version.py | 19 +------ version.txt | 1 + 5 files changed, 119 insertions(+), 59 deletions(-) create mode 100755 scripts/setup_env_variables.sh create mode 100644 version.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e1735f..6c35e0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,10 @@ publish_docker: &publish_docker jobs: build-and-test: executor: python/default + working_directory: ~/algorithms steps: + # - attach_workspace: + # at: /home/circleci/project - checkout - python/load-cache - python/install-deps @@ -35,6 +38,18 @@ jobs: - run: command: python -c "import numpy; print(numpy.__version__)" name: Test + - run: + name: run test1 + command: | + t="ls -la" + eval $t + - run: + name: run test2 + command: | + bash ./scripts/setup_env_variables.sh + - run: + command: echo $BASE_BUILD_VERSION + name: Test build_publish_docker_latest: environment: @@ -43,12 +58,19 @@ jobs: <<: *publish_docker - build_publish_docker_version: - environment: - IMAGE_NAME: aivanou/test - VERSION: 0.2.0rc0 + # build_publish_docker_version: + # environment: + # IMAGE_NAME: aivanou/test + # VERSION: 0.2.0rc0 + # steps: + # + # - run: + # name: run test + # command: | + # bash ./scripts/setup_env_variables.sh - <<: *publish_docker + + # <<: *publish_docker verify_correct_version: @@ -57,7 +79,6 @@ jobs: steps: - checkout - - run: name: Verify git tag and version consistency command: | @@ -107,37 +128,46 @@ workflows: - build-and-test circleci-docs-workflow: jobs: - - verify_correct_version: - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*/ - - - build_publish_docker_version: - requires: - - verify_correct_version - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*/ - - - build_publish_docker_latest: - requires: - - verify_correct_version - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*/ - - - upload_to_pypi: - requires: - - verify_correct_version + - build-and-test: + # requires: + # - verify_correct_version filters: branches: ignore: /.*/ tags: only: /^v.*/ +# - verify_correct_version: +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v.*/ + +# - build_publish_docker_version: +# requires: +# - verify_correct_version +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v.*/ + +# - build_publish_docker_latest: +# requires: +# - verify_correct_version +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v.*/ +# +# - upload_to_pypi: +# requires: +# - verify_correct_version +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v.*/ +# diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh new file mode 100755 index 0000000..0b841a7 --- /dev/null +++ b/scripts/setup_env_variables.sh @@ -0,0 +1,39 @@ +#!/bin/sh +tagged_version() { + # Grabs version from either the env variable CIRCLE_TAG + if [[ -n "${CIRCLE_TAG:-}" ]]; then + echo "${CIRCLE_TAG}" + else + return 1 + fi +} + +TORCHELASTIC_BUILD_VERSION='cat ./version.txt' + +if tagged_version >/dev/null; then + # Grab git tag, remove prefixed v and remove everything after - + # Used to clean up tags that are for release candidates like v1.6.0-rc1 + # Turns tag v1.6.0-rc1 -> v1.6.0 + TORCHELASTIC_BUILD_VERSION="$(tagged_version)" +fi + +cat >>"$envfile" <>"$envfile" +echo ' $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)' >>"$envfile" +echo '}' >>"$envfile" +echo 'export -f retry' >>"$envfile" + +cat "$envfile" diff --git a/setup.py b/setup.py index bd5df89..98645cd 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ import os import re import sys +import subprocess from setuptools import find_packages, setup from setuptools.command.install import install @@ -19,7 +20,7 @@ class VerifyVersionCommand(install): description = 'verify that the git tag matches our version' def run(self): - tag = os.getenv('CIRCLE_TAG') + tag = os.getenv('TORCHELASTIC_BUILD_VERSION') tag_from_version = f"v{get_version()}" if tag != tag_from_version: @@ -31,12 +32,18 @@ def run(self): def get_version(): # get version string from version.py - # TODO: ideally the version.py should be generated when setup is run - version_file = os.path.join(os.path.dirname(__file__), "version.py") - version_regex = r"__version__ = ['\"]([^'\"]*)['\"]" - with open(version_file, "r") as f: - version = re.search(version_regex, f.read(), re.M).group(1) - return version + version = open('version.txt', 'r').read().strip() + sha = 'Unknown' + try: + cwd = os.path.dirname(os.path.abspath(__file__)) + sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip() + except Exception: + pass + + if 'TORCHELASTIC_BUILD_VERSION' not in os.environ and sha != 'Unknown': + version = f"{version}+{sha[:7]}" + + return version if __name__ == "__main__": diff --git a/version.py b/version.py index ac34449..168d258 100644 --- a/version.py +++ b/version.py @@ -1,18 +1 @@ -#!/usr/bin/env python3 - -# Copyright (c) Facebook, Inc. and its affiliates. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. - -# Follows PEP-0440 version scheme guidelines -# https://www.python.org/dev/peps/pep-0440/#version-scheme -# -# Examples: -# 0.1.0.devN # Developmental release -# 0.1.0aN # Alpha release -# 0.1.0bN # Beta release -# 0.1.0rcN # Release Candidate -# 0.1.0 # Final release -__version__ = "0.3.4" +t="0.3.4" \ No newline at end of file diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..448a0fa --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.3.4 \ No newline at end of file From bca6c8e1f81910d8e29448c202443a1f6348d12f Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 10:16:23 -0700 Subject: [PATCH 33/60] correct circleci --- .circleci/config.yml | 4 ++++ scripts/setup_env_variables.sh | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c35e0a..272166f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,6 +38,10 @@ jobs: - run: command: python -c "import numpy; print(numpy.__version__)" name: Test + - run: + name: run test0 + command: | + pwd - run: name: run test1 command: | diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index 0b841a7..c7cd187 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -17,6 +17,22 @@ if tagged_version >/dev/null; then TORCHELASTIC_BUILD_VERSION="$(tagged_version)" fi +# We need to write an envfile to persist these variables to following +# steps, but the location of the envfile depends on the circleci executor +if [[ "$(uname)" == Darwin ]]; then + # macos executor (builds and tests) + workdir="/Users/distiller/algorithms" +elif [[ -d "/home/circleci/algorithms" ]]; then + # machine executor (binary tests) + workdir="/home/circleci/algorithms" +else + # docker executor (binary builds) + workdir="/" +fi +envfile="$workdir/env" +touch "$envfile" +chmod +x "$envfile" + cat >>"$envfile" < Date: Mon, 20 Apr 2020 10:17:53 -0700 Subject: [PATCH 34/60] correct circleci --- scripts/setup_env_variables.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index c7cd187..adc01df 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -8,7 +8,7 @@ tagged_version() { fi } -TORCHELASTIC_BUILD_VERSION='cat ./version.txt' +BASE_BUILD_VERSION='cat ./version.txt' if tagged_version >/dev/null; then # Grab git tag, remove prefixed v and remove everything after - @@ -38,7 +38,7 @@ cat >>"$envfile" < Date: Mon, 20 Apr 2020 10:25:39 -0700 Subject: [PATCH 35/60] correct circleci --- .circleci/config.yml | 11 ++++++----- scripts/setup_env_variables.sh | 8 +++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 272166f..ac73933 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,11 +42,6 @@ jobs: name: run test0 command: | pwd - - run: - name: run test1 - command: | - t="ls -la" - eval $t - run: name: run test2 command: | @@ -54,6 +49,12 @@ jobs: - run: command: echo $BASE_BUILD_VERSION name: Test + - run: + name: run test1 + command: | + t="ls -la" + eval $t + cat ./env build_publish_docker_latest: environment: diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index adc01df..eb9d4c0 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -21,7 +21,7 @@ fi # steps, but the location of the envfile depends on the circleci executor if [[ "$(uname)" == Darwin ]]; then # macos executor (builds and tests) - workdir="/Users/distiller/algorithms" + workdir="/Users/aivanou/code/algorithms" elif [[ -d "/home/circleci/algorithms" ]]; then # machine executor (binary tests) workdir="/home/circleci/algorithms" @@ -33,7 +33,7 @@ envfile="$workdir/env" touch "$envfile" chmod +x "$envfile" -cat >>"$envfile" <>"$envfile" <>"$envfile" echo ' $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)' >>"$envfile" @@ -53,3 +53,5 @@ echo '}' >>"$envfile" echo 'export -f retry' >>"$envfile" cat "$envfile" + +eval "$envfile" From 2472d9b3005603225fa71b665fdf40bc56b8ca4d Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 17:33:21 +0000 Subject: [PATCH 36/60] correct circleci --- scripts/setup_env_variables.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index eb9d4c0..ccb16d4 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -34,7 +34,6 @@ touch "$envfile" chmod +x "$envfile" cat >>"$envfile" <>"$envfile" -echo ' $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)' >>"$envfile" -echo '}' >>"$envfile" -echo 'export -f retry' >>"$envfile" - -cat "$envfile" - -eval "$envfile" +source $envfile From e0f35a26bd193ee7f002f3b582dae73836f22f7c Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 17:39:18 +0000 Subject: [PATCH 37/60] correct circleci --- .circleci/config.yml | 1 + scripts/setup_env_variables.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac73933..f1c70b1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,6 +46,7 @@ jobs: name: run test2 command: | bash ./scripts/setup_env_variables.sh + source ~/env - run: command: echo $BASE_BUILD_VERSION name: Test diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index ccb16d4..52d4707 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -45,4 +45,4 @@ export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-}" export CIRCLE_BRANCH="$CIRCLE_BRANCH" END -source $envfile +cat $envfile From 4f2c5157d66e2c3be5872eb0cd6aa2ba0f6d0769 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 17:43:28 +0000 Subject: [PATCH 38/60] correct circleci --- scripts/setup_env_variables.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index 52d4707..84f7fcc 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -33,16 +33,15 @@ envfile="$workdir/env" touch "$envfile" chmod +x "$envfile" -cat >>"$envfile" <>$BASH_ENV +source $BASH_ENV From cd413027f693df4dace8cfe137cfe1eda109e150 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 17:45:04 +0000 Subject: [PATCH 39/60] correct circleci --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f1c70b1..ac73933 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,6 @@ jobs: name: run test2 command: | bash ./scripts/setup_env_variables.sh - source ~/env - run: command: echo $BASE_BUILD_VERSION name: Test From dd6a102a080a04fcd34a9e6facd08c7af59b7008 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 17:55:21 +0000 Subject: [PATCH 40/60] correct circleci --- .circleci/config.yml | 23 ++++++++++------------- scripts/setup_env_variables.sh | 21 +++++++++++++-------- setup.py | 2 ++ 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac73933..ad95328 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,25 +36,22 @@ jobs: - python/install-deps - python/save-cache - run: - command: python -c "import numpy; print(numpy.__version__)" - name: Test - - run: - name: run test0 + name: Setup Environment Variables command: | - pwd + echo "export MY_VAR=TEST" >> $BASH_ENV + - run: - name: run test2 + name: Read Environment Variables command: | - bash ./scripts/setup_env_variables.sh + echo $MY_VAR - run: - command: echo $BASE_BUILD_VERSION - name: Test + name: Read Environment Variables + command: | + echo $MY_VAR - run: - name: run test1 + name: Verify git tag and version consistency command: | - t="ls -la" - eval $t - cat ./env + python3 setup.py verify build_publish_docker_latest: environment: diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index 84f7fcc..26579ad 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -33,15 +33,20 @@ envfile="$workdir/env" touch "$envfile" chmod +x "$envfile" +cat >>"$envfile" <>$BASH_ENV -source $BASH_ENV +export CIRCLE_TAG="${CIRCLE_TAG:-}" +export CIRCLE_SHA1="$CIRCLE_SHA1" +export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-}" +export CIRCLE_BRANCH="$CIRCLE_BRANCH" +END + +#echo 'export BASE_BUILD_VERSION=$BASE_BUILD_VERSION' >> $BASH_ENV + +echo $envfile + +source $envfile diff --git a/setup.py b/setup.py index 98645cd..3427aae 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,8 @@ class VerifyVersionCommand(install): description = 'verify that the git tag matches our version' def run(self): + myvar = os.getenv('MY_VAR') + print('myvar: ', myvar) tag = os.getenv('TORCHELASTIC_BUILD_VERSION') tag_from_version = f"v{get_version()}" From 5dcf8141fdb55a4c9d949d69801b054f9cc86b2f Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:06:09 +0000 Subject: [PATCH 41/60] correct circleci --- .circleci/config.yml | 34 +++++++------ scripts/setup_env_variables.sh | 92 ++++++++++++++++++---------------- setup.py | 18 ++++--- 3 files changed, 78 insertions(+), 66 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ad95328..3d13729 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,24 @@ version: 2.1 orbs: python: circleci/python@0.2.1 + +setup_env_variables: &setup_env_variables + - run: + name: Setup env variables + command: | + tagged_version() { + # Grabs version from either the env variable CIRCLE_TAG + if [[ -n "${CIRCLE_TAG}" ]]; then + echo "${CIRCLE_TAG}" + else + eval 'cat ./version.txt' + fi + } + + BASE_BUILD_VERSION="$(tagged_version)" + echo "export BASE_BUILD_VERSION=$BASE_BUILD_VERSION" >> $BASH_ENV + + publish_docker: &publish_docker docker: - image: circleci/buildpack-deps:stretch @@ -29,25 +47,11 @@ jobs: executor: python/default working_directory: ~/algorithms steps: - # - attach_workspace: - # at: /home/circleci/project - checkout - python/load-cache - python/install-deps - python/save-cache - - run: - name: Setup Environment Variables - command: | - echo "export MY_VAR=TEST" >> $BASH_ENV - - - run: - name: Read Environment Variables - command: | - echo $MY_VAR - - run: - name: Read Environment Variables - command: | - echo $MY_VAR + <<: *setup_env_variables - run: name: Verify git tag and version consistency command: | diff --git a/scripts/setup_env_variables.sh b/scripts/setup_env_variables.sh index 26579ad..6a62314 100755 --- a/scripts/setup_env_variables.sh +++ b/scripts/setup_env_variables.sh @@ -1,52 +1,56 @@ #!/bin/sh tagged_version() { # Grabs version from either the env variable CIRCLE_TAG - if [[ -n "${CIRCLE_TAG:-}" ]]; then + if [[ -n "${CIRCLE_TAG}" ]]; then echo "${CIRCLE_TAG}" else - return 1 + eval 'cat ./version.txt' fi } -BASE_BUILD_VERSION='cat ./version.txt' - -if tagged_version >/dev/null; then - # Grab git tag, remove prefixed v and remove everything after - - # Used to clean up tags that are for release candidates like v1.6.0-rc1 - # Turns tag v1.6.0-rc1 -> v1.6.0 - TORCHELASTIC_BUILD_VERSION="$(tagged_version)" -fi - -# We need to write an envfile to persist these variables to following -# steps, but the location of the envfile depends on the circleci executor -if [[ "$(uname)" == Darwin ]]; then - # macos executor (builds and tests) - workdir="/Users/aivanou/code/algorithms" -elif [[ -d "/home/circleci/algorithms" ]]; then - # machine executor (binary tests) - workdir="/home/circleci/algorithms" -else - # docker executor (binary builds) - workdir="/" -fi -envfile="$workdir/env" -touch "$envfile" -chmod +x "$envfile" - -cat >>"$envfile" <> $BASH_ENV - -echo $envfile - -source $envfile +BASE_BUILD_VERSION="$(tagged_version)" + +echo $BASE_BUILD_VERSION + +#BASE_BUILD_VERSION='cat ./version.txt' +# +#if tagged_version >/dev/null; then +# # Grab git tag, remove prefixed v and remove everything after - +# # Used to clean up tags that are for release candidates like v1.6.0-rc1 +# # Turns tag v1.6.0-rc1 -> v1.6.0 +# TORCHELASTIC_BUILD_VERSION="$(tagged_version)" +#fi +# +## We need to write an envfile to persist these variables to following +## steps, but the location of the envfile depends on the circleci executor +#if [[ "$(uname)" == Darwin ]]; then +# # macos executor (builds and tests) +# workdir="/Users/aivanou/code/algorithms" +#elif [[ -d "/home/circleci/algorithms" ]]; then +# # machine executor (binary tests) +# workdir="/home/circleci/algorithms" +#else +# # docker executor (binary builds) +# workdir="/" +#fi +#envfile="$workdir/env" +#touch "$envfile" +#chmod +x "$envfile" +# +#cat >>"$envfile" <> $BASH_ENV +# +#echo $envfile +# +#source $envfile diff --git a/setup.py b/setup.py index 3427aae..39ff020 100644 --- a/setup.py +++ b/setup.py @@ -20,14 +20,18 @@ class VerifyVersionCommand(install): description = 'verify that the git tag matches our version' def run(self): - myvar = os.getenv('MY_VAR') - print('myvar: ', myvar) - tag = os.getenv('TORCHELASTIC_BUILD_VERSION') - tag_from_version = f"v{get_version()}" + if 'BASE_BUILD_VERSION' not in os.environ: + info = "Setup BASE_BUILD_VERSION variable to run verify command" + sys.exit(info) + + base_version = os.getenv('BASE_BUILD_VERSION') + if base_version[0] == 'v': + base_version = base_version[1:] + file_version = f"{get_version()}" - if tag != tag_from_version: + if base_version != file_version: info = "Git tag: {0} does not match the version: {1}".format( - tag, get_version() + base_version, file_version ) sys.exit(info) @@ -42,7 +46,7 @@ def get_version(): except Exception: pass - if 'TORCHELASTIC_BUILD_VERSION' not in os.environ and sha != 'Unknown': + if 'BASE_BUILD_VERSION' not in os.environ and sha != 'Unknown': version = f"{version}+{sha[:7]}" return version From 687e2cb0abf5bd00b4d8ea4ef48fc17a1c1b17c5 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:25:58 +0000 Subject: [PATCH 42/60] correct circleci --- .circleci/config.yml | 86 +++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3d13729..3edcd6c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,8 @@ setup_env_variables: &setup_env_variables } BASE_BUILD_VERSION="$(tagged_version)" + # Since the tag starts with the 'v' we remove the first symbol to get version. + TORCHELASTIC_BUILD_VERSION=${BASE_BUILD_VERSION:1} echo "export BASE_BUILD_VERSION=$BASE_BUILD_VERSION" >> $BASH_ENV @@ -51,7 +53,7 @@ jobs: - python/load-cache - python/install-deps - python/save-cache - <<: *setup_env_variables + - <<: *setup_env_variables - run: name: Verify git tag and version consistency command: | @@ -64,19 +66,12 @@ jobs: <<: *publish_docker - # build_publish_docker_version: - # environment: - # IMAGE_NAME: aivanou/test - # VERSION: 0.2.0rc0 - # steps: - # - # - run: - # name: run test - # command: | - # bash ./scripts/setup_env_variables.sh + build_publish_docker_version: + environment: + IMAGE_NAME: aivanou/test + VERSION: 0.2.0rc0 - - # <<: *publish_docker + <<: *publish_docker verify_correct_version: @@ -85,6 +80,7 @@ jobs: steps: - checkout + - <<: *setup_env_variables - run: name: Verify git tag and version consistency command: | @@ -135,45 +131,37 @@ workflows: circleci-docs-workflow: jobs: - build-and-test: - # requires: - # - verify_correct_version + - verify_correct_version: + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + + - build_publish_docker_version: + requires: + - verify_correct_version + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + + - build_publish_docker_latest: + requires: + - verify_correct_version + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + + - upload_to_pypi: + requires: + - verify_correct_version filters: branches: ignore: /.*/ tags: only: /^v.*/ -# - verify_correct_version: -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v.*/ - -# - build_publish_docker_version: -# requires: -# - verify_correct_version -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v.*/ - -# - build_publish_docker_latest: -# requires: -# - verify_correct_version -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v.*/ -# -# - upload_to_pypi: -# requires: -# - verify_correct_version -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v.*/ -# From d81ff3f0b77f2889be090925fe04a2547cc28814 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:30:31 +0000 Subject: [PATCH 43/60] correct circleci --- .circleci/config.yml | 97 ++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3edcd6c..eee545b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -66,12 +66,12 @@ jobs: <<: *publish_docker - build_publish_docker_version: - environment: - IMAGE_NAME: aivanou/test - VERSION: 0.2.0rc0 + build_publish_docker_version: + environment: + IMAGE_NAME: aivanou/test + VERSION: 0.2.0rc0 - <<: *publish_docker + <<: *publish_docker verify_correct_version: @@ -87,41 +87,41 @@ jobs: python3 setup.py verify - upload_to_pypi: - - docker: - - image: circleci/python:3.6 - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v2-cpu-dependencies-{{ checksum "requirements.txt" }} - # fallback to using the latest cache if no exact match is found - - v2-cpu-dependencies- - - - run: - name: Install python deps - command: | - sudo pip install twine - - - run: - name: Setup .pypirc - command: | - echo -e "[pypi]" >> ~/.pypirc - echo -e "username = $PYPI_USERNAME" >> ~/.pypirc - echo -e "password = $PYPI_PWD" >> ~/.pypirc - - run: - name: Build packages - command: | - python3 setup.py sdist bdist_wheel - - - run: - name: Upload packages - command: | - python3 -m twine upload dist/* +# upload_to_pypi: +# +# docker: +# - image: circleci/python:3.6 +# +# steps: +# - checkout +# +# # Download and cache dependencies +# - restore_cache: +# keys: +# - v2-cpu-dependencies-{{ checksum "requirements.txt" }} +# # fallback to using the latest cache if no exact match is found +# - v2-cpu-dependencies- +# +# - run: +# name: Install python deps +# command: | +# sudo pip install twine +# +# - run: +# name: Setup .pypirc +# command: | +# echo -e "[pypi]" >> ~/.pypirc +# echo -e "username = $PYPI_USERNAME" >> ~/.pypirc +# echo -e "password = $PYPI_PWD" >> ~/.pypirc +# - run: +# name: Build packages +# command: | +# python3 setup.py sdist bdist_wheel +# +# - run: +# name: Upload packages +# command: | +# python3 -m twine upload dist/* workflows: @@ -130,7 +130,6 @@ workflows: - build-and-test circleci-docs-workflow: jobs: - - build-and-test: - verify_correct_version: filters: branches: @@ -156,12 +155,12 @@ workflows: tags: only: /^v.*/ - - upload_to_pypi: - requires: - - verify_correct_version - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*/ +# - upload_to_pypi: +# requires: +# - verify_correct_version +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v.*/ From ad5394a8b6135a9c310844145ca2e8a57b18ebf8 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:34:51 +0000 Subject: [PATCH 44/60] correct circleci --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 448a0fa..449d7e7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.4 \ No newline at end of file +0.3.6 From 612177413d825178bce1f8caca2b00715fea6748 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:37:30 +0000 Subject: [PATCH 45/60] correct circleci --- .circleci/config.yml | 86 ++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eee545b..1757783 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,41 +87,41 @@ jobs: python3 setup.py verify -# upload_to_pypi: -# -# docker: -# - image: circleci/python:3.6 -# -# steps: -# - checkout -# -# # Download and cache dependencies -# - restore_cache: -# keys: -# - v2-cpu-dependencies-{{ checksum "requirements.txt" }} -# # fallback to using the latest cache if no exact match is found -# - v2-cpu-dependencies- -# -# - run: -# name: Install python deps -# command: | -# sudo pip install twine -# -# - run: -# name: Setup .pypirc -# command: | -# echo -e "[pypi]" >> ~/.pypirc -# echo -e "username = $PYPI_USERNAME" >> ~/.pypirc -# echo -e "password = $PYPI_PWD" >> ~/.pypirc -# - run: -# name: Build packages -# command: | -# python3 setup.py sdist bdist_wheel -# -# - run: -# name: Upload packages -# command: | -# python3 -m twine upload dist/* + upload_to_pypi: + + docker: + - image: circleci/python:3.6 + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v2-cpu-dependencies-{{ checksum "requirements.txt" }} + # fallback to using the latest cache if no exact match is found + - v2-cpu-dependencies- + + - run: + name: Install python deps + command: | + sudo pip install twine + + - run: + name: Setup .pypirc + command: | + echo -e "[pypi]" >> ~/.pypirc + echo -e "username = $PYPI_USERNAME" >> ~/.pypirc + echo -e "password = $PYPI_PWD" >> ~/.pypirc + - run: + name: Build packages + command: | + python3 setup.py sdist bdist_wheel + + - run: + name: Upload packages + command: | + python3 -m twine upload dist/* workflows: @@ -155,12 +155,12 @@ workflows: tags: only: /^v.*/ -# - upload_to_pypi: -# requires: -# - verify_correct_version -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v.*/ + - upload_to_pypi: + requires: + - verify_correct_version + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ From 20562ef64f2e9c30c4429eeb0340ed973b344ca8 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:37:45 +0000 Subject: [PATCH 46/60] correct circleci --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 449d7e7..0f82685 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.6 +0.3.7 From 8b2e8b1087f86d593fafe672e924a5c5878b133c Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:50:45 +0000 Subject: [PATCH 47/60] correct circleci --- .circleci/config.yml | 1 + version.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1757783..30b8aaf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -94,6 +94,7 @@ jobs: steps: - checkout + - <<: *setup_env_variables # Download and cache dependencies - restore_cache: diff --git a/version.txt b/version.txt index 0f82685..6678432 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.7 +0.3.8 From 11159e5d845473a58df90c36e60c043484941bca Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:54:19 +0000 Subject: [PATCH 48/60] correct circleci --- version.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 version.py diff --git a/version.py b/version.py deleted file mode 100644 index 168d258..0000000 --- a/version.py +++ /dev/null @@ -1 +0,0 @@ -t="0.3.4" \ No newline at end of file From 529c45ef0daace5857d968596a7603f96cdb90e6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 20 Apr 2020 18:54:39 +0000 Subject: [PATCH 49/60] correct circleci --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 6678432..940ac09 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.8 +0.3.9 From c4ab469cbf6ffb312ec30481ce1c698b6add70f2 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:00:58 -0700 Subject: [PATCH 50/60] correct circleci --- .circleci/config.yml | 48 +++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30b8aaf..d5e182f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,8 @@ setup_env_variables: &setup_env_variables command: | tagged_version() { # Grabs version from either the env variable CIRCLE_TAG - if [[ -n "${CIRCLE_TAG}" ]]; then + # Note: we assume that all tags start with prefix 'v' + if [[ -n "${CIRCLE_TAG}#v" ]]; then echo "${CIRCLE_TAG}" else eval 'cat ./version.txt' @@ -19,7 +20,7 @@ setup_env_variables: &setup_env_variables BASE_BUILD_VERSION="$(tagged_version)" # Since the tag starts with the 'v' we remove the first symbol to get version. - TORCHELASTIC_BUILD_VERSION=${BASE_BUILD_VERSION:1} + BASE_BUILD_VERSION=${BASE_BUILD_VERSION} echo "export BASE_BUILD_VERSION=$BASE_BUILD_VERSION" >> $BASH_ENV @@ -37,12 +38,11 @@ publish_docker: &publish_docker echo "ERROR: the workflow should only be executed on the tag" exit 1 fi - publish_version=${CIRCLE_TAG#"v."} - echo "Buiding image $IMAGE_NAME:$publish_version" - docker build -t $IMAGE_NAME:$publish_version . + echo "Buiding image $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION" + docker build -t $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION . echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "Pushing image $IMAGE_NAME:$publish_version to docker hub" - docker push $IMAGE_NAME:$publish_version + echo "Pushing image $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION to docker hub" + docker push $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION jobs: build-and-test: @@ -59,13 +59,6 @@ jobs: command: | python3 setup.py verify - build_publish_docker_latest: - environment: - IMAGE_NAME: aivanou/test - VERSION: latest - - <<: *publish_docker - build_publish_docker_version: environment: IMAGE_NAME: aivanou/test @@ -76,7 +69,7 @@ jobs: verify_correct_version: docker: - - image: circleci/python:3.6 + - image: default steps: - checkout @@ -147,21 +140,12 @@ workflows: tags: only: /^v.*/ - - build_publish_docker_latest: - requires: - - verify_correct_version - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*/ - - - upload_to_pypi: - requires: - - verify_correct_version - filters: - branches: - ignore: /.*/ - tags: - only: /^v.*/ +# - upload_to_pypi: +# requires: +# - verify_correct_version +# filters: +# branches: +# ignore: /.*/ +# tags: +# only: /^v.*/ From accbfbad054a2173dc095fa72596f3338c15f563 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:04:17 -0700 Subject: [PATCH 51/60] correct circleci --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 940ac09..5503126 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.9 +0.3.10 From daa8efe6053557cc431a2cd7e0622fa6ef3b96df Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:09:44 -0700 Subject: [PATCH 52/60] correct circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d5e182f..c73196b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,7 +69,7 @@ jobs: verify_correct_version: docker: - - image: default + - image: circleci/python:3.6 steps: - checkout From f41f78d18692f7891d5f9894254fbf6c664e5c30 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:16:51 -0700 Subject: [PATCH 53/60] correct circleci --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c73196b..c3731b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,8 +19,7 @@ setup_env_variables: &setup_env_variables } BASE_BUILD_VERSION="$(tagged_version)" - # Since the tag starts with the 'v' we remove the first symbol to get version. - BASE_BUILD_VERSION=${BASE_BUILD_VERSION} + echo "Setting BASE_BUILD_VERSION as $BASE_BUILD_VERSION" echo "export BASE_BUILD_VERSION=$BASE_BUILD_VERSION" >> $BASH_ENV @@ -38,11 +37,12 @@ publish_docker: &publish_docker echo "ERROR: the workflow should only be executed on the tag" exit 1 fi - echo "Buiding image $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION" - docker build -t $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION . + echo "Buiding image $IMAGE_NAME:$BASE_BUILD_VERSION" + docker build -t $IMAGE_NAME:$BASE_BUILD_VERSION . + echo "Using docker username: $DOCKER_USERNAME" echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "Pushing image $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION to docker hub" - docker push $IMAGE_NAME:$TORCHELASTIC_BUILD_VERSION + echo "Pushing image $IMAGE_NAME:$BASE_BUILD_VERSION to docker hub" + docker push $IMAGE_NAME:$BASE_BUILD_VERSION jobs: build-and-test: From e7d9206e7b3d0e94ab1dc897369b88a630533111 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:29:10 -0700 Subject: [PATCH 54/60] correct circleci --- .circleci/config.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3731b0..3d4f1d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,8 +11,8 @@ setup_env_variables: &setup_env_variables tagged_version() { # Grabs version from either the env variable CIRCLE_TAG # Note: we assume that all tags start with prefix 'v' - if [[ -n "${CIRCLE_TAG}#v" ]]; then - echo "${CIRCLE_TAG}" + if [[ -n "${CIRCLE_TAG}" ]]; then + echo "${CIRCLE_TAG#v}" else eval 'cat ./version.txt' fi @@ -37,6 +37,11 @@ publish_docker: &publish_docker echo "ERROR: the workflow should only be executed on the tag" exit 1 fi + if [[ -z ${BASE_BUILD_VERSION} ]]; then + echo "ERROR: Set up the base build version by running setup_env_variables macros" + exit 1 + fi + echo "Buiding image $IMAGE_NAME:$BASE_BUILD_VERSION" docker build -t $IMAGE_NAME:$BASE_BUILD_VERSION . echo "Using docker username: $DOCKER_USERNAME" From 96c3b1910765ccda779beb5ba09f518b4d83aa7f Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:36:27 -0700 Subject: [PATCH 55/60] correct circleci --- .circleci/config.yml | 57 +++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3d4f1d6..30984b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,30 +24,25 @@ setup_env_variables: &setup_env_variables publish_docker: &publish_docker - docker: - - image: circleci/buildpack-deps:stretch - - steps: - - checkout - - setup_remote_docker - - run: - name: Build Docker image - command: | - if [[ -z ${CIRCLE_TAG} ]]; then - echo "ERROR: the workflow should only be executed on the tag" - exit 1 - fi - if [[ -z ${BASE_BUILD_VERSION} ]]; then - echo "ERROR: Set up the base build version by running setup_env_variables macros" - exit 1 - fi - echo "Buiding image $IMAGE_NAME:$BASE_BUILD_VERSION" - docker build -t $IMAGE_NAME:$BASE_BUILD_VERSION . - echo "Using docker username: $DOCKER_USERNAME" - echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "Pushing image $IMAGE_NAME:$BASE_BUILD_VERSION to docker hub" - docker push $IMAGE_NAME:$BASE_BUILD_VERSION + - run: + name: Build Docker image + command: | + if [[ -z ${CIRCLE_TAG} ]]; then + echo "ERROR: the workflow should only be executed on the tag" + exit 1 + fi + if [[ -z ${BASE_BUILD_VERSION} ]]; then + echo "ERROR: Set up the base build version by running setup_env_variables macros" + exit 1 + fi + + echo "Buiding image $IMAGE_NAME:$BASE_BUILD_VERSION" + docker build -t $IMAGE_NAME:$BASE_BUILD_VERSION . + echo "Using docker username: $DOCKER_USERNAME" + echo "$DOCKER_PWD" | docker login -u "$DOCKER_USERNAME" --password-stdin + echo "Pushing image $IMAGE_NAME:$BASE_BUILD_VERSION to docker hub" + docker push $IMAGE_NAME:$BASE_BUILD_VERSION jobs: build-and-test: @@ -65,11 +60,17 @@ jobs: python3 setup.py verify build_publish_docker_version: - environment: - IMAGE_NAME: aivanou/test - VERSION: 0.2.0rc0 + docker: + - image: circleci/buildpack-deps:stretch + + steps: + - checkout + + - setup_remote_docker + + - <<: *setup_env_variables - <<: *publish_docker + - <<: *publish_docker verify_correct_version: @@ -130,6 +131,7 @@ workflows: circleci-docs-workflow: jobs: - verify_correct_version: + context: test_ctx filters: branches: ignore: /.*/ @@ -137,6 +139,7 @@ workflows: only: /^v.*/ - build_publish_docker_version: + context: test_ctx requires: - verify_correct_version filters: From e1ca58836f4243fa4384b6f7e762e7e959b5c834 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:41:58 -0700 Subject: [PATCH 56/60] correct circleci --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30984b0..eaf5568 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,6 +60,9 @@ jobs: python3 setup.py verify build_publish_docker_version: + environment: + IMAGE_NAME: aivanou/test + docker: - image: circleci/buildpack-deps:stretch From e02d2c906819a2eb704ad88020220246384d622a Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Mon, 27 Apr 2020 17:45:37 -0700 Subject: [PATCH 57/60] correct circleci --- .circleci/config.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eaf5568..2af376e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,12 +151,13 @@ workflows: tags: only: /^v.*/ -# - upload_to_pypi: -# requires: -# - verify_correct_version -# filters: -# branches: -# ignore: /.*/ -# tags: -# only: /^v.*/ + - upload_to_pypi: + context: test_ctx + requires: + - verify_correct_version + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ From 50b7e9c35b11d019c2be85d236d98a8a8aa6f84f Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Wed, 29 Apr 2020 15:31:23 -0700 Subject: [PATCH 58/60] correct circleci --- CHANGELOG | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 CHANGELOG diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..59345f5 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,10 @@ +t # CHANGELOG + +## 1.0.0 (April 29, 2020) + +### Test header + +* Test point [link] + + +[link]: https://github.com/tierex/algorithms From 19e8d3d04ab2c351679b86431e3cd27b2698a0fd Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Wed, 29 Apr 2020 15:31:44 -0700 Subject: [PATCH 59/60] correct circleci --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 59345f5..8f1458e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -t # CHANGELOG +# CHANGELOG ## 1.0.0 (April 29, 2020) From 5d73a24e5773cfc3b24ed66dacb644db7e6658e9 Mon Sep 17 00:00:00 2001 From: Aliaksandr Ivanou Date: Wed, 29 Apr 2020 15:32:51 -0700 Subject: [PATCH 60/60] correct circleci --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8f1458e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# CHANGELOG + +## 1.0.0 (April 29, 2020) + +### Test header + +* Test point [link] + + +[link]: https://github.com/tierex/algorithms