-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile
123 lines (111 loc) · 4.73 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
#!groovy
/**
* This Jenkinsfile will only work in a Swift Navigation build/CI environment, as it uses
* non-public docker images and pipeline libraries.
*/
// Use 'ci-jenkins@somebranch' to pull shared lib from a different branch than the default.
// Default is configured in Jenkins and should be from "stable" tag.
@Library("ci-jenkins") import com.swiftnav.ci.*
def context = new Context(context: this)
context.setRepo("swift-toolchains")
/**
* - Mount the refrepo to keep git operations functional on a repo that uses ref-repo during clone
**/
String dockerMountArgs = "-v /mnt/efs/refrepo:/mnt/efs/refrepo"
pipeline {
// Override agent in each stage to make sure we don't share containers among stages.
agent any
options {
// Make sure job aborts after 2 hours if hanging.
timeout(time: 4, unit: 'HOURS')
timestamps()
// Keep builds for 7 days.
buildDiscarder(logRotator(daysToKeepStr: '7'))
}
stages {
stage('Build') {
parallel {
stage('llvm x86_64 linux') {
agent {
dockerfile {
filename "Dockerfile.llvm"
}
}
steps {
sh('''
git clone https://github.com/llvm/llvm-project --branch=llvmorg-14.0.6 --single-branch
cd llvm-project
mkdir build
cd build
cmake -GNinja ../llvm \
-DCMAKE_INSTALL_PREFIX=../out/ \
-C ../../llvm/Distribution.cmake
ninja install-distribution
find ../out/
''')
uploadDistribution("clang+llvm-14.0.6-x86_64-linux", context)
}
}
// stage('llvm aarch64 darwin') {
// agent {
// node('macos-arm64')
// }
// steps {
// sh('''
// git clone https://github.com/llvm/llvm-project --branch=llvmorg-14.0.6 --single-branch
// cd llvm-project
// mkdir build
// cd build
// cmake -GNinja ../llvm \
// -DCMAKE_INSTALL_PREFIX=../out/ \
// -DCMAKE_OSX_ARCHITECTURES='arm64' \
// -DCMAKE_C_COMPILER=`which clang` \
// -DCMAKE_CXX_COMPILER=`which clang++` \
// -DCMAKE_BUILD_TYPE=Release \
// -C ../../llvm/Distribution.cmake
// ninja stage2-install-distribution
// ''')
// uploadDistribution("clang+llvm-14.0.6-arm64-apple-darwin", context)
// }
// }
// stage('llvm x86_64 darwin') {
// agent {
// node('macos')
// }
// steps {
// sh('''
// git clone https://github.com/llvm/llvm-project --branch=llvmorg-14.0.6 --single-branch
// cd llvm-project
// mkdir build
// cd build
// cmake -GNinja ../llvm \
// -DCMAKE_INSTALL_PREFIX=../out/ \
// -DCMAKE_OSX_ARCHITECTURES='x86_64' \
// -DLLVM_ENABLE_RUNTIMES='compiler-rt;libcxx;libcxxabi' \
// -DCMAKE_C_COMPILER=`which clang` \
// -DCMAKE_CXX_COMPILER=`which clang++` \
// -DCMAKE_BUILD_TYPE=Release \
// -C ../../llvm/Distribution.cmake
// ninja stage2-install-distribution
// ''')
// uploadDistribution("clang+llvm-14.0.6-x86_64-apple-darwin", context)
// }
// }
}
}
}
}
def uploadDistribution(name, context) {
sh("""
mkdir -p tar/${name}/
cp -rH llvm-project/out/* tar/${name}/
""")
tar(file: "${name}.tar.gz", dir: 'tar', archive: true)
script{
context.archivePatterns(
patterns: ["${name}.tar.gz"],
path: "swift-toolchains/${context.gitDescribe()}/${name}.tar.gz",
jenkins: false
)
}
}