From 2e3be37e5d45153112cf9955bd9524cad0f16a4f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 8 Nov 2019 14:23:10 +0100 Subject: [PATCH] chore(ci): move build cache to global & deploy --- .gitlab-ci.yml | 104 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 54d4a56db..7c2da98a9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,11 @@ default: image: fpco/stack-build:lts-13.21 + cache: + key: "${CI_COMMIT_REF_SLUG}" + paths: + - node_modules + - .stack + - .stack-work services: - postgres:latest @@ -18,19 +24,16 @@ stages: - yesod:build - lint - test + - deploy npm install: stage: setup script: - npm install before_script: &npm - - apt-get update + - apt-get update -y - npm install -g n - n stable - cache: - key: "${CI_COMMIT_REF_SLUG}" - paths: - - node_modules artifacts: paths: - node_modules/ @@ -69,14 +72,9 @@ yesod:build:dev: needs: - frontend:build before_script: - - apt-get update + - apt-get update -y - apt-get install -y --no-install-recommends locales-all - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ - cache: - key: "${CI_COMMIT_REF_SLUG}" - paths: - - .stack - - .stack-work artifacts: paths: - bin/ @@ -96,14 +94,9 @@ yesod:build: needs: - frontend:build before_script: - - apt-get update + - apt-get update -y - apt-get install -y --no-install-recommends locales-all - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ - cache: - key: "${CI_COMMIT_REF_SLUG}" - paths: - - .stack - - .stack-work artifacts: paths: - bin/ @@ -122,7 +115,7 @@ frontend:test: needs: - npm install before_script: - - apt-get update + - apt-get update -y - npm install -g n - n stable - apt-get install -y --no-install-recommends chromium-browser @@ -137,16 +130,11 @@ hlint:dev: - frontend:build - yesod:build:dev # For caching before_script: - - apt-get update + - apt-get update -y - apt-get install -y --no-install-recommends locales-all - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ dependencies: - frontend:build - cache: - key: "${CI_COMMIT_REF_SLUG}" - paths: - - .stack - - .stack-work only: variables: @@ -160,18 +148,74 @@ yesod:test:dev: - frontend:build - yesod:build:dev # For caching before_script: - - apt-get update + - apt-get update -y - apt-get install -y --no-install-recommends locales-all - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ dependencies: - frontend:build - cache: - key: "${CI_COMMIT_REF_SLUG}" - paths: - - .stack - - .stack-work only: variables: - $CI_COMMIT_REF_NAME !~ /^v[0-9].*/ +hlint: + stage: lint + script: + - stack test --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic uniworx:test:hlint + needs: + - frontend:build + - yesod:build # For caching + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + +yesod:test: + stage: test + script: + - stack test --coverage --flag uniworx:-library-only --flag uniworx:-dev --flag uniworx:pedantic uniworx:test:hlint --skip hlint + needs: + - frontend:build + - yesod:build # For caching + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends locales-all + - ln -s $(which g++-7) $(dirname $(which g++-7))/g++ + dependencies: + - frontend:build + + only: + variables: + - $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ + +deploy:uniworx4: + stage: deploy + script: + - ssh root@uniworx4.ifi.lmu.de