This repository was archived by the owner on Jun 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathJenkinsfile
146 lines (128 loc) · 4.7 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
#!groovy
// Copyright (c) 2016-2018 SIL International
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
ansiColor('xterm') {
timestamps {
properties([
// Add buildKind parameter
parameters([
choice(name: 'buildKind', choices: 'Continuous\nRelease\nReleaseCandidate',
description: 'Is this a continuous (pre-release) or a release build? Release builds for Linux are uploaded to llso:main.'),
string(name: 'DistributionsToPackage', defaultValue: 'bionic xenial trusty',
description: 'The distributions to build packages for (separated by space)'),
string(name: 'ArchesToPackage', defaultValue: 'amd64 i386',
description: 'The architectures to build packages for (separated by space)')
]),
pipelineTriggers([[$class: 'GitHubPushTrigger']])
])
// Set default. This is only needed for the first build.
def buildKindVar = params.buildKind ?: 'Continuous'
def supported_distros = 'bionic xenial trusty'
try {
isPR = BRANCH_NAME.startsWith("PR-") ? true : false
} catch(err) {
isPR = false
}
try {
parallel('Windows': {
def PkgVersion
node('windows && supported') {
def msbuild = tool 'msbuild12'
def git = tool(name: 'Default', type: 'git')
stage('Checkout Windows') {
checkout([$class: 'GitSCM', branches: [[name: BRANCH_NAME]],
doGenerateSubmoduleConfigurations: false, extensions:
[[$class: 'CloneOption', depth: 1, noTags: false, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/sillsdev/icu4c']]])
def uvernum = readFile 'source/common/unicode/uvernum.h'
def IcuVersion = (uvernum =~ "#define U_ICU_VERSION_MAJOR_NUM ([0-9]+)")[0][1]
def IcuMinor = (uvernum =~ "#define U_ICU_VERSION_MINOR_NUM ([0-9]+)")[0][1]
def PreRelease = isPR ? "-${BRANCH_NAME}" :
(buildKindVar != 'Release' ? "-beta" : "")
PkgVersion = "${IcuVersion}.${IcuMinor}.${BUILD_NUMBER}${PreRelease}"
currentBuild.displayName = PkgVersion
}
dir("nugetpackage") {
dir("build") {
stage('Build ICU') {
echo "Compiling ICU"
bat """
"${msbuild}" /t:Build
"""
}
stage('Pack nuget') {
echo "Creating nuget package ${PkgVersion}"
bat """
"${msbuild}" /t:BuildPackage /p:PkgVersion=${PkgVersion}
"""
}
}
if (!isPR) {
archiveArtifacts "*.nupkg"
}
currentBuild.result = "SUCCESS"
}
}}, 'Linux': {
def PkgVersion
node('packager') {
stage('Checkout Linux') {
dir('icu-fw')
{
checkout([$class: 'GitSCM', branches: [[name: BRANCH_NAME]],
doGenerateSubmoduleConfigurations: false, extensions:
[[$class: 'CloneOption', depth: 1, noTags: false, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/sillsdev/icu4c']]])
def uvernum = readFile 'source/common/unicode/uvernum.h'
def IcuVersion = (uvernum =~ "#define U_ICU_VERSION_MAJOR_NUM ([0-9]+)")[0][1]
def IcuMinor = (uvernum =~ "#define U_ICU_VERSION_MINOR_NUM ([0-9]+)")[0][1]
String pr
try {
pr = isPR ? (BRANCH_NAME =~ "PR-([0-9]+)")[0][1] : ""
} catch(err) {
pr = ""
}
def Build = isPR ? "~PR${pr}.${BUILD_NUMBER}" :
(buildKindVar != 'Release' ? "~beta${BUILD_NUMBER}" : ".${BUILD_NUMBER}")
PkgVersion = "${IcuVersion}.${IcuMinor}.1${Build}"
}
}
stage('Package') {
echo "Creating package ${PkgVersion}"
sh """#!/bin/bash
export FULL_BUILD_NUMBER=${PkgVersion}
if [ "${buildKindVar}" = "Release" ]; then
MAKE_SOURCE_ARGS="--preserve-changelog"
BUILD_PACKAGE_ARGS="--suite-name main"
elif [ "${buildKindVar}" = "ReleaseCandidate" ]; then
MAKE_SOURCE_ARGS="--preserve-changelog"
BUILD_PACKAGE_ARGS="--no-upload"
fi
if ${isPR}; then
BUILD_PACKAGE_ARGS="--no-upload"
fi
cd "icu-fw"
\$HOME/ci-builder-scripts/bash/make-source --dists "\$DistributionsToPackage" \
--arches "\$ArchesToPackage" \
--main-package-name "icu-fw" \
--supported-distros "${supported_distros}" \
--debkeyid \$DEBSIGNKEY \
--main-repo-dir . \
--package-version "${PkgVersion}" \
\$MAKE_SOURCE_ARGS
\$HOME/ci-builder-scripts/bash/build-package --dists "\$DistributionsToPackage" \
--arches "\$ArchesToPackage" \
--main-package-name "icu-fw" \
--supported-distros "${supported_distros}" \
--debkeyid \$DEBSIGNKEY \
\$BUILD_PACKAGE_ARGS
"""
archiveArtifacts artifacts: 'results/*'
}
}
})
} catch(error) {
echo error
currentBuild.result = "FAILED"
}
}
}