[odrs-web/barthalion/add-tests-to-ci] Add unit tests to CI




commit 97838e6101bd09270b2f399418e21b36edcc72d6
Author: Bartłomiej Piotrowski <b bpiotrowski pl>
Date:   Wed Aug 31 22:20:58 2022 +0200

    Add unit tests to CI
    
    Additionally, introduce a separate job for testing the Docker build.

 .gitlab-ci.yml | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e8e0c08..6b1724b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,26 +2,55 @@ include:
   - project: 'Infrastructure/openshift-images/ci-templates'
     file: '/kaniko.yml'
 
-odrs-dev:
+stages:
+  - test
+  - deploy
+
+build-image:
+  stage: test
+  extends:
+    - .kaniko-root
+  variables:
+    CI_COMMIT_REF_PROTECTED: "false"
+
+tests:
+  stage: test
+  image: registry.access.redhat.com/ubi8/python-39
+  script:
+    - pip install -r requirements.txt
+    - ODRS_REVIEWS_SECRET=not-secret4 python odrs/tests/util_test.py
+    - python odrs/tests/odrs_test.py
+
+deploy-dev:
+  stage: deploy
   extends:
     - .kaniko-root
   variables:
     CI_CUSTOM_IMAGE_NAME: "odrs"
     OCI_TAG: "dev"
+  rules:
+  - if: $CI_COMMIT_REF_NAME == "master"
+    when: always
 
-odrs:
+deploy-prod:
+  stage: deploy
   extends:
     - .kaniko-root
   variables:
     CI_CUSTOM_IMAGE_NAME: "odrs"
     OCI_TAG: "latest"
-  when: manual
+  rules:
+  - if: $CI_COMMIT_REF_NAME == "master"
+    when: manual
 
-nginx:
+deploy-prod-nginx:
+  stage: deploy
   extends:
     - .kaniko-root
   variables:
     CI_CUSTOM_IMAGE_NAME: "odrs"
     OCI_TAG: "nginx"
     DOCKERFILE: "Dockerfile.nginx"
-  when: manual
+  rules:
+  - if: $CI_COMMIT_REF_NAME == "master"
+    when: manual


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]