From 5298fbb7931cfb1709ab2eacb81fda76ec073a38 Mon Sep 17 00:00:00 2001
From: Yoann Schneider <yschneider@teklia.com>
Date: Tue, 22 Nov 2022 21:01:16 +0000
Subject: [PATCH] Add test job in CI

---
 .gitlab-ci.yml | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 81e95c76..2b2794d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,7 @@ stages:
   - deploy
 
 lint:
-  image: python:3.8
+  image: python:3.10
   stage: test
 
   cache:
@@ -24,6 +24,34 @@ lint:
   script:
     - pre-commit run -a
 
+test:
+  image: python:3.10
+
+  stage: test
+  cache:
+    paths:
+      - .cache/pip
+
+  variables:
+    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
+    ARKINDEX_API_SCHEMA_URL: schema.yml
+
+  before_script:
+    - pip install tox
+
+    # Download OpenAPI schema from last backend build
+    - curl https://assets.teklia.com/arkindex/openapi.yml > schema.yml
+
+    # Add system deps for opencv
+    - apt-get update -q
+    - apt-get install -q -y libgl1
+
+  except:
+    - schedules
+
+  script:
+    - tox
+
 bump-python-deps:
   stage: deploy
   image: registry.gitlab.com/teklia/devops:latest
-- 
GitLab