forked from includeos/microlb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
100 lines (93 loc) · 3.16 KB
/
Jenkinsfile
File metadata and controls
100 lines (93 loc) · 3.16 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
pipeline {
agent { label 'ubuntu-18.04' }
triggers {
upstream(
upstreamProjects: 'hioa-cs-org-test/IncludeOS/dev', threshold: hudson.model.Result.SUCCESS
)
}
environment {
CONAN_USER_HOME = "${env.WORKSPACE}"
PROFILE_x86_64 = 'clang-6.0-linux-x86_64'
PROFILE_x86 = 'clang-6.0-linux-x86'
CPUS = """${sh(returnStdout: true, script: 'nproc')}"""
CC = 'clang-6.0'
CXX = 'clang++-6.0'
PACKAGE = 'microlb'
USER = 'includeos'
CHAN = 'test'
REMOTE = "${env.CONAN_REMOTE}"
BINTRAY_CREDS = credentials('devops-includeos-user-pass-bintray')
}
stages {
stage('Setup') {
steps {
sh script: "conan config install https://github.com/includeos/conan_config.git", label: "conan config install"
}
}
stage('Pull Request pipeline') {
when { changeRequest() }
stages {
/* TODO add unittests
stage('Unit tests') {
steps {
//cmake cache is bad
sh script: "mkdir -p unittests && rm -rf unittests/*", label: "Setup"
sh script: "cd unittests; cmake ../unit", label: "cmake configure"
sh script: "cd unittests; make -j $CPUS", label: "build tests"
sh script: "cd unittests; ctest --output-on-failure", label: "run unit tests"
}
}*/
stage('Build package') {
steps {
build_conan_package("$PROFILE_x86_64")
}
}
stage('build example') {
steps {
sh script: "mkdir -p build_example", label: "Setup"
sh script: "cd build_example; conan install ../examples/microLB -pr $PROFILE_x86_64", label: "conan_install"
sh script: "cd build_example; cmake ../examples/microLB",label: "cmake configure"
sh script: "cd build_example; make -j $CPUS", label: "building example"
//sh script: "cd build_example; source activate.sh; cmake ../unit/integration/simple", label: "cmake configure"
//sh script: "cd build_example; source activate.sh; make", label: "build"
}
}
}
}
stage('Deploy package pipeline') {
when {
anyOf {
branch 'master'
}
}
stages {
stage('Build Conan package') {
steps {
//TODO foreach profile ?
build_conan_package("$PROFILE_x86_64")
}
}
stage('Upload to bintray') {
steps {
sh script: """
conan user -p $BINTRAY_CREDS_PSW -r $REMOTE $BINTRAY_CREDS_USR
VERSION=\$(conan inspect -a version . | cut -d " " -f 2)
conan upload --all -r $REMOTE $PACKAGE/\$VERSION@$USER/$CHAN
""", label: "Upload to bintray"
}
}
}
}
}
post {
cleanup {
sh script: """
VERSION=\$(conan inspect -a version . | cut -d " " -f 2)
conan remove $PACKAGE/\$VERSION@$USER/$CHAN -f || echo 'Could not remove. This does not fail the pipeline'
""", label: "Cleaning up and removing conan package"
}
}
}
def build_conan_package(String profile) {
sh script: "conan create . $USER/$CHAN -pr ${profile}", label: "Build with profile: $profile"
}