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




commit 331f90f464284d3db905367767e10982933ddbaa
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 | 40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e8e0c08..28ecbdf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,26 +2,56 @@ include:
   - project: 'Infrastructure/openshift-images/ci-templates'
     file: '/kaniko.yml'
 
-odrs-dev:
+stages:
+  - build
+  - test
+  - deploy
+
+build-image:
+  stage: build
+  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]