forked from Zilliqa/zq1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
102 lines (100 loc) · 4.15 KB
/
Copy pathJenkinsfile
File metadata and controls
102 lines (100 loc) · 4.15 KB
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
def podDefinition = """
apiVersion: "v1"
kind: "Pod"
spec:
nodeSelector:
beta.kubernetes.io/os: "linux"
containers:
- name: "scilla"
image: "zilliqa/scilla:a254436b"
imagePullPolicy: Always
command:
- cat
tty: true
- name: "ubuntu"
image: "zilliqa/zilliqa-ccache:v0.0.0"
imagePullPolicy: Always
command:
- cat
tty: true
resources:
requests:
ephemeral-storage: "40Gi"
limits:
ephemeral-storage: "40Gi"
"""
String skipciMessage = 'Aborting because commit message contains [skip ci]'
timestamps {
ansiColor('gnome-terminal') {
podTemplate(yaml: podDefinition) {
timeout(time: 120, unit: 'MINUTES') {
node(POD_LABEL) {
try {
stage('Checkout scm') {
checkout scm
def pr_skipci = "0"
try {
if (env.CHANGE_TITLE != null && env.CHANGE_TITLE != "") {
pr_skipci = sh(script: "echo '${env.CHANGE_TITLE.replace("(","").replace(")","").replace("'","")}' | fgrep -ie '[skip ci]' -e '[ci skip]' | wc -l", returnStdout: true).trim()
}
} catch (err) {
println err.getMessage()
error("Error reading the Pull Request title, please check and eventually remove special characters")
}
def skipci = sh(script: "git log -1 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' | wc -l", returnStdout: true).trim()
if (skipci != "0" || pr_skipci != "0") {
error(skipciMessage)
}
}
stage('Import Scilla') {
container('scilla') {
sh "mkdir ./moving_folder"
sh "cp -r /scilla ./moving_folder/scilla"
}
container('ubuntu') {
sh "cp -r ./moving_folder/scilla /scilla"
sh "rm -rf ./moving_folder"
sh "ls -la /scilla/0"
sh "apt update -y && apt install -y patchelf chrpath"
sh "chmod u+w /scilla/0/_build/install/default/bin/*"
sh "patchelf --set-rpath \"\$(pwd)/build/vcpkg_installed/x64-linux-dynamic/lib\" /scilla/0/_build/install/default/bin/*"
sh "ldd /scilla/0/_build/install/default/bin/*"
}
}
container('ubuntu') {
env.VCPKG_ROOT="/vcpkg"
stage('Build') {
sh "apt update -y && apt install -y libsecp256k1-dev"
sh "update-alternatives --install /usr/bin/python python \$(which python3) 1"
sh "git config --global --add safe.directory '*'"
// Hack: since Jenkins checks out the branch to a different directory each time and given
// that ccache is very sensitive to code coverage & debug info, we checkout out
// to the same directoy as the ccache compilation and build there to benefit from the cache.
sh "git clone file://\"\$(pwd)\" /root/zilliqa"
sh "git -C /root/zilliqa checkout \$(git rev-parse HEAD)"
sh "ln -s /root/zilliqa/build build"
sh "ldd /scilla/0/_build/install/default/bin/*"
sh "cd /root/zilliqa && VCPKG_ROOT=${env.VCPKG_ROOT} CCACHE_BASEDIR=\"\$(pwd)\" ./scripts/ci_build.sh"
}
stage('Integration test') {
sh "scripts/integration_test.sh --setup-env"
}
stage('Integration test JS') {
sh "scripts/integration_test_js.sh --setup-env"
}
stage('Report coverage') {
// Code coverage is currently only implemented for GCC builds, so OSX is currently excluded from reporting
sh "cd /root/zilliqa && scripts/ci_report_coverage.sh"
}
}
} catch (err) {
if (err.getMessage() == skipciMessage)
currentBuild.result = 'SUCCESS'
else
throw err
}
}
}
}
}
}