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
45 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
50 - mix pleroma.load_testing
55 cache: &testing_cache_policy
56 <<: *global_cache_policy
62 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
64 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
68 - mix coveralls --preload-modules
70 # Removed to fix CI issue. In this early state it wasn't adding much value anyway.
71 # TODO Fix and reinstate federated testing
74 # cache: *testing_cache_policy
76 # - name: minibikini/postgres-with-rum:12
78 # command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
84 # - mix test --trace --only federated
89 cache: *testing_cache_policy
91 - name: minibikini/postgres-with-rum:12
93 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
98 - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
102 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
103 - mix test --preload-modules
107 cache: *testing_cache_policy
109 - mix format --check-formatted
113 cache: *testing_cache_policy
116 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
120 cache: *testing_cache_policy
123 - stable@pleroma/pleroma
124 - develop@pleroma/pleroma
128 - 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 - apk update && apk add openssh-client git
136 name: review/$CI_COMMIT_REF_NAME
137 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
138 on_stop: stop_review_app
145 - echo "$CI_ENVIRONMENT_SLUG"
147 - eval $(ssh-agent -s)
148 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
149 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
150 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
151 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
152 - 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
153 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
154 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
155 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
156 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
162 - apk update && apk add openssh-client git
165 name: review/$CI_COMMIT_REF_NAME
168 - echo "$CI_ENVIRONMENT_SLUG"
170 - eval $(ssh-agent -s)
171 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
172 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
173 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
174 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
180 - stable@pleroma/pleroma
181 - develop@pleroma/pleroma
182 - /^maint/.*$/@pleroma/pleroma
183 - /^release/.*$/@pleroma/pleroma
184 artifacts: &release-artifacts
185 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
188 # Ideally it would be never for master branch and with the next commit for develop,
189 # but Gitlab does not support neither `only` for artifacts
190 # nor setting it to never from .gitlab-ci.yml
191 # nor expiring with the next commit
194 cache: &release-cache
195 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
198 variables: &release-variables
200 before_script: &before-release
201 - apt-get update && apt-get install -y cmake libmagic-dev
202 - echo "import Mix.Config" > config/prod.secret.exs
203 - mix local.hex --force
204 - mix local.rebar --force
206 - mix deps.get --only prod
208 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
209 - mix release --path release
214 artifacts: *release-artifacts
216 image: elixir:1.10.3-alpine
217 cache: *release-cache
218 variables: *release-variables
219 before_script: &before-release-musl
220 - apk add git gcc g++ musl-dev make cmake file-dev
221 - echo "import Mix.Config" > config/prod.secret.exs
222 - mix local.hex --force
223 - mix local.rebar --force
228 artifacts: *release-artifacts
232 image: arm32v7/elixir:1.10.3
233 cache: *release-cache
234 variables: *release-variables
235 before_script: *before-release
240 artifacts: *release-artifacts
244 image: arm32v7/elixir:1.10.3-alpine
245 cache: *release-cache
246 variables: *release-variables
247 before_script: *before-release-musl
252 artifacts: *release-artifacts
256 image: arm64v8/elixir:1.10.3
257 cache: *release-cache
258 variables: *release-variables
259 before_script: *before-release
264 artifacts: *release-artifacts
268 image: arm64v8/elixir:1.10.3-alpine
269 cache: *release-cache
270 variables: *release-variables
271 before_script: *before-release-musl
279 variables: &docker-variables
280 DOCKER_DRIVER: overlay2
281 DOCKER_HOST: unix:///var/run/docker.sock
282 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
283 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
284 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
285 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
286 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
287 DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
288 before_script: &before-docker
289 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
290 - docker pull $IMAGE_TAG_SLUG || true
291 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
292 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
295 - mkdir -p /root/.docker/cli-plugins
296 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
297 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
298 - chmod +x ~/.docker/cli-plugins/docker-buildx
299 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
300 - docker buildx create --name mbuilder --driver docker-container --use
301 - docker buildx inspect --bootstrap
302 - 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 .
306 - develop@pleroma/pleroma
313 variables: *docker-variables
314 before_script: *before-docker
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_STABLE .
328 - stable@pleroma/pleroma
335 variables: *docker-variables
336 before_script: *before-docker
340 - mkdir -p /root/.docker/cli-plugins
341 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
342 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
343 - chmod +x ~/.docker/cli-plugins/docker-buildx
344 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
345 - docker buildx create --name mbuilder --driver docker-container --use
346 - docker buildx inspect --bootstrap
347 - 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 .
351 - /^release/.*$/@pleroma/pleroma