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"]
64 - mix coveralls --preload-modules
66 # Removed to fix CI issue. In this early state it wasn't adding much value anyway.
67 # TODO Fix and reinstate federated testing
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"]
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
173 # TODO: Replace with upstream image when 1.9.0 comes out
174 image: rinpatch/elixir:1.9.0-rc.0
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 - echo "import Mix.Config" > config/prod.secret.exs
198 - mix local.hex --force
199 - mix local.rebar --force
201 - mix deps.get --only prod
203 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
204 - mix release --path release
209 artifacts: *release-artifacts
211 # TODO: Replace with upstream image when 1.9.0 comes out
212 image: rinpatch/elixir:1.9.0-rc.0-alpine
213 cache: *release-cache
214 variables: *release-variables
215 before_script: &before-release-musl
216 - apk add git gcc g++ musl-dev make
217 - echo "import Mix.Config" > config/prod.secret.exs
218 - mix local.hex --force
219 - mix local.rebar --force
224 artifacts: *release-artifacts
228 # TODO: Replace with upstream image when 1.9.0 comes out
229 image: rinpatch/elixir:1.9.0-rc.0-arm
230 cache: *release-cache
231 variables: *release-variables
232 before_script: *before-release
237 artifacts: *release-artifacts
241 # TODO: Replace with upstream image when 1.9.0 comes out
242 image: rinpatch/elixir:1.9.0-rc.0-arm-alpine
243 cache: *release-cache
244 variables: *release-variables
245 before_script: *before-release-musl
250 artifacts: *release-artifacts
254 # TODO: Replace with upstream image when 1.9.0 comes out
255 image: rinpatch/elixir:1.9.0-rc.0-arm64
256 cache: *release-cache
257 variables: *release-variables
258 before_script: *before-release
263 artifacts: *release-artifacts
267 # TODO: Replace with upstream image when 1.9.0 comes out
268 image: rinpatch/elixir:1.9.0-rc.0-arm64-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 before_script: &before-docker
287 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
288 - docker pull $IMAGE_TAG_SLUG || true
289 - export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
290 - export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
293 - 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 .
294 - docker push $IMAGE_TAG
295 - docker push $IMAGE_TAG_SLUG
296 - docker push $IMAGE_TAG_LATEST
300 - develop@pleroma/pleroma
307 variables: *docker-variables
308 before_script: *before-docker
311 - 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 .
312 - docker push $IMAGE_TAG
313 - docker push $IMAGE_TAG_SLUG
314 - docker push $IMAGE_TAG_LATEST_STABLE
318 - stable@pleroma/pleroma
325 variables: *docker-variables
326 before_script: *before-docker
329 - 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 .
330 - docker push $IMAGE_TAG
331 - docker push $IMAGE_TAG_SLUG
335 - /^release/.*$/@pleroma/pleroma