.gitlab-ci.yml 1.62 KB
Newer Older
rinpatch's avatar
rinpatch committed
1
image: elixir:1.8.1
lain's avatar
lain committed
2
3

services:
lain's avatar
lain committed
4
  - name: postgres:9.6.2
lain's avatar
lain committed
5
    command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
lain's avatar
lain committed
6
7
8

variables:
  POSTGRES_DB: pleroma_test
Roger Braun's avatar
Roger Braun committed
9
10
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: postgres
lain's avatar
lain committed
11
  DB_HOST: postgres
12
  MIX_ENV: test
13

rinpatch's avatar
rinpatch committed
14
cache:
15
  key: ${CI_COMMIT_REF_SLUG}
rinpatch's avatar
rinpatch committed
16
17
  paths:
          - deps
Rin Toshaka's avatar
Rin Toshaka committed
18
          - _build
lain's avatar
lain committed
19
stages:
lain's avatar
lain committed
20
  - lint
lain's avatar
lain committed
21
  - test
22
  - analysis
rinpatch's avatar
rinpatch committed
23
24
  - docs_build
  - docs_deploy
lain's avatar
lain committed
25
26

before_script:
lain's avatar
lain committed
27
28
  - mix local.hex --force
  - mix local.rebar --force
lain's avatar
lain committed
29
  - mix deps.get
30
  - mix compile --force
31
32
  - mix ecto.create
  - mix ecto.migrate
lain's avatar
lain committed
33

lain's avatar
lain committed
34
35
36
lint:
  stage: lint
  script:
37
    - mix format --check-formatted
lain's avatar
lain committed
38

lain's avatar
lain committed
39
40
41
unit-testing:
  stage: test
  script:
lain's avatar
lain committed
42
    - mix test --trace --preload-modules
43
44
45
46

analysis:
  stage: analysis
  script:
47
    - mix credo --strict --only=warnings,todo,fixme,consistency,readability
rinpatch's avatar
rinpatch committed
48
49
50

docs_build:
  stage: docs_build
51
  services:
rinpatch's avatar
rinpatch committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  only:
  - master@pleroma/pleroma
  - develop@pleroma/pleroma
  variables:
    MIX_ENV: dev
  before_script:
    - mix local.hex --force
    - mix local.rebar --force
    - mix deps.get
    - mix compile
  script:
    - mix docs
  artifacts:
    paths:
      - priv/static/doc

docs_deploy:
  stage: docs_deploy
  image: alpine:3.9
71
  services:
rinpatch's avatar
rinpatch committed
72
73
74
75
76
77
78
79
80
81
82
  only:
  - master@pleroma/pleroma
  - develop@pleroma/pleroma
  before_script:
    - apk update && apk add openssh-client rsync
  script:
    - mkdir -p ~/.ssh
    - echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - rsync -hrvz --delete -e "ssh -p ${SSH_PORT}" priv/static/doc/ "${SSH_USER_HOST_LOCATION}/${CI_COMMIT_REF_NAME}"