This repository was archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
111 lines (102 loc) · 3.12 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
105
106
107
108
109
110
111
image: elixir:1.11-alpine #update this when we switch Elixir version in Dockerfile
variables:
CI_RUN: "true"
POSTGRES_DB: commonspub_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DATABASE_HOST: mdillon__postgis
MIX_ENV: test
HOSTNAME: localhost
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- deps
- _build
- ~/.mix
- ~/.hex
- ~/.cargo
- .mix
- .hex
- .cargo
- .cache
- .npm
- .pip
stages:
# - build
# - test
- deploy
before_script:
- apk add --update --no-cache build-base cmake curl git rust cargo py-pip
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- pip --cache-dir=.pip install -U pip # upgrade pip
# build:
# stage: build
# script:
# - mix deps.get
# - mix compile --force
testing:
stage: test
services:
- name: mdillon/postgis:11-alpine
# - name: postgres:12-alpine
command:
[
"postgres",
"-c",
"fsync=off",
"-c",
"synchronous_commit=off",
"-c",
"full_page_writes=off",
]
script:
- mix compile
- mix ecto.create
- make db-pre-migrations
- mix ecto.reset
# - mix coveralls --preload-modules
# - mix test test/value_flows/ test/extensions/bonfire_quantify test/extensions/bonfire_geolocate
locales-and-docs:
stage: deploy # deploy documentation (stage should be changed 'deploy' when tests are fixed)
script:
- if [ ! -z "$TX_TOKEN" ]; then pip --cache-dir=.pip install transifex-client ; else echo "Skipping..."; fi # install transifex cli
- mix gettext.extract # extract strings to be localised
- if [ ! -z "$TX_TOKEN" ]; then tx push --source --no-interactive ; else echo "Skipping..."; fi # then push latest English PO file to transifex for translators (only need to run this once per new commit)
- MIX_ENV=dev mix deps.get
- MIX_ENV=dev mix docs
- mv doc public # serve as GitLab Pages artifact
artifacts:
paths:
- public
only:
- develop
staging-build-and-push:
stage: deploy # deploy staging docker image (stage should be changed 'deploy' when tests are fixed)
image:
name: docker:stable
services:
- docker:stable-dind
before_script: # override the default in this case
- apk add --update --no-cache build-base cmake git curl
- docker login -u $CI_REGISTRY_USER -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- make build
- if [ ! -z "$CI_REGISTRY_PASSWORD" ]; then make push ; else echo "Push to Docker Hub or skip if login details missing..."; fi
only:
- develop
stable-build-and-push:
stage: deploy # deploy staging docker image (stage should be changed 'deploy' when tests are fixed)
image:
name: docker:stable
services:
- docker:stable-dind
before_script: # override the default in this case
- apk add --update --no-cache build-base cmake git curl
- docker login -u $CI_REGISTRY_USER -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- make build
- if [ ! -z "$CI_REGISTRY_PASSWORD" ]; then make push_stable ; else echo "Push to Docker Hub or skip if login details missing..."; fi
only:
- master