From 5d79b694c088a3b221e93cc7e9df4073a26c712f Mon Sep 17 00:00:00 2001
From: Paolo Brasolin <paolo.brasolin@eurac.edu>
Date: Wed, 2 Mar 2022 12:43:55 +0100
Subject: [PATCH] ci: sketch check jobs

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 62f3813..cbdef07 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,9 +10,8 @@ stages:
 
 #==[ Prepare node ]=============================================================
 
-fe-cache-node-job:
+.fe-node-job:
   image: node:16-alpine
-  stage: setup
   tags:
     - commul
   cache:
@@ -21,36 +20,76 @@ fe-cache-node-job:
         - frontend/package-lock.json
     paths:
       - frontend/.npm/
-  script:
+  before_script:
     - cd frontend
     - npm ci --cache .npm --prefer-offline
   only:
     - tags
     - development
 
-#==[ Frontend checks ]==========================================================
-
-fe-check-node-job:
-  needs:
-    - fe-cache-node-job
+.be-node-job:
   image: node:16-alpine
-  stage: check
   tags:
     - commul
   cache:
     key:
       files:
-        - frontend/package-lock.json
+        - backend/package-lock.json
     paths:
-      - frontend/.npm/
-  script:
-    - cd frontend
+      - backend/.npm/
+  before_script:
+    - cd backend
     - npm ci --cache .npm --prefer-offline
-    - npm run test
   only:
     - tags
     - development
 
+fe-cache-node-job:
+  extends: .fe-node-job
+  stage: setup
+
+be-cache-node-job:
+  extends: .be-node-job
+  stage: setup
+
+#==[ Frontend checks ]==========================================================
+
+fe-lint-node-job:
+  extends: .fe-node-job
+  stage: check
+  needs:
+    - fe-cache-node-job
+  script:
+    - cd frontend
+    - npm run style:check
+
+fe-test-node-job:
+  extends: .fe-node-job
+  stage: check
+  needs:
+    - fe-cache-node-job
+  script:
+    - cd frontend
+    - npm run test
+
+be-lint-node-job:
+  extends: .be-node-job
+  stage: check
+  needs:
+    - be-cache-node-job
+  script:
+    - cd backend
+    - npm run style:check
+
+be-test-node-job:
+  extends: .be-node-job
+  stage: check
+  needs:
+    - be-cache-node-job
+  script:
+    - cd backend
+    - npm run test
+
 #==[ Backend build ]============================================================
 
 # TODO: cache docker layers
-- 
GitLab