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
233 cache: *release-cache
234 variables: *release-variables
235 before_script: *before-release
240 artifacts: *release-artifacts
244 image: elixir:1.10.3-alpine
245 cache: *release-cache
246 variables: *release-variables
247 before_script: *before-release-musl
252 artifacts: *release-artifacts
257 cache: *release-cache
258 variables: *release-variables
259 before_script: *before-release
264 artifacts: *release-artifacts
268 # TODO: Replace with upstream image when 1.9.0 comes out
269 image: elixir:1.10.3-alpine
270 cache: *release-cache
271 variables: *release-variables
272 before_script: *before-release-musl
280 variables: &docker-variables
281 DOCKER_DRIVER: overlay2
282 DOCKER_HOST: unix:///var/run/docker.sock
283 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
284 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
285 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
286 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
287 DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
288 DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
289 before_script: &before-docker
290 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
291 - docker pull $IMAGE_TAG_SLUG || true
292 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
293 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
296 - mkdir -p /root/.docker/cli-plugins
297 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
298 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
299 - chmod +x ~/.docker/cli-plugins/docker-buildx
300 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
301 - docker buildx create --name mbuilder --driver docker-container --use
302 - docker buildx inspect --bootstrap
303 - 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 .
307 - develop@pleroma/pleroma
314 variables: *docker-variables
315 before_script: *before-docker
318 - mkdir -p /root/.docker/cli-plugins
319 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
320 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
321 - chmod +x ~/.docker/cli-plugins/docker-buildx
322 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
323 - docker buildx create --name mbuilder --driver docker-container --use
324 - docker buildx inspect --bootstrap
325 - 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 .
329 - stable@pleroma/pleroma
336 variables: *docker-variables
337 before_script: *before-docker
341 - mkdir -p /root/.docker/cli-plugins
342 - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
343 - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
344 - chmod +x ~/.docker/cli-plugins/docker-buildx
345 - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
346 - docker buildx create --name mbuilder --driver docker-container --use
347 - docker buildx inspect --bootstrap
348 - 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 .
352 - /^release/.*$/@pleroma/pleroma