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
|
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
|
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-08-26 15:36:49 -07:00
|
|
|
changes: *elixir-changes
|
|
|
|
services: &db-services
|
2022-07-11 00:28:30 -07:00
|
|
|
- name: postgres:13-alpine
|
2019-05-17 06:21:29 -07:00
|
|
|
alias: postgres
|
2019-04-01 22:58:09 -07:00
|
|
|
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:
|
2019-11-14 05:06:08 -08:00
|
|
|
- mix coveralls --preload-modules
|
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:
|
2022-08-26 15:36:49 -07:00
|
|
|
image: ¤t-elixir elixir:1.12-alpine
|
2019-04-01 22:58:09 -07:00
|
|
|
stage: test
|
2021-06-02 10:00:45 -07:00
|
|
|
only:
|
2022-08-26 15:36:49 -07:00
|
|
|
changes: *elixir-changes
|
|
|
|
before_script: ¤t-setup
|
2022-07-11 00:28:47 -07:00
|
|
|
- apk update
|
2022-07-11 13:57:30 -07:00
|
|
|
- apk add build-base cmake file-dev git openssl
|
2021-12-26 09:54:54 -08:00
|
|
|
- mix local.hex --force
|
|
|
|
- mix local.rebar --force
|
|
|
|
- mix deps.get
|
2019-04-01 22:58:09 -07:00
|
|
|
script:
|
|
|
|
- mix format --check-formatted
|
|
|
|
|
|
|
|
analysis:
|
|
|
|
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 credo --strict --only=warnings,todo,fixme,consistency,readability
|
|
|
|
|
2021-05-23 16:31:07 -07:00
|
|
|
cycles:
|
2022-08-26 15:36:49 -07:00
|
|
|
image: *current-elixir
|
2021-05-23 16:31:07 -07:00
|
|
|
stage: test
|
2021-06-11 06:45:19 -07:00
|
|
|
only:
|
2022-08-26 15:36:49 -07:00
|
|
|
changes: *elixir-changes
|
2021-06-09 11:12:33 -07:00
|
|
|
cache: {}
|
2022-08-26 15:36:49 -07:00
|
|
|
before_script: *current-setup
|
2021-12-26 09:54:54 -08:00
|
|
|
script:
|
2021-05-23 16:31:07 -07:00
|
|
|
- mix compile
|
|
|
|
- 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-08-26 15:36:49 -07:00
|
|
|
stage: deps
|
2019-05-31 01:55:35 -07:00
|
|
|
environment:
|
|
|
|
name: review/$CI_COMMIT_REF_NAME
|
2022-08-05 11:14:03 -07:00
|
|
|
url: https://$CI_ENVIRONMENT_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-08-05 12:20:57 -07:00
|
|
|
GIT_REMOTE_URL: ssh://dokku@$DOKKU_HOST/$CI_ENVIRONMENT_SLUG
|
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
|
|
|
|
changes: &elixir-changes
|
|
|
|
- ".gitlab-ci.yml"
|
|
|
|
- "**/*.ex"
|
|
|
|
- "**/*.exs"
|
|
|
|
- "mix.lock"
|