generated from mattermost/mattermost-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 156
316 lines (287 loc) · 9.66 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
name: ci
on:
pull_request:
push:
branches:
- master
defaults:
run:
shell: bash
env:
TERM: xterm
GO_VERSION: 1.22.6
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: "0"
- name: ci/setup-go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: |
webapp/package-lock.json
e2e-tests/package-lock.json
- name: ci/cache-node-modules
id: cache-node-modules
uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
with:
path: |
webapp/node_modules
e2e-tests/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('webapp/package-lock.json') }}-${{ hashFiles('e2e-tests/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-modules-${{ hashFiles('webapp/package-lock.json') }}-${{ hashFiles('e2e-tests/package-lock.json') }}
- name: ci/setup-webapp-npm-deps
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
NODE_ENV: development
run: |
cd webapp
npm install --ignore-scripts --no-save --legacy-peer-deps
- name: ci/setup-e2e-npm-deps
if: steps.cache-node-modules.outputs.cache-hit != 'true'
env:
NODE_ENV: development
run: |
cd e2e-tests
npm install --ignore-scripts --no-save
- name: ci/checking-code-style
run: make check-style
- name: ci/go-tidy
run: go mod tidy -v
- name: ci/check-diff-on-gomod
run: git --no-pager diff --exit-code go.mod go.sum || (echo "Please run \"go mod tidy\" and commit the changes in go.mod and go.sum." && exit 1)
- name: ci/run-make-apply
run: make apply
- name: ci/check-diff-on-generated-manifest-files
run: git --no-pager diff --exit-code *manifest.* || (echo "Please run \"make apply\" and commit the changes in the generated manifests." && exit 1)
- name: ci/run-make-i18n-extract-webapp
run: make i18n-extract-webapp
- name: ci/check-diff-on-webapp-i18n-files
run: git --no-pager diff --exit-code webapp/i18n/en.json || (echo "Please run \"make i18n-extract\" and commit the changes in webapp/i18n/en.json." && exit 1)
- name: ci/run-make-graphql
run: make graphql
- name: ci/check-diff-on-webapp-graphql-generated-files
run: git --no-pager diff --exit-code webapp/src/graphql/generated/ || (echo "Please run \"make graphql\" and commit the changes." && exit 1)
dist:
runs-on: ubuntu-22.04
needs:
- lint
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: "0"
- name: ci/setup-go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: ci/ensure-build-on-all-platforms
run: make dist
test-MySQL57-Postgres11:
runs-on: ubuntu-22.04
needs:
- lint
services:
postgres:
image: postgres:11.13
env:
POSTGRES_USER: mmuser
POSTGRES_DB: mattermost_test
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: mostest
MYSQL_DATABASE: mattermost_test
MYSQL_USER: mmuser
MYSQL_PASSWORD: mostest
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: "0"
- name: ci/test-with-db
uses: ./.github/actions/test-with-db
test-MySQL8-Postgres15:
runs-on: ubuntu-22.04
needs:
- lint
services:
postgres:
image: postgres:15.3
env:
POSTGRES_USER: mmuser
POSTGRES_DB: mattermost_test
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: mostest
MYSQL_DATABASE: mattermost_test
MYSQL_USER: mmuser
MYSQL_PASSWORD: mostest
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: "0"
- name: ci/test-with-db
uses: ./.github/actions/test-with-db
generate-specs:
runs-on: ubuntu-22.04
outputs:
specs: ${{ steps.generate-specs.outputs.specs }}
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/generate-specs
id: generate-specs
uses: ./.github/actions/generate-specs
with:
parallelism: 3
directory: e2e-tests
search_path: tests/integration
e2e-cypress-tests:
runs-on: ubuntu-22.04
name: e2e-cypress-tests-run-${{ matrix.runId }}
needs:
- lint
- generate-specs
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.generate-specs.outputs.specs) }}
services:
postgres:
image: postgres:15.3
env:
POSTGRES_USER: mmuser
POSTGRES_PASSWORD: mostest
POSTGRES_DB: mattermost_test
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
minio:
image: minio/minio:RELEASE.2019-10-11T00-38-09Z
env:
MINIO_ACCESS_KEY: minioaccesskey
MINIO_SECRET_KEY: miniosecretkey
MINIO_SSE_MASTER_KEY: "my-minio-key:6368616e676520746869732070617373776f726420746f206120736563726574"
inbucket:
image: mattermost/inbucket:release-1.2.0
ports:
- 10080:10080
- 10110:10110
- 10025:10025
elasticsearch:
image: mattermost/mattermost-elasticsearch-docker:7.0.0
env:
http.host: "0.0.0.0"
http.port: 9200
http.cors.enabled: "true"
http.cors.allow-origin: "http://localhost:1358,http://127.0.0.1:1358"
http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
http.cors.allow-credentials: "true"
transport.host: "127.0.0.1"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
ports:
- 9200:9200
mattermost-server:
image: mattermost/mattermost-enterprise-edition:master
env:
DB_HOST: postgres
DB_PORT_NUMBER: 5432
MM_DBNAME: mattermost_test
MM_USERNAME: mmuser
MM_PASSWORD: mostest
CI_INBUCKET_HOST: inbucket
CI_INBUCKET_PORT: 10080
CI_MINIO_HOST: minio
IS_CI: true
MM_CLUSTERSETTINGS_READONLYCONFIG: false
MM_EMAILSETTINGS_SMTPSERVER: inbucket
MM_EMAILSETTINGS_SMTPPORT: 10025
MM_ELASTICSEARCHSETTINGS_CONNECTIONURL: http://elasticsearch:9200
MM_EXPERIMENTALSETTINGS_USENEWSAMLLIBRARY: true
MM_SQLSETTINGS_DATASOURCE: "postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10"
MM_SQLSETTINGS_DRIVERNAME: postgres
MM_PLUGINSETTINGS_ENABLEUPLOADS: true
MM_SERVICESETTINGS_SITEURL: http://localhost:8065
MM_PLUGINSETTINGS_AUTOMATICPREPACKAGEDPLUGINS: true
MM_ANNOUNCEMENTSETTINGS_ADMINNOTICESENABLED: false
MM_SERVICESETTINGS_ENABLELEGACYSIDEBAR: true
MM_TEAMSETTINGS_MAXUSERSPERTEAM: 10000
MM_SERVICESETTINGS_ENABLEONBOARDINGFLOW: false
MM_SERVICEENVIRONMENT: test
ports:
- 8065:8065
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: "0"
- name: ci/e2e-test
uses: ./.github/actions/e2e-test
with:
CYPRESS_serverEdition: E20
SPECS: ${{ matrix.specs }}
report-test-results:
if: always()
needs:
- e2e-cypress-tests
- test-MySQL57-Postgres11
- test-MySQL8-Postgres15
runs-on: ubuntu-22.04
permissions:
checks: write
pull-requests: write
steps:
- name: ci/download-test-results
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: ci/publish-results
uses: mikepenz/action-junit-report@c0e4b81aaa0067314a2d0d06e19b512c9d8af4f5 # v3.7.7
with:
report_paths: "**/*.xml"