From 6694ae4c75695978f89a14c92262938f97368c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 11 Jul 2019 16:34:12 +0800 Subject: [PATCH] Build ecommerce images as part of CI --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++-- MANIFEST.in | 1 + setup.py | 7 +++++-- tutorecommerce/__about__.py | 1 + tutorecommerce/__init__.py | 0 tutorecommerce/plugin.py | 7 +++++-- 6 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 tutorecommerce/__about__.py create mode 100644 tutorecommerce/__init__.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fa850c1..0bb33bb4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,35 @@ -deploy: +build:ecommerce-images: + script: + - apk add --no-cache docker + - python setup.py install + - tutor plugins enable ecommerce + - tutor config save + - tutor images build ecommerce + - tutor images build ecommerce_worker + only: + refs: + - master + tags: + - private + stage: build + +deploy:images: + script: + - apk add --no-cache docker + - python setup.py install + - tutor plugins enable ecommerce + - tutor config save + - tutor images push ecommerce + - tutor images push ecommerce_worker + only: + refs: + - master + tags: + - private + stage: deploy + +deploy:pypi: script: - - apk add --no-cache make - pip3 install -U setuptools twine - python3 setup.py sdist - twine upload --skip-existing dist/tutor-ecommerce*.tar.gz @@ -9,3 +38,4 @@ deploy: - master tags: - private + stage: deploy diff --git a/MANIFEST.in b/MANIFEST.in index aacea676..768ecaaa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ recursive-include tutorecommerce/patches * +recursive-include tutorecommerce/templates * diff --git a/setup.py b/setup.py index 6bb981b5..18b29f0b 100644 --- a/setup.py +++ b/setup.py @@ -7,15 +7,18 @@ with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f: readme = f.read() +about = {} +with io.open(os.path.join(here, "tutorecommerce", "__about__.py"), "rt", encoding="utf-8") as f: + exec(f.read(), about) setup( name="tutor-ecommerce", - version="0.1.1", + version=about["__version__"], url="https://docs.tutor.overhang.io/", project_urls={ "Documentation": "https://docs.tutor.overhang.io/", "Code": "https://github.com/overhangio/tutor-ecommerce", - "Issue tracker": "https://github.com/overhangio/tutor/issues", + "Issue tracker": "https://github.com/overhangio/tutor-ecommerce/issues", "Community": "https://discuss.overhang.io", }, license="AGPLv3", diff --git a/tutorecommerce/__about__.py b/tutorecommerce/__about__.py new file mode 100644 index 00000000..b3f47562 --- /dev/null +++ b/tutorecommerce/__about__.py @@ -0,0 +1 @@ +__version__ = "0.1.2" diff --git a/tutorecommerce/__init__.py b/tutorecommerce/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tutorecommerce/plugin.py b/tutorecommerce/plugin.py index c9449bd9..2671d319 100644 --- a/tutorecommerce/plugin.py +++ b/tutorecommerce/plugin.py @@ -1,6 +1,8 @@ from glob import glob import os +from .__about__ import __version__ + HERE = os.path.abspath(os.path.dirname(__file__)) templates = os.path.join(HERE, "templates") @@ -42,8 +44,9 @@ "EXTRA_PAYMENT_PROCESSOR_CLASSES": [], }, "defaults": { - "DOCKER_IMAGE": "overhangio/openedx-ecommerce:{{ TUTOR_VERSION }}", - "WORKER_DOCKER_IMAGE": "overhangio/openedx-ecommerce-worker:{{ TUTOR_VERSION }}", + "VERSION": __version__, + "DOCKER_IMAGE": "overhangio/openedx-ecommerce:{{ ECOMMERCE_VERSION }}", + "WORKER_DOCKER_IMAGE": "overhangio/openedx-ecommerce-worker:{{ ECOMMERCE_VERSION }}", "HOST": "ecommerce.{{ LMS_HOST }}", "MYSQL_DATABASE": "ecommerce", "MYSQL_USERNAME": "ecommerce",