forked from mattermost/mattermost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
126 lines (122 loc) · 5.62 KB
/
.gitlab-ci.yml
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
stages:
# - test
- build
- publish
- create-vars
- trigger-build-ee
include:
- project: mattermost/ci/mattermost-server
ref: master
file: private.yml
# - local: .gitlab-ci/test.yml
# - local: .gitlab-ci/test-schema.yml
variables:
BUILD: "yes"
TEST: "no"
empty:
stage: create-vars
script:
- echo "empty"
#lint:
# image: $CI_REGISTRY/mattermost/ci/images/golangci-lint:v1.38.0
# stage: .pre
# script:
# - GO111MODULE=off GOBIN=$PWD/bin go get -u github.com/mattermost/mattermost-govet
# - make config-reset
# - make check-style #todo MM_VET_OPENSPEC_PATH='$CI_PROJECT_DIR/mattermost-api-reference/v4/html/static/mattermost-openapi-v4.yaml'
# timeout: 60 mins
# rules:
# - if: '$TEST == "yes"'
#
#layers:
# image: $CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20201119_golang-1.15.5
# stage: .pre
# script:
# - make store-layers
# - if [[ -n $(git status --porcelain) ]]; then echo "Please update the store layers using make store-layers"; exit 1; fi
# - git reset --hard
# - make app-layers
# - if [[ -n $(git status --porcelain) ]]; then echo "Please update the app layers using make app-layers"; exit 1; fi
# - git reset --hard
# rules:
# - if: '$TEST == "yes"'
#
#test-postgres:
# extends: .test
# tags:
# - docker
# variables:
# MM_SQLSETTINGS_DATASOURCE: "postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10"
# MM_SQLSETTINGS_DRIVERNAME: postgres
# rules:
# - if: '$TEST == "yes"'
#
#test-mysql:
# extends: .test
# tags:
# - docker
# variables:
# MM_SQLSETTINGS_DATASOURCE: "mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4,utf8&multiStatements=true"
# MM_SQLSETTINGS_DRIVERNAME: mysql
# rules:
# - if: '$TEST == "yes"'
#
#test-schema-postgres:
# extends: .test-schema
# tags:
# - docker
# script:
# - echo "Creating databases"
# - docker-compose --no-ansi exec -T postgres sh -c 'exec echo "CREATE DATABASE migrated; CREATE DATABASE latest;" | exec psql -U mmuser mattermost_test'
# - echo "Importing postgres dump from version 5.0"
# - docker-compose --no-ansi exec -T postgres psql -U mmuser -d migrated < ../scripts/mattermost-postgresql-5.0.sql
# - >
# docker run -d -it --name server-postgres --net build_mm-test \
# --env-file="dotenv/test-schema-validation.env" \
# --env MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mostest@postgres:5432/migrated?sslmode=disable&connect_timeout=10" \
# --env MM_SQLSETTINGS_DRIVERNAME=postgres \
# -v $CI_PROJECT_DIR:/mattermost-server \
# -w /mattermost-server \
# mattermost/mattermost-build-server:20201119_golang-1.15.5 \
# bash -c "ulimit -n 8096; make ARGS='version' run-cli && make MM_SQLSETTINGS_DATASOURCE='postgres://mmuser:mostest@postgres:5432/latest?sslmode=disable&connect_timeout=10' ARGS='version' run-cli"
# - docker logs -f server-postgres
# - echo "Generating dump"
# - docker-compose --no-ansi exec -T postgres pg_dump --schema-only -d migrated -U mmuser > migrated.sql
# - docker-compose --no-ansi exec -T postgres pg_dump --schema-only -d latest -U mmuser > latest.sql
# - echo "Removing databases created for db comparison"
# - docker-compose --no-ansi exec -T postgres sh -c 'exec echo "DROP DATABASE migrated; DROP DATABASE latest;" | exec psql -U mmuser mattermost_test'
# - echo "Generating diff"
# - diff migrated.sql latest.sql > diff.txt && echo "Both schemas are same" || (echo "Schema mismatch" && cat diff.txt && exit 1)
# rules:
# - if: '$TEST == "yes"'
#
#test-schema-mysql:
# extends: .test-schema
# tags:
# - docker
# script:
# - echo "Creating databases"
# - docker-compose --no-ansi exec -T mysql mysql -uroot -pmostest -e "CREATE DATABASE migrated; CREATE DATABASE latest; GRANT ALL PRIVILEGES ON migrated.* TO mmuser; GRANT ALL PRIVILEGES ON latest.* TO mmuser"
# - echo "Importing mysql dump from version 5.0"
# - docker-compose --no-ansi exec -T mysql mysql -D migrated -uroot -pmostest < ../scripts/mattermost-mysql-5.0.sql
# - >
# docker run -d -it --name server-mysql --net build_mm-test \
# --env-file="dotenv/test-schema-validation.env" \
# --env MM_SQLSETTINGS_DATASOURCE="mmuser:mostest@tcp(mysql:3306)/migrated?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" \
# --env MM_SQLSETTINGS_DRIVERNAME=mysql \
# -v $CI_PROJECT_DIR:/mattermost-server \
# -w /mattermost-server \
# mattermost/mattermost-build-server:20201119_golang-1.15.5 \
# bash -c "ulimit -n 8096; make ARGS='version' run-cli && make MM_SQLSETTINGS_DATASOURCE='mmuser:mostest@tcp(mysql:3306)/latest?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s' ARGS='version' run-cli"
# - docker logs -f server-mysql
# - echo "Ignoring known MySQL mismatch 'ChannelMembers.SchemeGuest'"
# - docker-compose --no-ansi exec -T mysql mysql -D migrated -uroot -pmostest -e "ALTER TABLE ChannelMembers DROP COLUMN SchemeGuest;" || echo "drop failed"
# - docker-compose --no-ansi exec -T mysql mysql -D latest -uroot -pmostest -e "ALTER TABLE ChannelMembers DROP COLUMN SchemeGuest;" || echo "drop failed"
# - echo "Generating dump"
# - docker-compose --no-ansi exec -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest migrated > migrated.sql
# - docker-compose --no-ansi exec -T mysql mysqldump --skip-opt --no-data --compact -u root -pmostest latest > latest.sql
# - echo "Removing databases created for db comparison"
# - docker-compose --no-ansi exec -T mysql mysql -uroot -pmostest -e 'DROP DATABASE migrated; DROP DATABASE latest'
# - echo "Generating diff"
# rules:
# - if: '$TEST == "yes"'