chore(ci): move build cache to global & deploy
This commit is contained in:
parent
664fea0d1c
commit
2e3be37e5d
104
.gitlab-ci.yml
104
.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 <bin/uniworx
|
||||
needs:
|
||||
- yesod:build
|
||||
- yesod:test # For sanity
|
||||
- hlint # For sanity
|
||||
before_script:
|
||||
- apt-get update -y
|
||||
- apt-get install -y --no-install-recommends openssh-client
|
||||
- eval $(ssh-agent -s)
|
||||
- ssh-add ${SSH_PRIVATE_KEY_UNIWORX4}
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- cp ${SSH_KNOWN_HOSTS} ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
dependencies:
|
||||
- yesod:build
|
||||
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
|
||||
|
||||
when: manual
|
||||
|
||||
Loading…
Reference in New Issue
Block a user