forked from thierry-martinez/stdcompat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
110 lines (108 loc) · 3.91 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
properties([
[
$class: 'ThrottleJobProperty',
categories: ['category'],
limitOneJobWithMatchingParams: false,
maxConcurrentPerNode: 4,
maxConcurrentTotal: 0,
paramsToUseForLimit: '',
throttleEnabled: true,
throttleOption: 'category'
],
])
pipeline {
agent none
stages {
stage('Prepare') {
agent {
label 'linux'
}
steps {
sh 'docker build -t stdcompat .'
}
}
stage('Bootstrap') {
agent {
label 'linux'
}
steps {
sh 'docker run --rm --volume $PWD:/workspace stdcompat bash -c \'cd /workspace && make -f Makefile.bootstrap\''
stash name: 'bootstrap'
}
}
stage('Configure') {
agent {
label 'linux'
}
steps {
unstash 'bootstrap'
sh 'docker run --rm --volume $PWD:/workspace stdcompat bash -c \'cd /workspace && mkdir build && cd build && ../configure\''
stash name: 'configure'
}
}
stage('Build') {
agent {
label 'linux'
}
steps {
unstash 'configure'
sh 'docker run --rm --volume $PWD:/workspace stdcompat bash -c \'cd /workspace/build && make\''
}
}
stage('Tests') {
agent {
label 'linux'
}
steps {
script {
def switches = sh (
script: 'docker run --rm stdcompat opam switch -s',
returnStdout: true
).split('\n')
def branches = [:]
for (i in switches) {
def switch_name = i
branches["OCaml " + switch_name + " on Linux"] = {
node('linux') {
sh "rm -rf build"
unstash 'bootstrap'
sh "docker run --rm --volume \$PWD:/workspace stdcompat sh -c 'cd /workspace && unset BASH_ENV && opam config exec --switch $switch_name -- sh -c '\\''mkdir build && cd build && ../configure && make && make test && ../configure --disable-magic && make && make test'\\'"
}
}
}
def versions = ["4.03.0", "4.04.2", "4.05.0", "4.06.1", "4.07.1", "4.08.1", "4.09.1", "4.10.2", "4.11.2", "4.12.1", "4.13.0", "4.14.0"]
for (i in versions) {
def version = i
branches["OCaml " + version + " on Windows"] = {
node('windows') {
checkout scm
bat """
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat"
set PATH=C:\\tools\\cygwin\\bin;%PATH%
bash -c "ci/cygwin-compile-ocaml.sh \\"$version\\""
if not errorlevel 0 exit /b
set PATH=C:\\ocaml\\$version\\bin;%PATH%
set FLEXDIR=C:\\ocaml\\$version\\lib
bash -c "eval \$(~/ocaml-4.09.0/tools/msvs-promote-path) && make -f Makefile.bootstrap && ./configure && make && make test"
"""
}
}
}
throttle(['category']) {
parallel branches
}
}
}
}
stage('Deploy') {
agent {
label 'linux'
}
steps {
unstash 'configure'
sh 'docker run --rm --volume $PWD:/workspace stdcompat bash -c \'cd /workspace/build && make dist\''
archiveArtifacts artifacts: 'build/*.tar.gz', fingerprint: true
}
}
}
}