From 21c2d1a446491f76d6ed56bbed3009c109fe28e8 Mon Sep 17 00:00:00 2001
From: JostTim <44769559+JostTim@users.noreply.github.com>
Date: Mon, 8 Jan 2024 15:59:05 +0100
Subject: [PATCH] updating ci-cd to use auto_fast_docs and publish to pipy

---
 .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++
 pyproject.toml |  2 ++
 tests/tests.py |  9 +++++++--
 3 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7693e5d
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,34 @@
+image: python:3.11
+
+stages:
+  - documentation
+  - publish
+  - test
+
+workflow:
+  rules:
+    - if: $CI_COMMIT_BRANCH == "main"
+
+StaticDocPages:
+  stage: documentation
+  script:
+    - python -m pip install --upgrade pip
+    - pip install auto_fast_docs
+    - auto_fast_docs Inflow --username --platform 'gitlab:pasteur.fr' --group haisslab/data-management --layout src
+  artifacts:
+    paths:
+      - $CI_PROJECT_DIR/public
+  rules:
+    - if: $CI_COMMIT_BRANCH == "main"
+
+publish:
+  stage : publish
+  variables:
+    TWINE_PASSWORD: ${PIPY_TOKEN}
+    TWINE_USERNAME: __token__
+  script:
+    - pip install build twine
+    - python -m build
+    - python -m twine upload --repository pipy dist/*
+  rules:
+    - if: $CI_COMMIT_BRANCH == "main"
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index be1bad0..1a6d008 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -28,3 +28,5 @@ optional-dependencies = { celery = { file = [
     "requirements-celery.txt",
 ] } }
 version = { attr = "pypelines.__version__" }
+
+[tool.black]
diff --git a/tests/tests.py b/tests/tests.py
index 315fc1f..6e6b1ed 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,6 +1,11 @@
-import unittest, sys, os
+import unittest
 
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
+# for testing on local version, instead of installed version,
+# this may not be desired as testing uninstalled may not catch issues that occur after installation is performed
+# comment the next three lines to test installed version
+# import sys
+# from pathlib import Path
+# sys.path.append(str(Path(__file__).resolve().parent / "src"))
 
 from pypelines import examples
 from pypelines.sessions import Session
-- 
GitLab