-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
104 lines (96 loc) · 3.15 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
image: docker:19.03.1
variables:
# When using dind service, we need to instruct docker, to talk with
# the daemon started inside of the service. The daemon is available
# with a network connection instead of the default
# /var/run/docker.sock socket. docker:19.03.1 does this automatically
# by setting the DOCKER_HOST in
# https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03.1/docker-entrypoint.sh#L23-L29
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
#
# Note that if you're using the Kubernetes executor, the variable
# should be set to tcp://localhost:2376/ because of how the
# Kubernetes executor connects services to the job container
# DOCKER_HOST: tcp://localhost:2376/
#
# When using dind, it's wise to use the overlays driver for
# improved performance.
DOCKER_DRIVER: overlay2
# Specify to Docker where to create the certificates, Docker will
# create them automatically on boot, and will create
# `/certs/client` that will be shared between the service and job
# container, thanks to volume mount from config.toml
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:19.03.1-dind
stages:
- Build / Test
- Deploy
# https://docs.gitlab.com/12.10/ee/ci/caching/
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .stack-work/
- .stack/
# https://hub.docker.com/r/fpco/stack-build-small/tags?page=1&ordering=last_updated
server:
image: fpco/stack-build-small:lts-16.31
stage: Build / Test
before_script:
# https://unix.stackexchange.com/a/263803
# - apt-get install -y apt-transport-https ca-certificates
# - apt-get update
- mkdir -p .stack # Handle cache miss
- cp -r .stack /root/ # Copy cached .stack to /root/
- apt update
- ln -snf /usr/share/zoneinfo/Europe/London /etc/localtime && echo Europe/London > /etc/timezone
- apt-get install -y postgresql postgresql-client libpq-dev
# - apt install postgresql postgresql-contrib
script:
- stack install
- cp -r /root/.stack . # Update local .stack
- cp /root/.local/bin/keyaki .
- stack test --coverage
artifacts:
paths:
- keyaki
# - server/postgresql
# - server/secrets
client:
image: node:14.4.0
stage: Build / Test
cache: { }
before_script:
- cd client && yarn install
script:
- yarn run prod
- echo "TODO -> yarn test" && ls
artifacts:
paths:
- client/dist
- client/node_modules
# Build dependencies
# - stack --install-ghc test --only-dependencies
# - stack install weeder hlint
# script:
# Build the package, its tests, and its code coverage reposrt
# - stack build --test --coverage
# - hlint .
# - weeder .
deploy:
only:
refs:
- master
image: docker:19.03.1
stage: Deploy
cache: { }
before_script:
- apk add --update bash python3
- echo "${DOCKER_PASSWORD}" | docker login -u ${DOCKER_USER} --password-stdin
script:
- docker build -t bartholomews/keyaki -f docker/prod/Dockerfile .
- ./scripts/docker-deploy.sh
after_script:
- rm /root/.docker/config.json