3 variables: &global_variables
4 POSTGRES_DB: pleroma_test
5 POSTGRES_USER: postgres
6 POSTGRES_PASSWORD: postgres
10 cache: &global_cache_policy
11 key: ${CI_COMMIT_REF_SLUG}
25 - apt-get update && apt-get install -y cmake
26 - mix local.hex --force
27 - mix local.rebar --force
29 - apt-get install -y libmagic-dev
43 - mix pleroma.openapi_spec spec.json
53 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
58 - mix pleroma.load_testing
63 cache: &testing_cache_policy
64 <<: *global_cache_policy
70 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
72 - 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
110 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
111 - mix test --preload-modules
115 cache: *testing_cache_policy
117 - mix format --check-formatted
121 cache: *testing_cache_policy
124 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
128 cache: *testing_cache_policy
131 - stable@pleroma/pleroma
132 - develop@pleroma/pleroma
136 - 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
141 - apk update && apk add openssh-client git
144 name: review/$CI_COMMIT_REF_NAME
145 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
146 on_stop: stop_review_app
153 - echo "$CI_ENVIRONMENT_SLUG"
155 - eval $(ssh-agent -s)
156 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
157 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
158 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
159 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
160 - 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
161 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
162 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
163 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
164 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
172 - develop@pleroma/pleroma
177 - 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
184 - apk update && apk add openssh-client git
187 name: review/$CI_COMMIT_REF_NAME
190 - echo "$CI_ENVIRONMENT_SLUG"
192 - eval $(ssh-agent -s)
193 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
194 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
195 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
196 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
202 - stable@pleroma/pleroma
203 - develop@pleroma/pleroma
204 - /^maint/.*$/@pleroma/pleroma
205 - /^release/.*$/@pleroma/pleroma
206 artifacts: &release-artifacts
207 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
210 # Ideally it would be never for master branch and with the next commit for develop,
211 # but Gitlab does not support neither `only` for artifacts
212 # nor setting it to never from .gitlab-ci.yml
213 # nor expiring with the next commit
216 cache: &release-cache
217 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
220 variables: &release-variables
222 before_script: &before-release
223 - apt-get update && apt-get install -y cmake libmagic-dev
224 - echo "import Mix.Config" > config/prod.secret.exs
225 - mix local.hex --force
226 - mix local.rebar --force
228 - mix deps.get --only prod
230 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
231 - mix release --path release
236 artifacts: *release-artifacts
238 image: elixir:1.10.3-alpine
239 cache: *release-cache
240 variables: *release-variables
241 before_script: &before-release-musl
242 - apk add git gcc g++ musl-dev make cmake file-dev
243 - echo "import Mix.Config" > config/prod.secret.exs
244 - mix local.hex --force
245 - mix local.rebar --force
250 artifacts: *release-artifacts
254 image: arm32v7/elixir:1.10.3
255 cache: *release-cache
256 variables: *release-variables
257 before_script: *before-release
262 artifacts: *release-artifacts
266 image: arm32v7/elixir:1.10.3-alpine
267 cache: *release-cache
268 variables: *release-variables
269 before_script: *before-release-musl
274 artifacts: *release-artifacts
278 image: arm64v8/elixir:1.10.3
279 cache: *release-cache
280 variables: *release-variables
281 before_script: *before-release
286 artifacts: *release-artifacts
290 image: arm64v8/elixir:1.10.3-alpine
291 cache: *release-cache
292 variables: *release-variables
293 before_script: *before-release-musl
301 variables: &docker-variables
302 DOCKER_DRIVER: overlay2
303 DOCKER_HOST: unix:///var/run/docker.sock
304 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
305 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
306 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
307 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
308 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
309 DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
310 before_script: &before-docker
311 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
312 - docker pull $IMAGE_TAG_SLUG || true
313 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
314 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
317 - mkdir -p /root/.docker/cli-plugins
318 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
319 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
320 - chmod +x ~/.docker/cli-plugins/docker-buildx
321 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
322 - docker buildx create --name mbuilder --driver docker-container --use
323 - docker buildx inspect --bootstrap
324 - 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 .
328 - develop@pleroma/pleroma
335 variables: *docker-variables
336 before_script: *before-docker
339 - mkdir -p /root/.docker/cli-plugins
340 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
341 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
342 - chmod +x ~/.docker/cli-plugins/docker-buildx
343 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
344 - docker buildx create --name mbuilder --driver docker-container --use
345 - docker buildx inspect --bootstrap
346 - 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 .
350 - stable@pleroma/pleroma
357 variables: *docker-variables
358 before_script: *before-docker
362 - mkdir -p /root/.docker/cli-plugins
363 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
364 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
365 - chmod +x ~/.docker/cli-plugins/docker-buildx
366 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
367 - docker buildx create --name mbuilder --driver docker-container --use
368 - docker buildx inspect --bootstrap
369 - 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 .
373 - /^release/.*$/@pleroma/pleroma