forked from reimagined/resolve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
165 lines (152 loc) · 5.74 KB
/
Jenkinsfile
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
pipeline {
agent {
docker {
image 'reimagined/resolve-ci'
args '-u root:root'
}
}
stages {
stage('Unit tests') {
steps {
script {
sh 'npm install'
sh 'if [ "$(node_modules/.bin/prettier-eslint "./**/src/**/*.js" "./**/test/**/*.js" --list-different --ignore=./**/node_modules/**)" ]; then exit 1; fi'
sh 'npm run bootstrap'
sh 'npm run lint'
sh 'npm test'
}
}
}
stage('Publish canary') {
steps {
script {
env.CI_TIMESTAMP = (new Date()).format("MMddHHmmss", TimeZone.getTimeZone('UTC'))
if (env.BRANCH_NAME =~ '^v([0-9]+).([0-9]+).([0-9]+)$') {
env.CI_RELEASE_TYPE = 'beta'
} else {
env.CI_RELEASE_TYPE = 'alpha'
}
sh """
eval \$(next-lerna-version); \
export CI_CANARY_VERSION=\$NEXT_LERNA_VERSION-${env.CI_TIMESTAMP}.${env.CI_RELEASE_TYPE}; \
echo \$CI_CANARY_VERSION > /lerna_version; \
echo //${env.NPM_ADDR}/:_authToken=${env.NPM_TOKEN} >> /root/.npmrc; \
./node_modules/.bin/lerna publish --skip-git --force-publish=* --yes --repo-version \$(cat /lerna_version); \
sleep 10
"""
}
}
}
stage('Examples [ todo ] Functional Tests') {
steps {
script {
sh """
/init.sh
cd examples/todo
npm install
npm run update \$(cat /lerna_version)
cat ./package.json
npm run test:functional -- --browser=path:/chromium
"""
}
}
}
stage('Examples [ todo-two-levels ] Functional Tests') {
steps {
script {
sh """
/init.sh
cd examples/todo-two-levels
npm install
npm run update \$(cat /lerna_version)
cat ./package.json
npm run test:functional -- --browser=path:/chromium
"""
}
}
}
stage('Create-resolve-app [ empty ] Functional Tests') {
steps {
script {
sh """
/init.sh
npm install -g create-resolve-app@\$(cat /lerna_version)
create-resolve-app empty
cd ./empty
npm run flow
npm run test
npm run test:functional -- --browser=path:/chromium
"""
}
}
}
stage('Create-resolve-app [ todolist ] Functional Tests') {
steps {
script {
sh """
/init.sh
create-resolve-app --sample todolist
cd ./todolist
npm run flow
npm run test
npm run test:functional -- --browser=path:/chromium
"""
}
}
}
stage('Resolve/HackerNews Functional Tests') {
steps {
script {
sh """
/init.sh
git clone https://github.com/reimagined/hacker-news-resolve.git
cd hacker-news-resolve
npm install
./node_modules/.bin/resolve-scripts update \$(cat /lerna_version)
npm run build
testcafe path:/chromium ./tests/functional --app "IS_TEST=true npm run start"
"""
}
}
}
stage('Resolve/Apps Functional Tests (only PR release/x.y.z => master)') {
steps {
script {
if(env.BRANCH_NAME.contains('release')) {
withCredentials([
string(credentialsId: 'DEPENDENT_JOBS_LIST', variable: 'JOBS')
]) {
def jobs = env.JOBS.split(';')
for (def i = 0; i < jobs.length; ++i) {
build([
job: jobs[i],
parameters: [[
$class: 'StringParameterValue',
name: 'NPM_CANARY_VERSION',
value: env.CI_TIMESTAMP
],[
$class: 'BooleanParameterValue',
name: 'RESOLVE_CHECK',
value: true
]]
])
}
}
}
}
}
}
}
post {
always {
script {
sh 'rm -rf ./*'
}
deleteDir()
}
}
}
// LINKS:
// https://github.com/DevExpress/XAF2/tree/devops/node-testcafe
// https://hub.docker.com/r/reimagined/node-testcafe/
// https://github.com/DevExpress/XAF2/tree/devops/next-lerna-version