Strip status data from Flag (when federating or closing/resolving report)
[akkoma] / .gitlab-ci.yml
1 image: elixir:1.8.1
2
3 variables:
4 POSTGRES_DB: pleroma_test
5 POSTGRES_USER: postgres
6 POSTGRES_PASSWORD: postgres
7 DB_HOST: postgres
8 MIX_ENV: test
9
10 cache:
11 key: ${CI_COMMIT_REF_SLUG}
12 paths:
13 - deps
14 - _build
15 stages:
16 - build
17 - test
18 - deploy
19 - release
20
21 before_script:
22 - mix local.hex --force
23 - mix local.rebar --force
24
25 build:
26 stage: build
27 script:
28 - mix deps.get
29 - mix compile --force
30
31 unit-testing:
32 stage: test
33 services:
34 - name: lainsoykaf/postgres-with-rum
35 alias: postgres
36 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
37 script:
38 - mix deps.get
39 - mix ecto.create
40 - mix ecto.migrate
41 - mix coveralls --trace --preload-modules
42
43 unit-testing-rum:
44 stage: test
45 services:
46 - name: lainsoykaf/postgres-with-rum
47 alias: postgres
48 command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
49 variables:
50 RUM_ENABLED: "true"
51 script:
52 - mix deps.get
53 - mix ecto.create
54 - mix ecto.migrate
55 - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
56 - mix test --trace --preload-modules
57
58 lint:
59 stage: test
60 script:
61 - mix format --check-formatted
62
63 analysis:
64 stage: test
65 script:
66 - mix deps.get
67 - mix credo --strict --only=warnings,todo,fixme,consistency,readability
68
69 docs-deploy:
70 stage: deploy
71 image: alpine:latest
72 only:
73 - stable@pleroma/pleroma
74 - develop@pleroma/pleroma
75 before_script:
76 - apk add curl
77 script:
78 - curl -X POST -F"token=$DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/673/trigger/pipeline
79 review_app:
80 image: alpine:3.9
81 stage: deploy
82 before_script:
83 - apk update && apk add openssh-client git
84 when: manual
85 environment:
86 name: review/$CI_COMMIT_REF_NAME
87 url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
88 on_stop: stop_review_app
89 only:
90 - branches
91 except:
92 - master
93 - develop
94 script:
95 - echo "$CI_ENVIRONMENT_SLUG"
96 - mkdir -p ~/.ssh
97 - eval $(ssh-agent -s)
98 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
99 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
100 - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
101 - ssh -t dokku@pleroma.online -- config:set "$CI_ENVIRONMENT_SLUG" APP_NAME="$CI_ENVIRONMENT_SLUG" APP_HOST="$CI_ENVIRONMENT_SLUG.pleroma.online" MIX_ENV=dokku
102 - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
103 - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
104 - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
105 - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master
106
107 stop_review_app:
108 image: alpine:3.9
109 stage: deploy
110 before_script:
111 - apk update && apk add openssh-client git
112 when: manual
113 environment:
114 name: review/$CI_COMMIT_REF_NAME
115 action: stop
116 script:
117 - echo "$CI_ENVIRONMENT_SLUG"
118 - mkdir -p ~/.ssh
119 - eval $(ssh-agent -s)
120 - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
121 - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
122 - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
123 - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
124
125 amd64:
126 stage: release
127 # TODO: Replace with upstream image when 1.9.0 comes out
128 image: rinpatch/elixir:1.9.0-rc.0
129 only: &release-only
130 - stable@pleroma/pleroma
131 - develop@pleroma/pleroma
132 - /^maint/.*$/@pleroma/pleroma
133 - /^release/.*$/@pleroma/pleroma
134 artifacts: &release-artifacts
135 name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
136 paths:
137 - release/*
138 # Ideally it would be never for master branch and with the next commit for develop,
139 # but Gitlab does not support neither `only` for artifacts
140 # nor setting it to never from .gitlab-ci.yml
141 # nor expiring with the next commit
142 expire_in: 42 yrs
143
144 cache: &release-cache
145 key: $CI_COMMIT_REF_NAME-$CI_JOB_NAME
146 paths:
147 - deps
148 variables: &release-variables
149 MIX_ENV: prod
150 before_script: &before-release
151 - echo "import Mix.Config" > config/prod.secret.exs
152 - mix local.hex --force
153 - mix local.rebar --force
154 script: &release
155 - mix deps.get --only prod
156 - mkdir release
157 - export PLEROMA_BUILD_BRANCH=$CI_COMMIT_REF_NAME
158 - mix release --path release
159
160
161 amd64-musl:
162 stage: release
163 artifacts: *release-artifacts
164 only: *release-only
165 # TODO: Replace with upstream image when 1.9.0 comes out
166 image: rinpatch/elixir:1.9.0-rc.0-alpine
167 cache: *release-cache
168 variables: *release-variables
169 before_script: &before-release-musl
170 - apk add git gcc g++ musl-dev make
171 - echo "import Mix.Config" > config/prod.secret.exs
172 - mix local.hex --force
173 - mix local.rebar --force
174 script: *release
175
176 arm:
177 stage: release
178 artifacts: *release-artifacts
179 only: *release-only
180 tags:
181 - arm32
182 # TODO: Replace with upstream image when 1.9.0 comes out
183 image: rinpatch/elixir:1.9.0-rc.0-arm
184 cache: *release-cache
185 variables: *release-variables
186 before_script: *before-release
187 script: *release
188
189 arm-musl:
190 stage: release
191 artifacts: *release-artifacts
192 only: *release-only
193 tags:
194 - arm32
195 # TODO: Replace with upstream image when 1.9.0 comes out
196 image: rinpatch/elixir:1.9.0-rc.0-arm-alpine
197 cache: *release-cache
198 variables: *release-variables
199 before_script: *before-release-musl
200 script: *release
201
202 arm64:
203 stage: release
204 artifacts: *release-artifacts
205 only: *release-only
206 tags:
207 - arm
208 # TODO: Replace with upstream image when 1.9.0 comes out
209 image: rinpatch/elixir:1.9.0-rc.0-arm64
210 cache: *release-cache
211 variables: *release-variables
212 before_script: *before-release
213 script: *release
214
215 arm64-musl:
216 stage: release
217 artifacts: *release-artifacts
218 only: *release-only
219 tags:
220 - arm
221 # TODO: Replace with upstream image when 1.9.0 comes out
222 image: rinpatch/elixir:1.9.0-rc.0-arm64-alpine
223 cache: *release-cache
224 variables: *release-variables
225 before_script: *before-release-musl
226 script: *release