This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
156 lines (148 loc) · 5.04 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
147
148
149
150
151
152
153
154
155
156
// vim:set ft=groovy:
parameters {
string("JULIA_VERSION", defaultValue: "master")
string("GAP_VERSION", defaultValue: "master")
choice("BUILDTYPE", choices: [ "develop", "master", "release" ],
defaultValue: "master")
string("BUILDJOBS", defaultValue: "8")
choice("REBUILDMODE", choices: [ "normal", "full", "none" ],
defaultValue: "normal")
choice("NODE_LABEL", choices: [ "main", "macos" ])
choice("DOCKERIZE", choices: [ "yes", "no" ])
}
def get(Map args) {
url = args.url
dir = args.dir ?: args.url.split("/")[-1]
if (args.scm == "hg") {
rev = args.branch ?: "default"
checkout([$class: "MercurialSCM",
source: url,
revision: rev,
subdir: dir])
} else if (args.scm == "git" || args.scm == null) {
rev = args.branch ?: "master"
if (rev.startsWith("tag:"))
rev = "refs/tags/" + rev["tag:".length()..-1]
checkout([$class: "GitSCM",
userRemoteConfigs: [[url: url]],
branches: [[name: rev]],
extensions: [[$class: "RelativeTargetDirectory",
relativeTargetDir: dir]] ])
}
}
date = new Date().format("yyyy-MM-dd")
timestampFile = ".timestamp"
def rebuildMode() {
rebuild = "${params.REBUILDMODE}"
// Do a full rebuild every day after midnight
try {
olddate = readFile(file: timestampFile)
if (olddate != date)
rebuild = "full"
} catch (all) {
rebuild = "full"
}
return rebuild
}
def updateTimestamp() {
writeFile(file: timestampFile, text: date)
}
nodeLabel = params.NODE_LABEL ?: "main"
node(label: nodeLabel) {
def workspace = pwd()
def jenkins_home = env.JENKINS_HOME
// Docker image to use as build/test environment
def buildenv = env.OSCAR_CI_IMAGE ?: env.OSCAR_CI_NAME ?: "oscar-ci"
def run_in_testenv = { block ->
if (nodeLabel in [ "main", "master" ] && params.DOCKERIZE != "no") {
img = docker.image(buildenv)
img.inside("--init -v ${jenkins_home}:${jenkins_home}") {
block()
}
} else {
block()
}
}
// URLs
def metarepo =
env.OSCAR_CI_REPO ?: "https://github.com/oscar-system/oscar-ci"
// parameters
def julia_version = "${params.JULIA_VERSION}"
def gap_version = "${params.GAP_VERSION}"
def buildtype = "${params.BUILDTYPE}"
def rebuild = rebuildMode()
env.OSCAR_CI_CONFIG = "meta/config/jenkins.yaml"
try {
stage('Preparation') {
// Setup workspace.
if (rebuild == "full") {
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
updateTimestamp()
get url: metarepo, dir: "meta"
sh "meta/prepare.rb"
// Update repositories
if (rebuild != "none") {
if (julia_version.startsWith("download:")) {
raw_julia_version = julia_version["download:".length()..-1]
sh "meta/download-julia.rb $raw_julia_version"
} else {
get url: "https://github.com/julialang/julia",
branch: julia_version
}
get url: "https://github.com/gap-system/gap",
branch: gap_version
get url: "https://github.com/Singular/Singular",
dir: "singular", branch: "spielwiese"
get url: "https://github.com/oscar-system/GAP.jl"
get url: "https://github.com/Nemocas/AbstractAlgebra.jl"
get url: "https://github.com/Nemocas/Nemo.jl"
get url: "https://github.com/thofma/Hecke.jl"
get url: "https://github.com/oscar-system/LoadFlint.jl"
get url: "https://github.com/oscar-system/Singular.jl"
get url: "https://github.com/oscar-system/Polymake.jl"
get url: "https://github.com/homalg-project/CapAndHomalg.jl"
get url: "https://github.com/oscar-system/GroupAtlas.jl"
get url: "https://github.com/ederc/GroebnerBasis.jl"
get url: "https://github.com/oscar-system/Oscar.jl"
get url: "https://github.com/sebastianpos/NemoLinearAlgebraForCAP"
get url: "https://github.com/oscar-system/OSCARBinder",
dir: "notebooks"
get url: "https://github.com/micjoswig/oscar-notebooks",
dir: "notebooks-polymake"
get url: "https://github.com/homalg-project/CapHomalgNotebooks",
dir: "notebooks-homalg"
get url: "https://github.com/oscar-system/GITFans",
dir: "notebooks-gitfans"
get url: "https://github.com/ederc/GroebnerBasisNotebooks",
dir: "notebooks-groebner"
} else {
// skip preparation
echo "Skipping preparation stage."
}
}
stage('Build') {
if (rebuild != "none") {
run_in_testenv {
sh "meta/install/install-julia.rb"
sh "meta/install/install-oscar.rb"
sh "meta/install/install-jupyter.rb"
sh "meta/install/install-gap.rb"
sh "meta/install/install-gap-packages.rb"
sh "meta/install/install-finalize.rb"
}
} else {
// skip build stage
echo "Skipping build stage."
}
}
stage('Test') {
run_in_testenv {
sh "meta/run-tests.rb"
}
}
} finally {
archiveArtifacts artifacts: "logs/build-${env.BUILD_NUMBER}/*"
archiveArtifacts artifacts: "julia-env/*.toml"
}
}