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
43 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
48 - mix pleroma.load_testing
53 cache: &testing_cache_policy
54 <<: *global_cache_policy
60 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
62 - apt-get update && apt-get install -y libimage-exiftool-perl
66 - mix coveralls --preload-modules
68 # Removed to fix CI issue. In this early state it wasn't adding much value anyway.
69 # TODO Fix and reinstate federated testing
72 # cache: *testing_cache_policy
74 # - name: minibikini/postgres-with-rum:12
76 # command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
82 # - mix test --trace --only federated
87 cache: *testing_cache_policy
89 - name: minibikini/postgres-with-rum:12
91 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
96 - apt-get update && apt-get install -y libimage-exiftool-perl
100 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
101 - mix test --preload-modules
105 cache: *testing_cache_policy
107 - mix format --check-formatted
111 cache: *testing_cache_policy
114 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
118 cache: *testing_cache_policy
121 - stable@pleroma/pleroma
122 - develop@pleroma/pleroma
126 - 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
131 - apk update && apk add openssh-client git
134 name: review/$CI_COMMIT_REF_NAME
135 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
136 on_stop: stop_review_app
143 - echo "$CI_ENVIRONMENT_SLUG"
145 - eval $(ssh-agent -s)
146 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
147 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
148 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
149 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
150 - 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
151 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
152 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
153 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
154 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
160 - apk update && apk add openssh-client git
163 name: review/$CI_COMMIT_REF_NAME
166 - echo "$CI_ENVIRONMENT_SLUG"
168 - eval $(ssh-agent -s)
169 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
170 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
171 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
172 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
178 - stable@pleroma/pleroma
179 - develop@pleroma/pleroma
180 - /^maint/.*$/@pleroma/pleroma
181 - /^release/.*$/@pleroma/pleroma
182 artifacts: &release-artifacts
183 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
186 # Ideally it would be never for master branch and with the next commit for develop,
187 # but Gitlab does not support neither `only` for artifacts
188 # nor setting it to never from .gitlab-ci.yml
189 # nor expiring with the next commit
192 cache: &release-cache
193 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
196 variables: &release-variables
198 before_script: &before-release
199 - apt-get update && apt-get install -y cmake
200 - echo "import Mix.Config" > config/prod.secret.exs
201 - mix local.hex --force
202 - mix local.rebar --force
204 - mix deps.get --only prod
206 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
207 - mix release --path release
212 artifacts: *release-artifacts
214 image: elixir:1.10.3-alpine
215 cache: *release-cache
216 variables: *release-variables
217 before_script: &before-release-musl
218 - apk add git gcc g++ musl-dev make cmake
219 - echo "import Mix.Config" > config/prod.secret.exs
220 - mix local.hex --force
221 - mix local.rebar --force
226 artifacts: *release-artifacts
231 cache: *release-cache
232 variables: *release-variables
233 before_script: *before-release
238 artifacts: *release-artifacts
242 image: elixir:1.10.3-alpine
243 cache: *release-cache
244 variables: *release-variables
245 before_script: *before-release-musl
250 artifacts: *release-artifacts
255 cache: *release-cache
256 variables: *release-variables
257 before_script: *before-release
262 artifacts: *release-artifacts
266 # TODO: Replace with upstream image when 1.9.0 comes out
267 image: elixir:1.10.3-alpine
268 cache: *release-cache
269 variables: *release-variables
270 before_script: *before-release-musl
278 variables: &docker-variables
279 DOCKER_DRIVER: overlay2
280 DOCKER_HOST: unix:///var/run/docker.sock
281 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
282 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
283 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
284 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
285 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
286 DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
287 before_script: &before-docker
288 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
289 - docker pull $IMAGE_TAG_SLUG || true
290 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
291 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
294 - mkdir -p /root/.docker/cli-plugins
295 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
296 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
297 - chmod +x ~/.docker/cli-plugins/docker-buildx
298 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
299 - docker buildx create --name mbuilder --driver docker-container --use
300 - docker buildx inspect --bootstrap
301 - 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 .
305 - develop@pleroma/pleroma
312 variables: *docker-variables
313 before_script: *before-docker
316 - mkdir -p /root/.docker/cli-plugins
317 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
318 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
319 - chmod +x ~/.docker/cli-plugins/docker-buildx
320 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
321 - docker buildx create --name mbuilder --driver docker-container --use
322 - docker buildx inspect --bootstrap
323 - 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 .
327 - stable@pleroma/pleroma
334 variables: *docker-variables
335 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 .
350 - /^release/.*$/@pleroma/pleroma