-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
executable file
·74 lines (67 loc) · 1.83 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
image: docker:latest
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
variables:
DOCKER_DRIVER: overlay2
DEPLOY_SERVER: [email protected]
before_script:
- >
apk add --update --no-cache
automake
git
alpine-sdk
nasm
autoconf
build-base
zlib
zlib-dev
libpng
libpng-dev
libwebp
libwebp-dev
libjpeg-turbo
libjpeg-turbo-dev
yarn
mongodb-tools
openssh
python
- yarn global add node-gyp # Fixes optipng errors
- yarn global add optipng-bin # Fixes optipng errors
stages:
- test
- deploy
build_and_test:
services:
- mongo:3.2
stage: test
script:
# Stop env file missing error
- cp .env.example .env
- yarn install
- node_modules/.bin/gulp
- docker build -t maxfacts .
# Restore data to test image
- docker build -t maxfacts_data -f mongo.Dockerfile .
- docker run -d maxfacts_data
- sleep 15
- DOCKER_CONTAINER_NAME=$(docker run -d maxfacts)
- sleep 15
- echo $DOCKER_HOST
- echo $DOCKER_CONTAINER_NAME
- docker inspect maxfacts
- docker container ls
# Sleep is to wait for container to be set-up and ready
- docker exec $DOCKER_CONTAINER_NAME yarn run test:integrations
deploy:
stage: deploy
only:
- schedules
script:
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 --decode)
- ssh $DEPLOY_SERVER 'cd Maxfacts && git pull && npm run deploy'