forked from mattermost/mmctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
83 lines (77 loc) · 3.04 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
stages:
- test
- publish
include:
project: mattermost/ci/mmctl
ref: master
file: private.yml
docs:
stage: test
image: $CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20201020_golang-1.14.9
script:
- echo $CI_COMMIT_REF_NAME
- echo "Making sure docs are updated"
- make docs
- if [[ -n $(git status --porcelain) ]]; then echo "Please update the docs using make docs"; exit 1; fi
except:
- tags
lint:
stage: test
image: $CI_REGISTRY/mattermost/ci/images/golangci-lint:v1.25.1-1
script:
- echo "Installing mattermost-govet"
- GO111MODULE=off go get -u github.com/mattermost/mattermost-govet
- make check
except:
- tags
test:
stage: test
image: $CI_REGISTRY/mattermost/ci/images/mattermost-build-docker:19.03.12-1
services:
- name: $CI_REGISTRY/mattermost/ci/images/docker-dind:19.03.12-1
alias: docker
variables:
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
script:
- docker-compose version
- cd ..
- git clone -b $CI_COMMIT_REF_NAME https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_NAMESPACE}/mattermost-server.git || git clone -b master https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_NAMESPACE}/mattermost-server.git
- cd mattermost-server/build
- docker-compose --no-ansi run --rm start_dependencies
- cat ../tests/test-data.ldif | docker-compose --no-ansi exec -T openldap bash -c 'ldapadd -x -D "cn=admin,dc=mm,dc=test,dc=com" -w mostest';
- docker-compose --no-ansi exec -T minio sh -c 'mkdir -p /data/mattermost-test';
- docker-compose --no-ansi ps
- sleep 5
- docker network ls
- docker run --rm --net build_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://mysql:3306; do echo waiting for mysql; sleep 5; done;"
- docker run --rm --net build_mm-test appropriate/curl:latest sh -c "until curl --max-time 5 --output - http://elasticsearch:9200; do echo waiting for elasticsearch; sleep 5; done;"
- ulimit -n 8096
- >
docker run --name server -d --net build_mm-test \
--env-file=dotenv/test.env \
--env MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10" \
--env MM_SQLSETTINGS_DATASOURCE=postgres \
-v /builds/${CI_PROJECT_NAMESPACE}:/mattermost \
-w /mattermost/mmctl \
mattermost/mattermost-build-server:20201020_golang-1.14.9 \
bash -c 'ulimit -n 8096; ls -al; make test-all'
- docker logs -f server
- exit $(docker inspect server --format='{{.State.ExitCode}}')
except:
- tags
build:
stage: test
image: $CI_REGISTRY/mattermost/ci/images/mattermost-build-server:20201020_golang-1.14.9
script:
- make package
artifacts:
paths:
- build
expire_in: 3 hours
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
- if: '$CI_COMMIT_REF_NAME =~ /^v.*\d/' # release
- if: '$CI_COMMIT_REF_NAME =~ /^v.*\D{3,}/' # -rc
- if: '$CI_COMMIT_REF_NAME =~ /^release-/'