From 92cf194e98d484ebe05fec537fff7b7a768e293f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20L=C3=B6fgren?= <viclo211@student.liu.se> Date: Tue, 16 Feb 2021 19:24:43 +0100 Subject: [PATCH] Resolve "Improve gitlab pipelines" --- .gitlab-ci.yml | 5 ++--- .gitlab/client.gitlab-ci.yml | 31 ++++++++++++++++++------------- .gitlab/server.gitlab-ci.yml | 22 +++++++++++++++++----- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc3e1186..b724e32f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,6 @@ stages: - - server-test - - client-install - - client-test + - setup + - test include: - local: .gitlab/server.gitlab-ci.yml diff --git a/.gitlab/client.gitlab-ci.yml b/.gitlab/client.gitlab-ci.yml index 2881ef9d..f73fe000 100644 --- a/.gitlab/client.gitlab-ci.yml +++ b/.gitlab/client.gitlab-ci.yml @@ -1,31 +1,36 @@ -image: node:10 - -install: - stage: client-install +client:setup: + image: node:10 + stage: setup script: - cd client - npm install artifacts: name: "artifacts" untracked: true - expire_in: 60 mins + expire_in: 15 mins + paths: + - client/.npm/ + - client/node_modules/ + cache: + key: "$CI_COMMIT_REF_SLUG" paths: - client/.npm/ - client/node_modules/ -linting: - stage: client-test +client:linting: + image: node:10 + stage: test + needs: ["client:setup"] script: - cd client - npm run lint - dependencies: - - install -test:unit: - stage: client-test +client:test: + image: node:10 + stage: test + needs: ["client:setup"] script: - cd client - npm run test:coverage - dependencies: - - install + coverage: /All files\s*\|\s*([\d\.]+)/ diff --git a/.gitlab/server.gitlab-ci.yml b/.gitlab/server.gitlab-ci.yml index 33d3934c..e2913efb 100644 --- a/.gitlab/server.gitlab-ci.yml +++ b/.gitlab/server.gitlab-ci.yml @@ -1,11 +1,15 @@ - - -test-server: +server:setup: image: python + stage: setup + artifacts: + paths: + - server/env + expire_in: 15 min + untracked: true cache: + key: "$CI_COMMIT_REF_SLUG" paths: - - server/env/ - stage: server-test + - server/env script: - python --version - pip install virtualenv @@ -13,4 +17,12 @@ test-server: - python -m venv env - source env/bin/activate - pip install -r requirements.txt + +server:test: + image: python + stage: test + needs: ["server:setup"] + script: + - cd server + - source env/bin/activate - pytest --cov app tests/ -- GitLab