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
70 cache: *testing_cache_policy
72 - name: minibikini/postgres-with-rum:12
74 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
80 - mix test --trace --only federated
85 cache: *testing_cache_policy
87 - name: minibikini/postgres-with-rum:12
89 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
94 - apt-get update && apt-get install -y libimage-exiftool-perl
98 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
99 - mix test --preload-modules
103 cache: *testing_cache_policy
105 - mix format --check-formatted
109 cache: *testing_cache_policy
112 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
116 cache: *testing_cache_policy
119 - stable@pleroma/pleroma
120 - develop@pleroma/pleroma
124 - 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
129 - apk update && apk add openssh-client git
132 name: review/$CI_COMMIT_REF_NAME
133 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
134 on_stop: stop_review_app
141 - echo "$CI_ENVIRONMENT_SLUG"
143 - eval $(ssh-agent -s)
144 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
145 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
146 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
147 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
148 - 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
149 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
150 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
151 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
152 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
158 - apk update && apk add openssh-client git
161 name: review/$CI_COMMIT_REF_NAME
164 - echo "$CI_ENVIRONMENT_SLUG"
166 - eval $(ssh-agent -s)
167 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
168 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
169 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
170 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
176 - stable@pleroma/pleroma
177 - develop@pleroma/pleroma
178 - /^maint/.*$/@pleroma/pleroma
179 - /^release/.*$/@pleroma/pleroma
180 artifacts: &release-artifacts
181 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
184 # Ideally it would be never for master branch and with the next commit for develop,
185 # but Gitlab does not support neither `only` for artifacts
186 # nor setting it to never from .gitlab-ci.yml
187 # nor expiring with the next commit
190 cache: &release-cache
191 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
194 variables: &release-variables
196 before_script: &before-release
197 - apt install cmake -y
198 - echo "import Mix.Config" > config/prod.secret.exs
199 - mix local.hex --force
200 - mix local.rebar --force
202 - mix deps.get --only prod
204 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
205 - mix release --path release
210 artifacts: *release-artifacts
212 image: elixir:1.10.3-alpine
213 cache: *release-cache
214 variables: *release-variables
215 before_script: &before-release-musl
216 - apk add git gcc g++ musl-dev make cmake
217 - echo "import Mix.Config" > config/prod.secret.exs
218 - mix local.hex --force
219 - mix local.rebar --force
224 artifacts: *release-artifacts
229 cache: *release-cache
230 variables: *release-variables
231 before_script: *before-release
236 artifacts: *release-artifacts
240 image: elixir:1.10.3-alpine
241 cache: *release-cache
242 variables: *release-variables
243 before_script: *before-release-musl
248 artifacts: *release-artifacts
253 cache: *release-cache
254 variables: *release-variables
255 before_script: *before-release
260 artifacts: *release-artifacts
264 # TODO: Replace with upstream image when 1.9.0 comes out
265 image: elixir:1.10.3-alpine
266 cache: *release-cache
267 variables: *release-variables
268 before_script: *before-release-musl
276 variables: &docker-variables
277 DOCKER_DRIVER: overlay2
278 DOCKER_HOST: unix:///var/run/docker.sock
279 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
280 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
281 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
282 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
283 before_script: &before-docker
284 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
285 - docker pull $IMAGE_TAG_SLUG || true
286 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
287 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
290 - docker build --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 .
291 - docker push $IMAGE_TAG
292 - docker push $IMAGE_TAG_SLUG
293 - docker push $IMAGE_TAG_LATEST
297 - develop@pleroma/pleroma
304 variables: *docker-variables
305 before_script: *before-docker
308 - docker build --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 .
309 - docker push $IMAGE_TAG
310 - docker push $IMAGE_TAG_SLUG
311 - docker push $IMAGE_TAG_LATEST_STABLE
315 - stable@pleroma/pleroma
322 variables: *docker-variables
323 before_script: *before-docker
326 - docker build --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 .
327 - docker push $IMAGE_TAG
328 - docker push $IMAGE_TAG_SLUG
332 - /^release/.*$/@pleroma/pleroma