Merge branch 'sayonara-gitlab-wiki' into 'develop'
[akkoma] / .gitlab-ci.yml
1 image: elixir:1.8.1
2
3 services:
4 - name: postgres:9.6.2
5 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
6
7 variables:
8 POSTGRES_DB: pleroma_test
9 POSTGRES_USER: postgres
10 POSTGRES_PASSWORD: postgres
11 DB_HOST: postgres
12 MIX_ENV: test
13
14 cache:
15 key: ${CI_COMMIT_REF_SLUG}
16 paths:
17 - deps
18 - _build
19 stages:
20 - lint
21 - test
22 - analysis
23 - docs_build
24 - docs_deploy
25
26 before_script:
27 - mix local.hex --force
28 - mix local.rebar --force
29 - mix deps.get
30 - mix compile --force
31 - mix ecto.create
32 - mix ecto.migrate
33
34 lint:
35 stage: lint
36 script:
37 - mix format --check-formatted
38
39 unit-testing:
40 stage: test
41 script:
42 - mix test --trace --preload-modules
43
44 analysis:
45 stage: analysis
46 script:
47 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
48
49 docs_build:
50 stage: docs_build
51 services:
52 only:
53 - master@pleroma/pleroma
54 - develop@pleroma/pleroma
55 variables:
56 MIX_ENV: dev
57 before_script:
58 - mix local.hex --force
59 - mix local.rebar --force
60 - mix deps.get
61 - mix compile
62 script:
63 - mix docs
64 artifacts:
65 paths:
66 - priv/static/doc
67
68 docs_deploy:
69 stage: docs_deploy
70 image: alpine:3.9
71 services:
72 only:
73 - master@pleroma/pleroma
74 - develop@pleroma/pleroma
75 before_script:
76 - apk update && apk add openssh-client rsync
77 script:
78 - mkdir -p ~/.ssh
79 - echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
80 - eval $(ssh-agent -s)
81 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
82 - rsync -hrvz --delete -e "ssh -p ${SSH_PORT}" priv/static/doc/ "${SSH_USER_HOST_LOCATION}/${CI_COMMIT_REF_NAME}"