forked from linagora/ToM-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
93 lines (86 loc) · 3.1 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
image: node:lts-slim
stages:
- build
- test
- deploy
- push_docker
default:
before_script:
- npm ci --include=dev
variables:
DOCS_FOLDER: "documentation"
SPEC_TO_DISPLAY: "openapi.json"
DISABLE_TRY_IT_OUT_JS_METHOD: "const DisableTryItOutPlugin = function() {return {statePlugins:{spec:{wrapSelectors:{allowTryItOutFor:() => () => false}}}}}"
DISABLE_TRY_IT_OUT_PLUGIN: ", DisableTryItOutPlugin"
npm:
tags:
- docker
stage: build
script:
- npm run build
artifacts:
expire_in: 1 days
when: on_success
paths:
- packages/*/dist/
test:
tags:
- docker
stage: test
image: mcr.microsoft.com/playwright:v1.40.0-focal
variables:
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
services:
- docker:dind
dependencies:
- npm
script:
- cp /etc/hosts ~/hosts.new
- sed -i "s#\tdocker#\tdocker auth.example.com matrix.example.com matrix1.example.com matrix2.example.com matrix3.example.com federation.example.com#g" ~/hosts.new
- cp -f ~/hosts.new /etc/hosts
- apt-get update && apt-get --assume-yes install ca-certificates curl gnupg coreutils
- install -m 0755 -d /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- . /etc/os-release && echo "$VERSION_CODENAME"
- chmod a+r /etc/apt/keyrings/docker.gpg
- echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" > /etc/apt/sources.list.d/docker.list
- apt-get update && apt-get --assume-yes install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- npm test
invite_build:
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: ['']
tags:
- docker
stage: push_docker
before_script: []
only:
changes:
- 'packages/matrix-invite/**/*'
refs:
- master@publicgroup/oss/twake/tom-server
script:
- echo "{\"auths\":{\"${DOCKERHUB_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${DOCKERHUB_USER}" "${DOCKERHUB_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context "${CI_PROJECT_DIR}/packages/matrix-invite/"
--dockerfile "${CI_PROJECT_DIR}/packages/matrix-invite/Dockerfile"
--destination "docker.io/twaketech/twake-matrix-invite:latest"
pages:
tags:
- docker
stage: deploy
rules:
- if: '$CI_PROJECT_PATH == "publicgroup/oss/twake/tom-server" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
script:
- npm run doc
- mkdir public
- cp -rp node_modules/swagger-ui-dist/* public
- cp -rp $DOCS_FOLDER/* public
- sed -i "/window\.onload\s=\sfunction()\s{/a $DISABLE_TRY_IT_OUT_JS_METHOD" public/swagger-initializer.js
- sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" public/swagger-initializer.js
- sed -i "/SwaggerUIBundle\.plugins\.DownloadUrl/a $DISABLE_TRY_IT_OUT_PLUGIN" public/swagger-initializer.js
artifacts:
paths:
- public