From d0717acae741fd5f7720a0eac3a08fc2c20d703d Mon Sep 17 00:00:00 2001
From: nguyed99 <nguyed99@zedat.fu-berlin.de>
Date: Fri, 19 Jan 2024 22:27:12 +0100
Subject: [PATCH] Update pipeline

---
 .gitlab-ci.yml       | 24 ++++++++++++++++++++----
 build/pyproject.toml |  2 ++
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 247368b..b30dad0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,10 @@
 image: python:3.11-bullseye
 
+stages:
+  - build
+  - test-jobs
+  - test-tasks
+
 variables:
   POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/poetry"
 
@@ -7,14 +12,20 @@ cache:
   paths:
     - .cache/poetry
 
-
-before_script:
+build-env:
+  stage: build
+  script:
   - pip install poetry
   - poetry --version
   - cd build/
   - poetry install --no-root
-  - source $(poetry env info --path)/bin/activate
-  - cd ../
+  artifacts:
+    paths:
+      - $POETRY_CACHE_DIR/virtualenvs/
+
+before_script:
+  - export VIRTUALENV_NAME=$(ls $POETRY_CACHE_DIR/virtualenvs/)
+  - source $POETRY_CACHE_DIR/$VIRTUALENV_NAME/bin/activate
 
 format:
   script:
@@ -24,9 +35,14 @@ format:
     - poetry run ruff . --fix
 
 test-jobs:
+  stage: test-jobs
   script:
+    - export PYTHONPATH="$PYTHONPATH:$CI_PROJECT_DIR/jobs/src"
     - poetry run pytest jobs/tests/
 
 test-tasks:
+  stage: test-tasks
   script:
+    - export PYTHONPATH="$PYTHONPATH:$CI_PROJECT_DIR/tasks/src"
+
     - poetry run pytest tasks/tests/
\ No newline at end of file
diff --git a/build/pyproject.toml b/build/pyproject.toml
index 1404e08..1126f1a 100644
--- a/build/pyproject.toml
+++ b/build/pyproject.toml
@@ -9,6 +9,8 @@ readme = "README.md"
 python = ">=3.10"
 numpy = "~1.24"
 pytest = "^7.4.4"
+pre-commit = "^3.3.1"
+
 
 [build-system]
 requires = ["poetry-core"]
-- 
GitLab