Update `ex_rated` dependency
[akkoma] / .gitlab-ci.yml
1 image: elixir:1.8.1
2
3 variables:
4 POSTGRES_DB: pleroma_test
5 POSTGRES_USER: postgres
6 POSTGRES_PASSWORD: postgres
7 DB_HOST: postgres
8 MIX_ENV: test
9
10 cache:
11 key: ${CI_COMMIT_REF_SLUG}
12 paths:
13 - deps
14 - _build
15 stages:
16 - build
17 - test
18 - deploy
19
20 before_script:
21 - mix local.hex --force
22 - mix local.rebar --force
23
24 build:
25 stage: build
26 script:
27 - mix deps.get
28 - mix compile --force
29
30 docs-build:
31 stage: build
32 only:
33 - master@pleroma/pleroma
34 - develop@pleroma/pleroma
35 variables:
36 MIX_ENV: dev
37 script:
38 - mix deps.get
39 - mix compile
40 - mix docs
41 artifacts:
42 paths:
43 - priv/static/doc
44
45 unit-testing:
46 stage: test
47 services:
48 - name: lainsoykaf/postgres-with-rum
49 alias: postgres
50 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
51 script:
52 - mix deps.get
53 - mix ecto.create
54 - mix ecto.migrate
55 - mix coveralls --trace --preload-modules
56
57 unit-testing-rum:
58 stage: test
59 services:
60 - name: lainsoykaf/postgres-with-rum
61 alias: postgres
62 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
63 variables:
64 RUM_ENABLED: "true"
65 script:
66 - mix deps.get
67 - mix ecto.create
68 - mix ecto.migrate
69 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
70 - mix test --trace --preload-modules
71
72 lint:
73 stage: test
74 script:
75 - mix format --check-formatted
76
77 analysis:
78 stage: test
79 script:
80 - mix deps.get
81 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
82
83 docs-deploy:
84 stage: deploy
85 image: alpine:3.9
86 only:
87 - master@pleroma/pleroma
88 - develop@pleroma/pleroma
89 before_script:
90 - apk update && apk add openssh-client rsync
91 script:
92 - mkdir -p ~/.ssh
93 - echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
94 - eval $(ssh-agent -s)
95 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
96 - rsync -hrvz --delete -e "ssh -p ${SSH_PORT}" priv/static/doc/ "${SSH_USER_HOST_LOCATION}/${CI_COMMIT_REF_NAME}"
97
98 review_app:
99 image: alpine:3.9
100 stage: deploy
101 before_script:
102 - apk update && apk add openssh-client git
103 when: manual
104 environment:
105 name: review/$CI_COMMIT_REF_NAME
106 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
107 on_stop: stop_review_app
108 only:
109 - branches
110 except:
111 - master
112 - develop
113 script:
114 - echo "$CI_ENVIRONMENT_SLUG"
115 - mkdir -p ~/.ssh
116 - eval $(ssh-agent -s)
117 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
118 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
119 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
120 - ssh -t dokku@pleroma.online -- config:set "$CI_ENVIRONMENT_SLUG" APP_NAME="$CI_ENVIRONMENT_SLUG" APP_HOST="$CI_ENVIRONMENT_SLUG.pleroma.online" MIX_ENV=dokku
121 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
122 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
123 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
124 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
125
126 stop_review_app:
127 image: alpine:3.9
128 stage: deploy
129 before_script:
130 - apk update && apk add openssh-client git
131 when: manual
132 environment:
133 name: review/$CI_COMMIT_REF_NAME
134 action: stop
135 script:
136 - echo "$CI_ENVIRONMENT_SLUG"
137 - mkdir -p ~/.ssh
138 - eval $(ssh-agent -s)
139 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
140 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
141 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
142 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db