3 variables: &global_variables
4 POSTGRES_DB: pleroma_test
5 POSTGRES_USER: postgres
6 POSTGRES_PASSWORD: postgres
10 cache: &global_cache_policy
28 - rm -rf _build/*/lib/pleroma
29 - apt-get update && apt-get install -y cmake
30 - mix local.hex --force
31 - mix local.rebar --force
34 - apt-get install -y libmagic-dev
37 - rm -rf _build/*/lib/pleroma
53 - "lib/pleroma/web/api_spec/**/*.ex"
54 - "lib/pleroma/web/api_spec.ex"
59 - mix pleroma.openapi_spec spec.json
69 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
73 - mix pleroma.load_testing
82 cache: &testing_cache_policy
83 <<: *global_cache_policy
89 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
91 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
94 - mix coveralls --preload-modules
104 cache: &testing_cache_policy
105 <<: *global_cache_policy
111 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
115 - mix test --only=erratic
117 # Removed to fix CI issue. In this early state it wasn't adding much value anyway.
118 # TODO Fix and reinstate federated testing
121 # cache: *testing_cache_policy
123 # - name: minibikini/postgres-with-rum:12
125 # command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
131 # - mix test --trace --only federated
140 cache: *testing_cache_policy
142 - name: minibikini/postgres-with-rum:12
144 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
146 <<: *global_variables
149 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
152 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
153 - mix test --preload-modules
163 cache: *testing_cache_policy
165 - mix format --check-formatted
174 cache: *testing_cache_policy
176 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
190 - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}'
194 cache: *testing_cache_policy
197 - stable@pleroma/pleroma
198 - develop@pleroma/pleroma
202 - 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
207 - apk update && apk add openssh-client git
210 name: review/$CI_COMMIT_REF_NAME
211 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
212 on_stop: stop_review_app
219 - echo "$CI_ENVIRONMENT_SLUG"
221 - eval $(ssh-agent -s)
222 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
223 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
224 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
225 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
226 - 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
227 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
228 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
229 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
230 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
238 - develop@pleroma/pleroma
243 - 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
250 - apk update && apk add openssh-client git
253 name: review/$CI_COMMIT_REF_NAME
256 - echo "$CI_ENVIRONMENT_SLUG"
258 - eval $(ssh-agent -s)
259 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
260 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
261 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
262 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
268 - stable@pleroma/pleroma
269 - develop@pleroma/pleroma
270 - /^maint/.*$/@pleroma/pleroma
271 - /^release/.*$/@pleroma/pleroma
272 artifacts: &release-artifacts
273 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
276 # Ideally it would be never for master branch and with the next commit for develop,
277 # but Gitlab does not support neither `only` for artifacts
278 # nor setting it to never from .gitlab-ci.yml
279 # nor expiring with the next commit
282 cache: &release-cache
283 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
286 variables: &release-variables
288 before_script: &before-release
289 - apt-get update && apt-get install -y cmake libmagic-dev
290 - echo "import Mix.Config" > config/prod.secret.exs
291 - mix local.hex --force
292 - mix local.rebar --force
294 - mix deps.get --only prod
296 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
297 - mix release --path release
302 artifacts: *release-artifacts
304 image: elixir:1.10.4-alpine
305 cache: *release-cache
306 variables: *release-variables
307 before_script: &before-release-musl
308 - apk add git gcc g++ musl-dev make cmake file-dev
309 - echo "import Mix.Config" > config/prod.secret.exs
310 - mix local.hex --force
311 - mix local.rebar --force
316 artifacts: *release-artifacts
320 image: arm32v7/elixir:1.10.4
321 cache: *release-cache
322 variables: *release-variables
323 before_script: *before-release
328 artifacts: *release-artifacts
332 image: arm32v7/elixir:1.10.4-alpine
333 cache: *release-cache
334 variables: *release-variables
335 before_script: *before-release-musl
340 artifacts: *release-artifacts
344 image: arm64v8/elixir:1.10.4
345 cache: *release-cache
346 variables: *release-variables
347 before_script: *before-release
352 artifacts: *release-artifacts
356 image: arm64v8/elixir:1.10.4-alpine
357 cache: *release-cache
358 variables: *release-variables
359 before_script: *before-release-musl
367 variables: &docker-variables
368 DOCKER_DRIVER: overlay2
369 DOCKER_HOST: unix:///var/run/docker.sock
370 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
371 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
372 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
373 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
374 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64
375 DOCKER_BUILDX_HASH: 980e6b9655f971991fbbb5fd6cd19f1672386195
376 before_script: &before-docker
377 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
378 - docker pull $IMAGE_TAG_SLUG || true
379 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
380 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
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 -t $IMAGE_TAG_LATEST .
394 - develop@pleroma/pleroma
401 variables: *docker-variables
402 before_script: *before-docker
405 - mkdir -p /root/.docker/cli-plugins
406 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
407 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
408 - chmod +x ~/.docker/cli-plugins/docker-buildx
409 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
410 - docker buildx create --name mbuilder --driver docker-container --use
411 - docker buildx inspect --bootstrap
412 - 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 .
416 - stable@pleroma/pleroma
423 variables: *docker-variables
424 before_script: *before-docker
428 - mkdir -p /root/.docker/cli-plugins
429 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
430 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
431 - chmod +x ~/.docker/cli-plugins/docker-buildx
432 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
433 - docker buildx create --name mbuilder --driver docker-container --use
434 - docker buildx inspect --bootstrap
435 - 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 .
439 - /^release/.*$/@pleroma/pleroma
446 variables: *docker-variables
447 before_script: *before-docker
451 - mkdir -p /root/.docker/cli-plugins
452 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
453 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
454 - chmod +x ~/.docker/cli-plugins/docker-buildx
455 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
456 - docker buildx create --name mbuilder --driver docker-container --use
457 - docker buildx inspect --bootstrap
458 - 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 .
462 - /^build-docker/.*$/@pleroma/pleroma