2022-08-26 14:31:00 -07:00
|
|
|
image: registry.gitlab.com/soapbox-pub/rebased/ci
|
2017-11-02 09:26:13 -07:00
|
|
|
|
2019-12-17 07:24:16 -08:00
|
|
|
variables: &global_variables
|
2017-11-02 09:26:13 -07:00
|
|
|
POSTGRES_DB: pleroma_test
|
2017-11-02 09:52:53 -07:00
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
2018-04-24 05:28:59 -07:00
|
|
|
DB_HOST: postgres
|
2022-11-11 07:22:21 -08:00
|
|
|
DB_PORT: 5432
|
2018-12-26 09:50:52 -08:00
|
|
|
MIX_ENV: test
|
2022-08-05 12:59:25 -07:00
|
|
|
# Needed for Dokku deployment.
|
|
|
|
# https://github.com/dokku/dokku/issues/2514#issuecomment-616775470
|
|
|
|
GIT_DEPTH: 0
|
2018-11-29 01:20:47 -08:00
|
|
|
|
2022-08-26 15:36:49 -07:00
|
|
|
cache: &cache
|
2021-04-28 10:31:22 -07:00
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- mix.lock
|
2018-11-29 00:45:14 -08:00
|
|
|
paths:
|
2020-01-10 11:09:14 -08:00
|
|
|
- deps
|
|
|
|
- _build
|
2022-08-26 15:36:49 -07:00
|
|
|
policy: pull
|
2020-01-10 11:09:14 -08:00
|
|
|
|
2017-11-02 09:26:13 -07:00
|
|
|
stages:
|
2022-08-26 15:36:49 -07:00
|
|
|
- deps
|
2017-11-02 09:26:13 -07:00
|
|
|
- test
|
2022-09-04 18:43:54 -07:00
|
|
|
- deploy
|
2017-11-02 09:26:13 -07:00
|
|
|
|
2022-09-04 18:43:54 -07:00
|
|
|
deps:
|
2022-08-26 15:36:49 -07:00
|
|
|
stage: deps
|
|
|
|
script:
|
|
|
|
- mix deps.get
|
|
|
|
- mix deps.compile
|
|
|
|
cache:
|
|
|
|
<<: *cache
|
|
|
|
policy: pull-push
|
2022-09-05 12:28:34 -07:00
|
|
|
only:
|
|
|
|
changes:
|
|
|
|
- mix.lock
|
2021-04-29 11:03:41 -07:00
|
|
|
|
2022-08-26 15:36:49 -07:00
|
|
|
openapi:
|
2021-02-03 04:38:59 -08:00
|
|
|
stage: test
|
2021-06-02 10:09:41 -07:00
|
|
|
only:
|
|
|
|
changes:
|
2022-07-11 01:15:18 -07:00
|
|
|
- ".gitlab-ci.yml"
|
2021-06-02 10:09:41 -07:00
|
|
|
- "lib/pleroma/web/api_spec/**/*.ex"
|
|
|
|
- "lib/pleroma/web/api_spec.ex"
|
2021-02-03 04:38:59 -08:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2022-08-26 15:36:49 -07:00
|
|
|
- spec.json
|
2019-10-10 05:24:54 -07:00
|
|
|
script:
|
2022-08-26 15:36:49 -07:00
|
|
|
- mix pleroma.openapi_spec spec.json
|
2019-06-13 03:53:59 -07:00
|
|
|
|
2022-08-26 15:37:59 -07:00
|
|
|
test:
|
2019-04-01 22:58:09 -07:00
|
|
|
stage: test
|
2021-06-02 10:00:45 -07:00
|
|
|
only:
|
2022-09-04 19:12:05 -07:00
|
|
|
changes: &elixir-changes
|
|
|
|
- ".gitlab-ci.yml"
|
|
|
|
- "**/*.ex"
|
|
|
|
- "**/*.exs"
|
|
|
|
- "mix.lock"
|
2022-08-26 15:36:49 -07:00
|
|
|
services: &db-services
|
2022-09-04 19:12:05 -07:00
|
|
|
- name: postgres:13-alpine
|
|
|
|
alias: postgres
|
|
|
|
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
|
2022-08-26 15:36:49 -07:00
|
|
|
before_script: &db-setup
|
2019-04-01 22:58:09 -07:00
|
|
|
- mix ecto.create
|
|
|
|
- mix ecto.migrate
|
2022-08-26 15:36:49 -07:00
|
|
|
script:
|
2022-09-02 19:57:53 -07:00
|
|
|
- mix test --cover --preload-modules
|
|
|
|
coverage: '/^Line total: ([^ ]*%)$/'
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
coverage_report:
|
|
|
|
coverage_format: cobertura
|
|
|
|
path: coverage.xml
|
2019-04-01 22:58:09 -07:00
|
|
|
|
2022-08-26 15:37:59 -07:00
|
|
|
test-erratic:
|
2021-12-26 07:14:56 -08:00
|
|
|
stage: test
|
2022-01-15 11:35:22 -08:00
|
|
|
allow_failure: true
|
2021-12-26 07:14:56 -08:00
|
|
|
only:
|
2022-08-26 15:36:49 -07:00
|
|
|
changes: *elixir-changes
|
|
|
|
services: *db-services
|
|
|
|
before_script: *db-setup
|
2021-12-26 07:14:56 -08:00
|
|
|
script:
|
|
|
|
- mix test --only=erratic
|
|
|
|
|
2019-04-01 22:58:09 -07:00
|
|
|
lint:
|
|
|
|
stage: test
|
2021-06-02 10:00:45 -07:00
|
|
|
only:
|
2022-08-26 15:36:49 -07:00
|
|
|
changes: *elixir-changes
|
2019-04-01 22:58:09 -07:00
|
|
|
script:
|
|
|
|
- mix format --check-formatted
|
|
|
|
|
2023-06-07 07:16:59 -07:00
|
|
|
# analysis:
|
|
|
|
# stage: test
|
|
|
|
# only:
|
|
|
|
# changes: *elixir-changes
|
|
|
|
# script:
|
|
|
|
# - mix credo --strict --only=warnings,todo,fixme,consistency,readability
|
2019-04-01 22:58:09 -07:00
|
|
|
|
2021-05-23 16:31:07 -07:00
|
|
|
cycles:
|
|
|
|
stage: test
|
2021-06-11 06:45:19 -07:00
|
|
|
only:
|
2022-08-26 15:36:49 -07:00
|
|
|
changes: *elixir-changes
|
2021-12-26 09:54:54 -08:00
|
|
|
script:
|
2021-05-23 16:31:07 -07:00
|
|
|
- mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}'
|
|
|
|
|
2022-08-05 11:14:03 -07:00
|
|
|
# Deploy with Dokku
|
|
|
|
# https://github.com/dokku/gitlab-ci
|
|
|
|
# https://github.com/dokku/ci-docker-image
|
2022-08-26 15:36:49 -07:00
|
|
|
review:
|
2022-08-05 11:14:03 -07:00
|
|
|
image: dokku/ci-docker-image
|
2022-09-04 19:31:30 -07:00
|
|
|
stage: test
|
2019-05-31 01:55:35 -07:00
|
|
|
environment:
|
|
|
|
name: review/$CI_COMMIT_REF_NAME
|
2022-09-04 20:04:40 -07:00
|
|
|
url: https://rebased-$CI_COMMIT_REF_SLUG.dokku.soapbox.pub
|
2019-05-31 01:55:35 -07:00
|
|
|
only:
|
|
|
|
- branches
|
|
|
|
except:
|
|
|
|
- develop
|
2022-08-05 11:14:03 -07:00
|
|
|
variables:
|
2022-09-04 20:04:40 -07:00
|
|
|
GIT_REMOTE_URL: ssh://dokku@$DOKKU_HOST/rebased-$CI_COMMIT_REF_SLUG
|
2022-09-04 21:00:10 -07:00
|
|
|
GIT_PUSH_FLAGS: --force
|
2022-08-05 11:14:03 -07:00
|
|
|
script: dokku-deploy
|
2021-02-17 08:24:37 -08:00
|
|
|
allow_failure: true
|
2022-09-04 18:43:54 -07:00
|
|
|
|
|
|
|
release:
|
|
|
|
stage: deploy
|
|
|
|
variables:
|
|
|
|
MIX_ENV: prod
|
|
|
|
PLEROMA_BUILD_BRANCH: $CI_COMMIT_REF_NAME
|
|
|
|
script:
|
|
|
|
- mix deps.get
|
|
|
|
- mkdir release
|
|
|
|
- mix release --path release
|
|
|
|
artifacts:
|
|
|
|
name: "rebased-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
|
|
|
|
paths:
|
|
|
|
- release/*
|
|
|
|
cache: {}
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- develop
|
2022-09-04 20:06:02 -07:00
|
|
|
changes: *elixir-changes
|
|
|
|
|
|
|
|
docker:
|
|
|
|
stage: deploy
|
|
|
|
image: docker:20.10.17
|
|
|
|
cache: {}
|
|
|
|
services:
|
|
|
|
- docker:20.10.17-dind
|
2022-10-09 10:25:23 -07:00
|
|
|
tags:
|
|
|
|
- dind
|
2022-09-04 20:06:02 -07:00
|
|
|
# https://medium.com/devops-with-valentine/how-to-build-a-docker-image-and-push-it-to-the-gitlab-container-registry-from-a-gitlab-ci-pipeline-acac0d1f26df
|
|
|
|
script:
|
|
|
|
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
|
|
|
|
- docker build -t $CI_REGISTRY_IMAGE .
|
|
|
|
- docker push $CI_REGISTRY_IMAGE
|
|
|
|
only:
|
|
|
|
refs:
|
2022-12-22 08:56:29 -08:00
|
|
|
- develop
|