From fbdb6a9e65404bede4c7d9daabcca638bfaa744b Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Fri, 1 Mar 2019 16:20:08 +0000
Subject: [PATCH] Split tests and linting in GitLab CI

---
 .gitlab-ci.yml | 53 +++++++++++++++++++++++++++-----------------------
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index de3b51147c..19c761121b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,38 +1,43 @@
+image: registry.gitlab.com/arkindex/backend:base-0.8.7
 stages:
   - test
 
-backend-tests:
-  stage: test
-  image: registry.gitlab.com/arkindex/backend:base-0.8.7
+cache:
+  paths:
+    - .cache/pip
 
-  services:
-    - postgres:latest
+before_script:
+  - apk --update add build-base
+  # Custom line to install our own deps from Git using GitLab CI credentials
+  - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/arkindex/common#egg=arkindex-common"
+  - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/arkindex/ponos#egg=arkindex-ponos"
+  - pip install -r tests-requirements.txt codecov
 
-  variables:
-    # For the postgres image
-    POSTGRES_DB: arkindex_dev
-    POSTGRES_USER: devuser
-    POSTGRES_PASSWORD: devdata
+variables:
+  # For the postgres image
+  POSTGRES_DB: arkindex_dev
+  POSTGRES_USER: devuser
+  POSTGRES_PASSWORD: devdata
 
-    # For the backend
-    DB_HOST: postgres
-    DB_PORT: 5432
+  # For the backend
+  DB_HOST: postgres
+  DB_PORT: 5432
 
-    # Pip cache
-    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
+  # Pip cache
+  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
 
-  cache:
-    paths:
-      - .cache/pip
+backend-tests:
+  stage: test
 
-  before_script:
-    - apk --update add build-base
-    # Custom line to install our own deps from Git using GitLab CI credentials
-    - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/arkindex/common#egg=arkindex-common"
-    - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/arkindex/ponos#egg=arkindex-ponos"
-    - pip install -r tests-requirements.txt codecov
+  services:
+    - postgres:latest
 
   script:
     - python setup.py test
     - codecov
+
+backend-lint:
+  stage: test
+
+  script:
     - flake8
-- 
GitLab