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 - mix local.hex --force
26 - mix local.rebar --force
42 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
47 - mix pleroma.load_testing
52 cache: &testing_cache_policy
53 <<: *global_cache_policy
59 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
61 - apt-get update && apt-get install -y libimage-exiftool-perl
65 - mix coveralls --preload-modules
69 cache: *testing_cache_policy
71 - name: minibikini/postgres-with-rum:12
73 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
79 - mix test --trace --only federated
84 cache: *testing_cache_policy
86 - name: minibikini/postgres-with-rum:12
88 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
93 - apt-get update && apt-get install -y libimage-exiftool-perl
97 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
98 - mix test --preload-modules
102 cache: *testing_cache_policy
104 - mix format --check-formatted
108 cache: *testing_cache_policy
111 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
115 cache: *testing_cache_policy
118 - stable@pleroma/pleroma
119 - develop@pleroma/pleroma
123 - 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
128 - apk update && apk add openssh-client git
131 name: review/$CI_COMMIT_REF_NAME
132 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
133 on_stop: stop_review_app
140 - echo "$CI_ENVIRONMENT_SLUG"
142 - eval $(ssh-agent -s)
143 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
144 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
145 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
146 - (ssh -t dokku@pleroma.online -- git:set "$CI_ENVIRONMENT_SLUG" keep-git-dir true) || true
147 - 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
148 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
149 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
150 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
151 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
157 - apk update && apk add openssh-client git
160 name: review/$CI_COMMIT_REF_NAME
163 - echo "$CI_ENVIRONMENT_SLUG"
165 - eval $(ssh-agent -s)
166 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
167 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
168 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
169 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
175 - stable@pleroma/pleroma
176 - develop@pleroma/pleroma
177 - /^maint/.*$/@pleroma/pleroma
178 - /^release/.*$/@pleroma/pleroma
179 artifacts: &release-artifacts
180 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
183 # Ideally it would be never for master branch and with the next commit for develop,
184 # but Gitlab does not support neither `only` for artifacts
185 # nor setting it to never from .gitlab-ci.yml
186 # nor expiring with the next commit
189 cache: &release-cache
190 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
193 variables: &release-variables
195 before_script: &before-release
196 - echo "import Mix.Config" > config/prod.secret.exs
197 - mix local.hex --force
198 - mix local.rebar --force
200 - mix deps.get --only prod
202 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
203 - mix release --path release
208 artifacts: *release-artifacts
210 image: elixir:1.10.3-alpine
211 cache: *release-cache
212 variables: *release-variables
213 before_script: &before-release-musl
214 - apk add git gcc g++ musl-dev make
215 - echo "import Mix.Config" > config/prod.secret.exs
216 - mix local.hex --force
217 - mix local.rebar --force
222 artifacts: *release-artifacts
227 cache: *release-cache
228 variables: *release-variables
229 before_script: *before-release
234 artifacts: *release-artifacts
238 image: elixir:1.10.3-alpine
239 cache: *release-cache
240 variables: *release-variables
241 before_script: *before-release-musl
246 artifacts: *release-artifacts
251 cache: *release-cache
252 variables: *release-variables
253 before_script: *before-release
258 artifacts: *release-artifacts
262 # TODO: Replace with upstream image when 1.9.0 comes out
263 image: elixir:1.10.3-alpine
264 cache: *release-cache
265 variables: *release-variables
266 before_script: *before-release-musl
274 variables: &docker-variables
275 DOCKER_DRIVER: overlay2
276 DOCKER_HOST: unix:///var/run/docker.sock
277 IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
278 IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
279 IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
280 IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
281 before_script: &before-docker
282 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
283 - docker pull $IMAGE_TAG_SLUG || true
284 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
285 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
288 - 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 .
289 - docker push $IMAGE_TAG
290 - docker push $IMAGE_TAG_SLUG
291 - docker push $IMAGE_TAG_LATEST
295 - develop@pleroma/pleroma
302 variables: *docker-variables
303 before_script: *before-docker
306 - 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 .
307 - docker push $IMAGE_TAG
308 - docker push $IMAGE_TAG_SLUG
309 - docker push $IMAGE_TAG_LATEST_STABLE
313 - stable@pleroma/pleroma
320 variables: *docker-variables
321 before_script: *before-docker
324 - 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 .
325 - docker push $IMAGE_TAG
326 - docker push $IMAGE_TAG_SLUG
330 - /^release/.*$/@pleroma/pleroma