forked from sequelize/sequelize
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
112 lines (107 loc) · 4.05 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
stages:
- setup_builder_tool
- build
variables:
NPM_CONFIG_REGISTRY: https://${NPM_REGISTRY_OSLO_URL}/
NPM_CONFIG_EMAIL: ymoyart@oslo.fr
NPM_TOKEN: ${NPM_REGISTRY_OSLO_TOKEN}
KNT_ORIGINAL_PROJECT_PATH: "konnect/sequelize"
KNT_BUILDER_TOOLS : "@konnect/builder-tools@^1.0.0"
KNT_PATH_BUILDER_TOOLS: ".dglobal/lib/node_modules/@konnect/builder-tools"
GIT_CLEAN_FLAGS: -ffdx -e /.dglobal/** -e /node_modules/**
setup_builder_tool:
stage: setup_builder_tool
variables:
GIT_STRATEGY : none
GIT_CHECKOUT : 'false'
image:
name: node:16
tags: ["kubernetes-runner"]
script:
- |
if [[ -d $KNT_PATH_BUILDER_TOOLS ]]; then
echo "Builder tools already installed"
exit 10
fi
- npm config set //${NPM_REGISTRY_OSLO_URL}/:_authToken $NPM_TOKEN
- npm install --prefix $CI_PROJECT_DIR/.dglobal/ $KNT_BUILDER_TOOLS -g
allow_failure:
exit_codes: 10
cache:
key: "CACHE-BUILDER-TOOLS"
policy: push
paths:
- $KNT_PATH_BUILDER_TOOLS
build_branch:
stage: build
image:
name: node:16
tags: ["kubernetes-runner"]
before_script:
- npm config set //${NPM_REGISTRY_OSLO_URL}/:_authToken $NPM_TOKEN
- npm install npm@^6 --location=global
- export KNT_PACKAGE_NAME=$(node $KNT_PATH_BUILDER_TOOLS/tasks/common/get-project-name)
- apt-get update && apt-get install -y libaio1 wget unzip
- mkdir -p /opt/oracle
- (cd /opt/oracle && wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip && unzip instantclient-basic-linuxx64.zip && rm -f instantclient-basic-linuxx64.zip)
- export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_9:$LD_LIBRARY_PATH
- npm install
script:
# Et on lance les tests
- npm run test-all
# Mise en place des versions dans le package.json
- (node $KNT_PATH_BUILDER_TOOLS/tasks/common/prepare-build-client.js) || exit 1;
# Push to NPM sequelize
- $KNT_PATH_BUILDER_TOOLS/tasks/linux/common/push-to-gogit.sh no_git $CI_COMMIT_REF_NAME $KNT_ORIGINAL_PROJECT_PATH $KNT_PACKAGE_NAME
# Push to NPM @konnect/sequelize
- node $KNT_PATH_BUILDER_TOOLS/tasks/common/set-project-name --name @konnect/sequelize
- $KNT_PATH_BUILDER_TOOLS/tasks/linux/common/push-to-gogit.sh no_git $CI_COMMIT_REF_NAME $KNT_ORIGINAL_PROJECT_PATH @konnect/sequelize
cache:
#Mise en cache des nodes_modules
- key: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG"
paths:
- node_modules/
#Recupère le BT en cache
- key: "CACHE-BUILDER-TOOLS"
policy: pull
paths:
- $KNT_PATH_BUILDER_TOOLS
only:
- master
- develop
build_tag:
stage: build
image:
name: node:16
tags: ["kubernetes-runner"]
before_script:
- npm config set //${NPM_REGISTRY_OSLO_URL}/:_authToken $NPM_TOKEN
- npm install npm@^6 --location=global
- export KNT_PACKAGE_NAME=$(node $KNT_PATH_BUILDER_TOOLS/tasks/common/get-project-name)
- apt-get update && apt-get install -y libaio1 wget unzip
- mkdir -p /opt/oracle
- (cd /opt/oracle && wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip && unzip instantclient-basic-linuxx64.zip && rm -f instantclient-basic-linuxx64.zip)
- export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_9:$LD_LIBRARY_PATH
- npm install
script:
# Et on lance les tests
- npm run test-all
# Mise en place des versions dans le package.json
- (node $KNT_PATH_BUILDER_TOOLS/tasks/common/prepare-build-client.js) || exit 1;
# Push to NPM sequelize
- $KNT_PATH_BUILDER_TOOLS/tasks/linux/common/push-to-gogit.sh no_git tag $KNT_ORIGINAL_PROJECT_PATH $KNT_PACKAGE_NAME
# Push to NPM @konnect/sequelize
- node $KNT_PATH_BUILDER_TOOLS/tasks/common/set-project-name --name @konnect/sequelize
- $KNT_PATH_BUILDER_TOOLS/tasks/linux/common/push-to-gogit.sh no_git tag $KNT_ORIGINAL_PROJECT_PATH @konnect/sequelize
cache:
#Mise en cache des nodes_modules
- key: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG"
paths:
- node_modules/
#Recupère le BT en cache
- key: "CACHE-BUILDER-TOOLS"
policy: pull
paths:
- $KNT_PATH_BUILDER_TOOLS
only:
- tags