3 variables: &global_variables
4 POSTGRES_DB: pleroma_test
5 POSTGRES_USER: postgres
6 POSTGRES_PASSWORD: postgres
10 cache: &global_cache_policy
27 - apt-get update && apt-get install -y cmake
28 - mix local.hex --force
29 - mix local.rebar --force
32 - apt-get install -y libmagic-dev
45 - mix pleroma.openapi_spec spec.json
55 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
59 - mix pleroma.load_testing
64 cache: &testing_cache_policy
65 <<: *global_cache_policy
71 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
73 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
76 - mix coveralls --preload-modules
78 # Removed to fix CI issue. In this early state it wasn't adding much value anyway.
79 # TODO Fix and reinstate federated testing
82 # cache: *testing_cache_policy
84 # - name: minibikini/postgres-with-rum:12
86 # command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
92 # - mix test --trace --only federated
97 cache: *testing_cache_policy
99 - name: minibikini/postgres-with-rum:12
101 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
103 <<: *global_variables
106 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
109 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
110 - mix test --preload-modules
114 cache: *testing_cache_policy
116 - mix format --check-formatted
120 cache: *testing_cache_policy
122 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
126 cache: *testing_cache_policy
129 - stable@pleroma/pleroma
130 - develop@pleroma/pleroma
134 - 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
139 - apk update && apk add openssh-client git
142 name: review/$CI_COMMIT_REF_NAME
143 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
144 on_stop: stop_review_app
151 - echo "$CI_ENVIRONMENT_SLUG"
153 - eval $(ssh-agent -s)
154 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
155 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
156 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
157 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
158 - 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
159 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
160 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
161 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
162 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
170 - develop@pleroma/pleroma
175 - 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
182 - apk update && apk add openssh-client git
185 name: review/$CI_COMMIT_REF_NAME
188 - echo "$CI_ENVIRONMENT_SLUG"
190 - eval $(ssh-agent -s)
191 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
192 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
193 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
194 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
200 - stable@pleroma/pleroma
201 - develop@pleroma/pleroma
202 - /^maint/.*$/@pleroma/pleroma
203 - /^release/.*$/@pleroma/pleroma
204 artifacts: &release-artifacts
205 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
208 # Ideally it would be never for master branch and with the next commit for develop,
209 # but Gitlab does not support neither `only` for artifacts
210 # nor setting it to never from .gitlab-ci.yml
211 # nor expiring with the next commit
214 cache: &release-cache
215 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
218 variables: &release-variables
220 before_script: &before-release
221 - apt-get update && apt-get install -y cmake libmagic-dev
222 - echo "import Mix.Config" > config/prod.secret.exs
223 - mix local.hex --force
224 - mix local.rebar --force
226 - mix deps.get --only prod
228 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
229 - mix release --path release
234 artifacts: *release-artifacts
236 image: elixir:1.10.3-alpine
237 cache: *release-cache
238 variables: *release-variables
239 before_script: &before-release-musl
240 - apk add git gcc g++ musl-dev make cmake file-dev
241 - echo "import Mix.Config" > config/prod.secret.exs
242 - mix local.hex --force
243 - mix local.rebar --force
248 artifacts: *release-artifacts
252 image: arm32v7/elixir:1.10.3
253 cache: *release-cache
254 variables: *release-variables
255 before_script: *before-release
260 artifacts: *release-artifacts
264 image: arm32v7/elixir:1.10.3-alpine
265 cache: *release-cache
266 variables: *release-variables
267 before_script: *before-release-musl
272 artifacts: *release-artifacts
276 image: arm64v8/elixir:1.10.3
277 cache: *release-cache
278 variables: *release-variables
279 before_script: *before-release
284 artifacts: *release-artifacts
288 image: arm64v8/elixir:1.10.3-alpine
289 cache: *release-cache
290 variables: *release-variables
291 before_script: *before-release-musl
299 variables: &docker-variables
300 DOCKER_DRIVER: overlay2
301 DOCKER_HOST: unix:///var/run/docker.sock
302 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
303 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
304 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
305 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
306 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
307 DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
308 before_script: &before-docker
309 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
310 - docker pull $IMAGE_TAG_SLUG || true
311 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
312 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
315 - mkdir -p /root/.docker/cli-plugins
316 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
317 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
318 - chmod +x ~/.docker/cli-plugins/docker-buildx
319 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
320 - docker buildx create --name mbuilder --driver docker-container --use
321 - docker buildx inspect --bootstrap
322 - 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 .
326 - develop@pleroma/pleroma
333 variables: *docker-variables
334 before_script: *before-docker
337 - mkdir -p /root/.docker/cli-plugins
338 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
339 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
340 - chmod +x ~/.docker/cli-plugins/docker-buildx
341 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
342 - docker buildx create --name mbuilder --driver docker-container --use
343 - docker buildx inspect --bootstrap
344 - 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 .
348 - stable@pleroma/pleroma
355 variables: *docker-variables
356 before_script: *before-docker
360 - mkdir -p /root/.docker/cli-plugins
361 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
362 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
363 - chmod +x ~/.docker/cli-plugins/docker-buildx
364 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
365 - docker buildx create --name mbuilder --driver docker-container --use
366 - docker buildx inspect --bootstrap
367 - 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 .
371 - /^release/.*$/@pleroma/pleroma
378 variables: *docker-variables
379 before_script: *before-docker
383 - mkdir -p /root/.docker/cli-plugins
384 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
385 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
386 - chmod +x ~/.docker/cli-plugins/docker-buildx
387 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
388 - docker buildx create --name mbuilder --driver docker-container --use
389 - docker buildx inspect --bootstrap
390 - 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 .
394 - /^build-docker/.*$/@pleroma/pleroma