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:
|
default:
|
||||||
image: fpco/stack-build:lts-13.21
|
image: fpco/stack-build:lts-13.21
|
||||||
|
cache:
|
||||||
|
key: "${CI_COMMIT_REF_SLUG}"
|
||||||
|
paths:
|
||||||
|
- node_modules
|
||||||
|
- .stack
|
||||||
|
- .stack-work
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- postgres:latest
|
- postgres:latest
|
||||||
@ -18,19 +24,16 @@ stages:
|
|||||||
- yesod:build
|
- yesod:build
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
npm install:
|
npm install:
|
||||||
stage: setup
|
stage: setup
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
before_script: &npm
|
before_script: &npm
|
||||||
- apt-get update
|
- apt-get update -y
|
||||||
- npm install -g n
|
- npm install -g n
|
||||||
- n stable
|
- n stable
|
||||||
cache:
|
|
||||||
key: "${CI_COMMIT_REF_SLUG}"
|
|
||||||
paths:
|
|
||||||
- node_modules
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
@ -69,14 +72,9 @@ yesod:build:dev:
|
|||||||
needs:
|
needs:
|
||||||
- frontend:build
|
- frontend:build
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- apt-get update -y
|
||||||
- apt-get install -y --no-install-recommends locales-all
|
- apt-get install -y --no-install-recommends locales-all
|
||||||
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
||||||
cache:
|
|
||||||
key: "${CI_COMMIT_REF_SLUG}"
|
|
||||||
paths:
|
|
||||||
- .stack
|
|
||||||
- .stack-work
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- bin/
|
- bin/
|
||||||
@ -96,14 +94,9 @@ yesod:build:
|
|||||||
needs:
|
needs:
|
||||||
- frontend:build
|
- frontend:build
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- apt-get update -y
|
||||||
- apt-get install -y --no-install-recommends locales-all
|
- apt-get install -y --no-install-recommends locales-all
|
||||||
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
||||||
cache:
|
|
||||||
key: "${CI_COMMIT_REF_SLUG}"
|
|
||||||
paths:
|
|
||||||
- .stack
|
|
||||||
- .stack-work
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- bin/
|
- bin/
|
||||||
@ -122,7 +115,7 @@ frontend:test:
|
|||||||
needs:
|
needs:
|
||||||
- npm install
|
- npm install
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- apt-get update -y
|
||||||
- npm install -g n
|
- npm install -g n
|
||||||
- n stable
|
- n stable
|
||||||
- apt-get install -y --no-install-recommends chromium-browser
|
- apt-get install -y --no-install-recommends chromium-browser
|
||||||
@ -137,16 +130,11 @@ hlint:dev:
|
|||||||
- frontend:build
|
- frontend:build
|
||||||
- yesod:build:dev # For caching
|
- yesod:build:dev # For caching
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- apt-get update -y
|
||||||
- apt-get install -y --no-install-recommends locales-all
|
- apt-get install -y --no-install-recommends locales-all
|
||||||
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
||||||
dependencies:
|
dependencies:
|
||||||
- frontend:build
|
- frontend:build
|
||||||
cache:
|
|
||||||
key: "${CI_COMMIT_REF_SLUG}"
|
|
||||||
paths:
|
|
||||||
- .stack
|
|
||||||
- .stack-work
|
|
||||||
|
|
||||||
only:
|
only:
|
||||||
variables:
|
variables:
|
||||||
@ -160,18 +148,74 @@ yesod:test:dev:
|
|||||||
- frontend:build
|
- frontend:build
|
||||||
- yesod:build:dev # For caching
|
- yesod:build:dev # For caching
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update
|
- apt-get update -y
|
||||||
- apt-get install -y --no-install-recommends locales-all
|
- apt-get install -y --no-install-recommends locales-all
|
||||||
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
- ln -s $(which g++-7) $(dirname $(which g++-7))/g++
|
||||||
dependencies:
|
dependencies:
|
||||||
- frontend:build
|
- frontend:build
|
||||||
cache:
|
|
||||||
key: "${CI_COMMIT_REF_SLUG}"
|
|
||||||
paths:
|
|
||||||
- .stack
|
|
||||||
- .stack-work
|
|
||||||
|
|
||||||
only:
|
only:
|
||||||
variables:
|
variables:
|
||||||
- $CI_COMMIT_REF_NAME !~ /^v[0-9].*/
|
- $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
|
||||||
|
|||||||
Reference in New Issue
Block a user