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

variables:
  POSTGRES_DB: pleroma_test
Roger Braun's avatar
Roger Braun committed
5
6
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: postgres
lain's avatar
lain committed
7
  DB_HOST: postgres
8
  MIX_ENV: test
9

rinpatch's avatar
rinpatch committed
10
cache:
11
  key: ${CI_COMMIT_REF_SLUG}
rinpatch's avatar
rinpatch committed
12
13
  paths:
          - deps
Rin Toshaka's avatar
Rin Toshaka committed
14
          - _build
lain's avatar
lain committed
15
stages:
16
  - build
lain's avatar
lain committed
17
  - test
lain's avatar
lain committed
18
  - test-rum
19
  - deploy
lain's avatar
lain committed
20
21

before_script:
lain's avatar
lain committed
22
23
  - mix local.hex --force
  - mix local.rebar --force
lain's avatar
lain committed
24

25
26
build:
  stage: build
lain's avatar
lain committed
27
  script:
rinpatch's avatar
huh    
rinpatch committed
28
  - mix deps.get
29
  - mix compile --force
rinpatch's avatar
rinpatch committed
30

31
docs-build:
32
  stage: build
rinpatch's avatar
rinpatch committed
33
34
35
36
37
  only:
  - master@pleroma/pleroma
  - develop@pleroma/pleroma
  variables:
    MIX_ENV: dev
38
  script:
rinpatch's avatar
rinpatch committed
39
40
41
42
43
44
45
    - mix deps.get
    - mix compile
    - mix docs
  artifacts:
    paths:
      - priv/static/doc

46
47
48
unit-testing:
  stage: test
  services:
lain's avatar
lain committed
49
  - name: lainsoykaf/postgres-with-rum
50
51
    command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
  script:
52
    - mix deps.get
53
54
    - mix ecto.create
    - mix ecto.migrate
55
    - mix test --trace --preload-modules
feld's avatar
feld committed
56
    - mix coveralls
57

lain's avatar
lain committed
58
59
60
61
62
63
64
65
66
67
68
69
70
71
unit-testing-rum:
  stage: test-rum
  services:
  - name: lainsoykaf/postgres-with-rum
    command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
  script:
    - "echo 'config :pleroma, :database, rum_enabled: true' >> config/test.exs"
    - mix deps.get
    - mix ecto.create
    - mix ecto.migrate
    - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
    - mix test --trace --preload-modules
    - mix coveralls

72
73
74
75
76
77
78
79
lint:
  stage: test
  script:
    - mix format --check-formatted

analysis:
  stage: test
  script:
rinpatch's avatar
rinpatch committed
80
    - mix deps.get
81
82
    - mix credo --strict --only=warnings,todo,fixme,consistency,readability

83
docs-deploy:
84
  stage: deploy
rinpatch's avatar
rinpatch committed
85
86
87
88
89
90
91
92
93
94
95
  image: alpine:3.9
  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 -
96
    - rsync -hrvz --delete -e "ssh -p ${SSH_PORT}" priv/static/doc/ "${SSH_USER_HOST_LOCATION}/${CI_COMMIT_REF_NAME}"