From 0fc4675f08a825b09a8be37e7fad0bf155dcedad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andri=20Fr=C3=A4nkl?= <andri.fraenkl@unibas.ch>
Date: Mon, 12 Dec 2022 08:45:37 +0000
Subject: [PATCH] Update .gitlab-ci.yml

---
 .gitlab-ci.yml | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d79361..5664686 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,12 +3,33 @@ default:
     - docker
   image: python:3.10-slim-buster
 
-my_tests:
-  # Good to put a small description here of what this job does
-  before_script:
+stages:          # List of employment runs, starts with build ends with deploy. 
+  - build
+  - test
+  - deploy
+
+build-job:       # First stage deployment and installation of dependencies. 
+  stage: build   # Build Stage
+  script:
+    - pip install -r requirements.txt
     - pip install -r requirements_dev.txt
+
+Coverage-test-job:   # Test Stage
+  stage: test        # Starts when the above build stages finishes installing dependencies.
+  script:
+    - coverage run --source git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/ -m pytest
+    - coverage report -m
+
+Flake8/Pylint/mypy-test-job:   # Test Stage
+  stage: test    # Deploys and runs all 3 linters.
+  script:
+    - flake8 --docstring-convention google git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/
+    - pylint git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/
+    - mypy git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/
+
+deploy-job:      # Deploy Stage
+  stage: deploy  # Runs only when the privious jobs were finished succesfully. 
+  environment: production
   script:
-    - echo "coverage run --source git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/ -m pytest"
-    - echo "flake8 --docstring-convention google git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/"
-    - echo "pylint git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/"
-    - echo "mypy git.scicore.unibas.ch:2222/zavolan_group/tools/transcript-structure-generator/tests/"
+    - echo "Running script"
+    - echo "Application successfully deployed."
-- 
GitLab