From e8d8c18276aad8d7333f2674dd54ebc4e314808e Mon Sep 17 00:00:00 2001
From: Andreas Burbach <aburbach@compeon.de>
Date: Tue, 23 Nov 2021 13:06:22 +0100
Subject: [PATCH] poetry

---
 the_social_network/.gilab-ci.yml  | 49 +++++++++++++++++++++++++++++++
 the_social_network/MANIFEST.in    |  7 -----
 the_social_network/pyproject.toml | 23 +++++++++++++++
 the_social_network/setup.cfg      | 24 ---------------
 the_social_network/setup.py       |  3 --
 5 files changed, 72 insertions(+), 34 deletions(-)
 create mode 100644 the_social_network/.gilab-ci.yml
 delete mode 100644 the_social_network/MANIFEST.in
 create mode 100644 the_social_network/pyproject.toml
 delete mode 100644 the_social_network/setup.cfg
 delete mode 100644 the_social_network/setup.py

diff --git a/the_social_network/.gilab-ci.yml b/the_social_network/.gilab-ci.yml
new file mode 100644
index 0000000..1d8eaf7
--- /dev/null
+++ b/the_social_network/.gilab-ci.yml
@@ -0,0 +1,49 @@
+image: docker
+
+services:
+  - docker:dind
+
+stages:
+  - build
+  - test
+  - deploy
+
+before_script:
+  - docker version
+  - apk add --no-cache docker-compose
+  - docker-compose version
+  - docker login -u gitlab-ci-token -p $REGISTRY_TOKEN $REGISTRY
+
+after_script:
+  - docker-compose -f docker-compose.ci.yml down
+  - docker-compose -f docker-compose.ci.yml ps
+
+
+build:
+  stage: build
+  script:
+    - echo "Building ..."
+    - docker-compose -f docker-compose.ci.yml build
+    - docker-compose -f docker-compose.ci.yml push
+
+test:
+  stage: test
+  needs:
+    - build
+  script:
+    - echo "Testing ..."
+    - docker-compose -f docker-compose.ci.yml pull
+    - docker-compose -f docker-compose.ci.yml run web sh -c "pipenv run python manage.py makemigrations && pipenv run python manage.py migrate && pipenv run python manage.py test core -v 2"
+
+deploy:
+  stage: deploy
+  needs:
+    - test
+  script:
+    - echo "Deploying ..."
+    - pip install poetry
+    - mw /the_social_network /not_needed
+    - mw /core /the_social_network
+    - poetry --version
+    - poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI
+    - poetry publish
\ No newline at end of file
diff --git a/the_social_network/MANIFEST.in b/the_social_network/MANIFEST.in
deleted file mode 100644
index 5b2510b..0000000
--- a/the_social_network/MANIFEST.in
+++ /dev/null
@@ -1,7 +0,0 @@
-include LICENSE
-include README.rst
-include core/*
-exclude the_social_network/*
-exclude setup.cfg
-exclude MANIFEST.in
-exclude manage.py
\ No newline at end of file
diff --git a/the_social_network/pyproject.toml b/the_social_network/pyproject.toml
new file mode 100644
index 0000000..9aaa0f8
--- /dev/null
+++ b/the_social_network/pyproject.toml
@@ -0,0 +1,23 @@
+[tool.poetry]
+name = "the-social-network"
+version = "0.0.1"
+description = "Basic social network core."
+authors = ["Marc Feger <marc.feger@hhu.de>"]
+license = "BSD-4"
+exclude = ["core"]
+
+
+[tool.poetry.dependencies]
+python = "^3.8"
+Django = "^3.2.9"
+djangorestframework = "^3.12.4"
+Pillow = "^8.4.0"
+django-cors-headers = "^3.10.0"
+django-dotenv = "^1.4.2"
+uWSGI = "^2.0.20"
+
+[tool.poetry.dev-dependencies]
+
+[build-system]
+requires = ["poetry-core>=1.0.0"]
+build-backend = "poetry.core.masonry.api"
diff --git a/the_social_network/setup.cfg b/the_social_network/setup.cfg
deleted file mode 100644
index 578367d..0000000
--- a/the_social_network/setup.cfg
+++ /dev/null
@@ -1,24 +0,0 @@
-[metadata]
-name = the-social-network
-version = 0.1
-description = Basic core of all social network backends
-long_description = file: README.rst
-url = https://www.example.com/
-author = Marc Feger
-author_email = marc.feger@uni-duesseldorf.de
-license = BSD-4-Clause
-classifiers =
-    Environment :: Web Environment
-    Framework :: Django
-    Framework :: Django :: 3.1.2  # Replace "X.Y" as appropriate
-    Intended Audience :: Developers
-    License :: OSI Approved :: BSD License
-    Operating System :: OS Independent
-    Programming Language :: Python
-    Programming Language :: Python :: 3.9
-    Topic :: Internet :: WWW/HTTP
-    Topic :: Internet :: WWW/HTTP :: Dynamic Content
-
-[options]
-include_package_data = true
-packages = find:
\ No newline at end of file
diff --git a/the_social_network/setup.py b/the_social_network/setup.py
deleted file mode 100644
index fc1f76c..0000000
--- a/the_social_network/setup.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from setuptools import setup
-
-setup()
\ No newline at end of file
-- 
GitLab