Add note about Mastodon FE being removed from Pleroma in changelog
[akkoma] / .gitlab-ci.yml
1 image: elixir:1.9.4
2
3 variables: &global_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: &global_cache_policy
11 key: ${CI_COMMIT_REF_SLUG}
12 paths:
13 - deps
14 - _build
15
16 stages:
17 - build
18 - test
19 - benchmark
20 - deploy
21 - release
22 - docker
23
24 before_script:
25 - apt-get update && apt-get install -y cmake
26 - mix local.hex --force
27 - mix local.rebar --force
28 - mix deps.get
29 - apt-get -qq update
30 - apt-get install -y libmagic-dev
31
32 build:
33 stage: build
34 script:
35 - mix compile --force
36
37 spec-build:
38 stage: test
39 artifacts:
40 paths:
41 - spec.json
42 script:
43 - mix pleroma.openapi_spec spec.json
44
45 benchmark:
46 stage: benchmark
47 when: manual
48 variables:
49 MIX_ENV: benchmark
50 services:
51 - name: postgres:9.6
52 alias: postgres
53 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
54 script:
55 - mix ecto.create
56 - mix ecto.migrate
57 - mix pleroma.load_testing
58
59 unit-testing:
60 stage: test
61 retry: 2
62 cache: &testing_cache_policy
63 <<: *global_cache_policy
64 policy: pull
65
66 services:
67 - name: postgres:13
68 alias: postgres
69 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
70 script:
71 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
72 - mix ecto.create
73 - mix ecto.migrate
74 - mix coveralls --preload-modules
75
76 # Removed to fix CI issue. In this early state it wasn't adding much value anyway.
77 # TODO Fix and reinstate federated testing
78 # federated-testing:
79 # stage: test
80 # cache: *testing_cache_policy
81 # services:
82 # - name: minibikini/postgres-with-rum:12
83 # alias: postgres
84 # command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
85 # script:
86 # - mix deps.get
87 # - mix ecto.create
88 # - mix ecto.migrate
89 # - epmd -daemon
90 # - mix test --trace --only federated
91
92 unit-testing-rum:
93 stage: test
94 retry: 2
95 cache: *testing_cache_policy
96 services:
97 - name: minibikini/postgres-with-rum:12
98 alias: postgres
99 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
100 variables:
101 <<: *global_variables
102 RUM_ENABLED: "true"
103 script:
104 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
105 - mix ecto.create
106 - mix ecto.migrate
107 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
108 - mix test --preload-modules
109
110 lint:
111 stage: test
112 cache: *testing_cache_policy
113 script:
114 - mix format --check-formatted
115
116 analysis:
117 stage: test
118 cache: *testing_cache_policy
119 script:
120 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
121
122 docs-deploy:
123 stage: deploy
124 cache: *testing_cache_policy
125 image: alpine:latest
126 only:
127 - stable@pleroma/pleroma
128 - develop@pleroma/pleroma
129 before_script:
130 - apk add curl
131 script:
132 - curl -X POST -F"token=$DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/673/trigger/pipeline
133 review_app:
134 image: alpine:3.9
135 stage: deploy
136 before_script:
137 - apk update && apk add openssh-client git
138 when: manual
139 environment:
140 name: review/$CI_COMMIT_REF_NAME
141 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
142 on_stop: stop_review_app
143 only:
144 - branches
145 except:
146 - master
147 - develop
148 script:
149 - echo "$CI_ENVIRONMENT_SLUG"
150 - mkdir -p ~/.ssh
151 - eval $(ssh-agent -s)
152 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
153 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
154 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
155 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
156 - 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
157 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
158 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
159 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
160 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
161
162 spec-deploy:
163 stage: deploy
164 artifacts:
165 paths:
166 - spec.json
167 only:
168 - develop@pleroma/pleroma
169 image: alpine:latest
170 before_script:
171 - apk add curl
172 script:
173 - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline
174
175
176 stop_review_app:
177 image: alpine:3.9
178 stage: deploy
179 before_script:
180 - apk update && apk add openssh-client git
181 when: manual
182 environment:
183 name: review/$CI_COMMIT_REF_NAME
184 action: stop
185 script:
186 - echo "$CI_ENVIRONMENT_SLUG"
187 - mkdir -p ~/.ssh
188 - eval $(ssh-agent -s)
189 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
190 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
191 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
192 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
193
194 amd64:
195 stage: release
196 image: elixir:1.10.3
197 only: &release-only
198 - stable@pleroma/pleroma
199 - develop@pleroma/pleroma
200 - /^maint/.*$/@pleroma/pleroma
201 - /^release/.*$/@pleroma/pleroma
202 artifacts: &release-artifacts
203 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
204 paths:
205 - release/*
206 # Ideally it would be never for master branch and with the next commit for develop,
207 # but Gitlab does not support neither `only` for artifacts
208 # nor setting it to never from .gitlab-ci.yml
209 # nor expiring with the next commit
210 expire_in: 42 yrs
211
212 cache: &release-cache
213 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
214 paths:
215 - deps
216 variables: &release-variables
217 MIX_ENV: prod
218 before_script: &before-release
219 - apt-get update && apt-get install -y cmake libmagic-dev
220 - echo "import Mix.Config" > config/prod.secret.exs
221 - mix local.hex --force
222 - mix local.rebar --force
223 script: &release
224 - mix deps.get --only prod
225 - mkdir release
226 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
227 - mix release --path release
228
229
230 amd64-musl:
231 stage: release
232 artifacts: *release-artifacts
233 only: *release-only
234 image: elixir:1.10.3-alpine
235 cache: *release-cache
236 variables: *release-variables
237 before_script: &before-release-musl
238 - apk add git gcc g++ musl-dev make cmake file-dev
239 - echo "import Mix.Config" > config/prod.secret.exs
240 - mix local.hex --force
241 - mix local.rebar --force
242 script: *release
243
244 arm:
245 stage: release
246 artifacts: *release-artifacts
247 only: *release-only
248 tags:
249 - arm32-specified
250 image: arm32v7/elixir:1.10.3
251 cache: *release-cache
252 variables: *release-variables
253 before_script: *before-release
254 script: *release
255
256 arm-musl:
257 stage: release
258 artifacts: *release-artifacts
259 only: *release-only
260 tags:
261 - arm32-specified
262 image: arm32v7/elixir:1.10.3-alpine
263 cache: *release-cache
264 variables: *release-variables
265 before_script: *before-release-musl
266 script: *release
267
268 arm64:
269 stage: release
270 artifacts: *release-artifacts
271 only: *release-only
272 tags:
273 - arm
274 image: arm64v8/elixir:1.10.3
275 cache: *release-cache
276 variables: *release-variables
277 before_script: *before-release
278 script: *release
279
280 arm64-musl:
281 stage: release
282 artifacts: *release-artifacts
283 only: *release-only
284 tags:
285 - arm
286 image: arm64v8/elixir:1.10.3-alpine
287 cache: *release-cache
288 variables: *release-variables
289 before_script: *before-release-musl
290 script: *release
291
292 docker:
293 stage: docker
294 image: docker:latest
295 cache: {}
296 dependencies: []
297 variables: &docker-variables
298 DOCKER_DRIVER: overlay2
299 DOCKER_HOST: unix:///var/run/docker.sock
300 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
301 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
302 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
303 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
304 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
305 DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
306 before_script: &before-docker
307 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
308 - docker pull $IMAGE_TAG_SLUG || true
309 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
310 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
311 allow_failure: true
312 script:
313 - mkdir -p /root/.docker/cli-plugins
314 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
315 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
316 - chmod +x ~/.docker/cli-plugins/docker-buildx
317 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
318 - docker buildx create --name mbuilder --driver docker-container --use
319 - docker buildx inspect --bootstrap
320 - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST .
321 tags:
322 - dind
323 only:
324 - develop@pleroma/pleroma
325
326 docker-stable:
327 stage: docker
328 image: docker:latest
329 cache: {}
330 dependencies: []
331 variables: *docker-variables
332 before_script: *before-docker
333 allow_failure: true
334 script:
335 - mkdir -p /root/.docker/cli-plugins
336 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
337 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
338 - chmod +x ~/.docker/cli-plugins/docker-buildx
339 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
340 - docker buildx create --name mbuilder --driver docker-container --use
341 - docker buildx inspect --bootstrap
342 - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST_STABLE .
343 tags:
344 - dind
345 only:
346 - stable@pleroma/pleroma
347
348 docker-release:
349 stage: docker
350 image: docker:latest
351 cache: {}
352 dependencies: []
353 variables: *docker-variables
354 before_script: *before-docker
355 allow_failure: true
356 script:
357 script:
358 - mkdir -p /root/.docker/cli-plugins
359 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
360 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
361 - chmod +x ~/.docker/cli-plugins/docker-buildx
362 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
363 - docker buildx create --name mbuilder --driver docker-container --use
364 - docker buildx inspect --bootstrap
365 - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG .
366 tags:
367 - dind
368 only:
369 - /^release/.*$/@pleroma/pleroma
370
371 docker-adhoc:
372 stage: docker
373 image: docker:latest
374 cache: {}
375 dependencies: []
376 variables: *docker-variables
377 before_script: *before-docker
378 allow_failure: true
379 script:
380 script:
381 - mkdir -p /root/.docker/cli-plugins
382 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
383 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
384 - chmod +x ~/.docker/cli-plugins/docker-buildx
385 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
386 - docker buildx create --name mbuilder --driver docker-container --use
387 - docker buildx inspect --bootstrap
388 - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG .
389 tags:
390 - dind
391 only:
392 - /^build-docker/.*$/@pleroma/pleroma