forked from EdgeApp/edge-react-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
148 lines (137 loc) · 3.76 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
pipeline {
agent any
tools {
nodejs "stable"
}
options {
timestamps()
skipDefaultCheckout true
overrideIndexTriggers false
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '10')
disableConcurrentBuilds()
}
triggers {
pollSCM("H/5 * * * *")
}
parameters {
booleanParam(name: 'ANDROID_BUILD', defaultValue: true, description: 'Build an Android version')
booleanParam(name: 'IOS_BUILD', defaultValue: true, description: 'Build an iOS version')
booleanParam(name: 'VERBOSE', defaultValue: false, description: 'Complete build log output')
}
environment {
LC_CTYPE = 'en_US.UTF-8'
DISABLE_XCPRETTY = "${params.VERBOSE}"
}
stages {
stage("Clean the workspace and checkout source") {
steps {
deleteDir()
checkout scm
}
}
stage ("Install dependencies") {
steps {
sh "yarn"
}
}
stage ("Get secret files") {
steps {
// Import the settings files
withCredentials([
file(credentialsId: "githubSshKey", variable: "id_github"),
]) {
sh "cp ${id_github} ./id_github"
}
sh "node -r sucrase/register ./scripts/secretFiles.ts ${BRANCH_NAME} ${SECRET_FILES}"
}
}
stage ("Patch files") {
steps {
sh "node -r sucrase/register ./scripts/patchFiles.ts edge ${BRANCH_NAME}"
}
}
stage ("Get build number and version") {
steps {
// Pick the new build number and version from git:
sh "node -r sucrase/register ./scripts/gitVersionFile.ts ${BRANCH_NAME}"
// Update our description:
script {
def versionFile = readJSON file: "./release-version.json"
currentBuild.description = "version: ${versionFile.version} (${versionFile.build})"
}
}
}
stage ("Pre-build") {
steps {
sh "yarn prepare"
}
}
stage ("Test") {
steps {
sh "JEST_JENKINS=1 yarn cover --ci"
}
}
stage ("Build") {
when {
anyOf {
branch 'develop'
branch 'staging'
branch 'master'
branch 'beta'
branch 'test-cheddar'
branch 'test-feta'
branch 'test-gouda'
branch 'test-halloumi'
branch 'test-paneer'
branch 'test'
branch 'yolo'
}
}
stages {
stage("ios") {
when { equals expected: true, actual: params.IOS_BUILD }
steps {
sh "npm run prepare.ios"
sh "node -r sucrase/register ./scripts/deploy.ts edge ios ${BRANCH_NAME}"
}
}
stage("android") {
when { equals expected: true, actual: params.ANDROID_BUILD }
steps {
sh "node -r sucrase/register ./scripts/deploy.ts edge android ${BRANCH_NAME}"
}
}
}
}
}
post {
always {
echo 'Trying to publish the test report'
junit healthScaleFactor: 100.0, testResults: '**/coverage/junit.xml', allowEmptyResults: true
echo 'Trying to publish the code coverage report'
cobertura(
coberturaReportFile: '**/coverage/cobertura-coverage.xml',
failUnhealthy: false,
failNoReports: false,
failUnstable: false,
onlyStable: false,
zoomCoverageChart: false,
conditionalCoverageTargets: '70, 0, 0',
lineCoverageTargets: '70, 0, 0',
methodCoverageTargets: '70, 0, 0',
maxNumberOfBuilds: 0,
sourceEncoding: 'ASCII'
)
}
success {
echo "The force is strong with this one"
deleteDir()
}
unstable {
echo "Do or do not there is no try"
}
failure {
echo "The dark side I sense in you."
}
}
}