From a4171988eb4df46ab97c60394c10387761c38f9f Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 21:33:53 +0200 Subject: [PATCH 1/7] ci: add job to deploy package to test.pypi.org and job to install & test package after download --- .circleci/config.yml | 49 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 96cee76..a399e4f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,7 +88,7 @@ jobs: name: Upload the code coverage measurements to codecov.io, resulted from running the test suite (unit tests) command: ./.codecov - deploy-to-staging: + testpypi-install-n-test: executor: py38-docker-image steps: - checkout @@ -103,14 +103,24 @@ jobs: command: tox -e build -vv - run: name: Deploy package (source distro & wheel) to 'testpypi' (index) server - command: | - export SOFTWARE_PATTERNS_LIB_VERSION=$(python scripts/parse_package_version.py) - tox -e deploy -vv + command: tox -e deploy -vv + + integration-test: + executor: py38-docker-image + steps: + - checkout + - run: + name: Install the package from test.pypi.org + command: pip install --no-deps --index test.pypi.org software-patterns + - run: + name: Install pytest, which is used both in the test suite code and as a test runner + command: pip install pytest + - run: + name: Run the test suite (unit-tests) + command: pytest tests -v visualize_code: executor: py38-docker-image - environment: - NST_DEPS_GRAPHS: dependency-graphs steps: - checkout - run: sudo apt-get update -y --allow-releaseinfo-change @@ -162,8 +172,7 @@ workflows: branches: only: - master - - dev - - release-staging + - visualize-code # - build-documentation: # filters: @@ -172,15 +181,15 @@ workflows: # - master # - dev # - release-staging - # - deploy-to-staging: - # requires: - # - build_n_test - # filters: - # branches: - # only: release-staging - # - integration-test: - # requires: - # - deploy-to-staging - # filters: - # branches: - # only: release-staging + - testpypi-install-n-test: + requires: + - build_n_test + filters: + branches: + only: test-pypi + - integration-test: + requires: + - testpypi-install-n-test + filters: + branches: + only: test-pypi From 45ae98559b35f30e2e9a7fad425e815260e00df8 Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 21:34:55 +0200 Subject: [PATCH 2/7] chore(tox): revamp automation scripts --- CHANGELOG.rst | 13 +++++++++++++ tox.ini | 16 +++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 CHANGELOG.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..e07cd8f --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,13 @@ +0.9.0 (2021-12-09) +------------------ + +Changes +^^^^^^^ + +feature +""""""" +- add memoize, notification, proxy & subclass registry software design patterns + +ci +"" +- define jobs (ie build_n_test) and a workflow to run on CircleCI diff --git a/tox.ini b/tox.ini index ce20153..25e30f9 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,7 @@ setenv = JUNIT_TEST_RESULTS=junit-test-results.xml PY_PACKAGE=software_patterns + DIST_DIR=dist-dir deps = pytest pytest-cov @@ -76,19 +77,19 @@ commands = [testenv:build] -description = Create/build the python package/distribution. - Creates .tar.gz and .whl files in the 'dist' folder, that can be upload to a pypi index server. +description = Create a source and wheel distribution. + Creates .tar.gz and .whl files in the 'dist-dir' folder, that can be upload to a pypi index server. basepython = {env:TOXPYTHON:python3} deps = setuptools >= 40.0.0 skip_install = true commands_pre = - # Delete the 'dist' directory and its contents if found - python -c 'import os; import shutil; exec("if os.path.exists(os.path.join(\"{toxinidir}\", \"dist\")):\n shutil.rmtree(os.path.join(\"{toxinidir}\", \"dist\"))")' + # Delete the 'dist-dir' directory and its contents if found + python -c 'import os; import shutil; exec("if os.path.exists(os.path.join(\"{toxinidir}\", \"{env:DIST_DIR}\")):\n shutil.rmtree(os.path.join(\"{toxinidir}\", \"{env:DIST_DIR}\"))")' # Create a setup.py file that simply invokes setuptools.setup without arguments (since all metadata required for building using setuptools should be present in non python files pyproject.toml and/or setup.cfg) python -c 'import os; setup_py = os.path.join("{toxinidir}", "setup.py"); string = "from setuptools import setup\nsetup()"; exec("if not os.path.exists(setup_py):\n with open(setup_py, \"x\") as f:\n f.write(string)")' commands = - python setup.py sdist bdist_wheel + python setup.py sdist -d dist-dir bdist_wheel -d dist-dir commands_post = # Delete the generated setup.py file python -c 'import os; setup_py = os.path.join("{toxinidir}", "setup.py"); exec("if os.path.exists(setup_py):\n os.remove(setup_py)");' @@ -109,9 +110,10 @@ deps = skip_install = true commands_pre = # check whether the distribution’s long description will render correctly on PyPI - twine check dist/software[\-_]patterns-{env:SOFTWARE_PATTERNS_LIB_VERSION:PLEASE_INDICATE_THE_SEM_VER_FOR_RELEASE}* + ; twine check {env:DIST_DIR}/software[\-_]patterns-{env:SOFTWARE_PATTERNS_LIB_VERSION:}* + twine check {env:DIST_DIR}/{env:PY_PACKAGE}-{env:SOFTWARE_PATTERNS_LIB_VERSION:}* commands = - twine {posargs:upload --non-interactive} --repository {env:PYPI_SERVER:testpypi --skip-existing} dist/software[\-_]design-{env:SOFTWARE_PATTERNS_LIB_VERSION:PLEASE_INDICATE_THE_SEM_VER_FOR_RELEASE}* --verbose + twine {posargs:upload --non-interactive} --repository {env:PYPI_SERVER:testpypi --skip-existing} {env:DIST_DIR}/{env:PY_PACKAGE}-{env:SOFTWARE_PATTERNS_LIB_VERSION:}* --verbose ## STATIC ANALYSIS OF CODE From c3a6db65bb7e482a839b9f99dbb1dbea93f7f150 Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 21:40:36 +0200 Subject: [PATCH 3/7] docs(readme): bump semantic version to 0.9.0 --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2c3a593..1514b4e 100644 --- a/README.rst +++ b/README.rst @@ -69,9 +69,9 @@ Install from the Pypi server: :alt: PyPI - Python Version :target: https://pypi.org/project/software-patterns -.. |commits_since| image:: https://img.shields.io/github/commits-since/boromir674/software-patterns/v0.6.1/master?color=blue&logo=Github +.. |commits_since| image:: https://img.shields.io/github/commits-since/boromir674/software-patterns/v0.9.0/master?color=blue&logo=Github :alt: GitHub commits since tagged version (branch) - :target: https://github.com/boromir674/software-patterns/compare/v0.6.1..master + :target: https://github.com/boromir674/software-patterns/compare/v0.9.0..master From 0c020a856541f9da4944fff04f8057b4ff23c585 Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 21:41:06 +0200 Subject: [PATCH 4/7] chore(setup.cfg): bump semantic version to 0.9.0 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 9b42ec9..dd9eae3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] ## Setuptools specific information name = software_patterns -version = 0.8.0 +version = 0.9.0 description = Software Design Patterns with types in Python. long_description = file: README.rst long_description_content_type = text/x-rst From 34bc65f907cddfc2b701b3e207c776f243850362 Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 21:44:14 +0200 Subject: [PATCH 5/7] chore: fix ci config file syntax --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a399e4f..be85f82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,7 +105,7 @@ jobs: name: Deploy package (source distro & wheel) to 'testpypi' (index) server command: tox -e deploy -vv - integration-test: + integration-test: executor: py38-docker-image steps: - checkout From 7b439d7af7193f1a021fe5d4b99a87f3ac451bda Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 21:49:54 +0200 Subject: [PATCH 6/7] chore(setup.cfg): ignore CHNAGELOG.rst file from being added to the source distribution --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index dd9eae3..c4de259 100644 --- a/setup.cfg +++ b/setup.cfg @@ -92,3 +92,4 @@ ignore = .pylintrc .prospector.yml .DS_Store + CHANGELOG.rst From 50946adb61a8dec861585aee796c24bd5bb8b4ff Mon Sep 17 00:00:00 2001 From: Konstantinos Date: Thu, 9 Dec 2021 22:21:05 +0200 Subject: [PATCH 7/7] ci: fix the installation command for job 'integration-test' --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index be85f82..b201abb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,7 +111,7 @@ jobs: - checkout - run: name: Install the package from test.pypi.org - command: pip install --no-deps --index test.pypi.org software-patterns + command: pip install --no-deps --index-url https://test.pypi.org/simple/ software-patterns - run: name: Install pytest, which is used both in the test suite code and as a test runner command: pip install pytest