This repository has been archived by the owner on Feb 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Jenkinsfile
81 lines (69 loc) · 2.35 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
/*
* This file is part of the Software Factory project
* Copyright (C) Pelagicore AB
* SPDX-License_identifier: LGPL-2.1
* This file is subject to the terms of the LGPL-2.1 license.
* Please see the LICENSE file for details.
*/
void configureAndBuild(String name, String dir) {
stage("Configure ${name}") {
String cmake_params = "-DENABLE_PDF=OFF"
sh "cd ${dir} && cmake -H. -Bbuild ${cmake_params}"
}
stage("Build ${name}") {
sh "cd ${dir}/build && make"
}
stage("Archive ${name}") {
archiveArtifacts artifacts: "${dir}/build/**", fingerprint: true
}
}
String SWF_DIR = "SWF_SRC"
String SWF_BP_DIR = "SWF_BP_SRC"
pipeline {
agent {
dockerfile true
}
parameters {
string(name: "REMOTE_SWF_LINK", defaultValue: "https://github.com/Pelagicore/software-factory.git")
string(name: "BRANCH_SWF", defaultValue: "master")
}
stages {
stage('Download') {
steps {
// Delete old files
sh 'rm -rf .[^.] .??* *'
// Get the latest SWF src
sh "git clone ${params.REMOTE_SWF_LINK} ${SWF_DIR}"
sh "cd ${SWF_DIR} && git checkout origin/${params.BRANCH_SWF}"
// Checkout BP src along wth changes in pull request
sh "mkdir ${SWF_BP_DIR}"
dir ("${SWF_BP_DIR}") {
checkout scm
}
// Copying SWF BP code to SWF build, faking a "bump"
// It's for testing (BP changes + SWF code)
sh "cp -r ${SWF_BP_DIR}/* ${SWF_DIR}/docs/swf-blueprint/"
}
}
stage("Launch build") {
parallel {
stage("Blueprint") {
steps {
script {
// Configure, build, and archive the blueprint
configureAndBuild("Blueprint", SWF_BP_DIR)
}
}
}
stage("SWF + Blueprint") {
steps {
script {
// The same, but building it with the SWF Baseline
configureAndBuild("SWF + Blueprint", SWF_DIR)
}
}
}
}
}
}
}