diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 247368b5da22ddb5d82b12719a81f77e8c43e648..b30dad07d408cbb46271be5d0ae53b7f55b8f78c 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 1404e08e3e97579f346dcf6ac0e249e656da72dc..1126f1a56c7b09d7c4830a829e55eb264756f52c 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"]