forked from Thrifleganger/ci-plugin-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile-cmake
More file actions
126 lines (122 loc) · 3.98 KB
/
Copy pathJenkinsfile-cmake
File metadata and controls
126 lines (122 loc) · 3.98 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
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
/*
This is a declarative pipeline script for Jenkins for cmake type JUCE plugin projects
Fill the variables at the start of this file to configure the build pipeline for your plugin.
The build pipeline performs the following stages:
1) Checkout: The build pipeline is triggered for every change to the master branch. The Checkout stage clones the project locally within the Jenkins executor.
2) Build: Depending on the OS, the corresponding build system is utilized to build VST3 and AU targets.
3) Test: The plugin is subjected to a testing application called pluginval.
4) Package: The build artifacts are packaged into an installer (.exe or .pkg).
*/
/*
The project name is the ProjectName configured within the CMakeLists.txt file. Avoid spaces.
*/
def projectName = 'ci-plugin-demo'
/*
The clone URL of the git repo. Add the SSH variant which starts with "git@github.com"
*/
def gitRepoUrl = 'git@github.com:Thrifleganger/ci-plugin-demo.git'
def version = ''
/*
Start of pipeline script.
*/
pipeline {
agent any
triggers {
pollSCM('*/2 * * * *')
}
stages {
stage('Checkout') {
steps {
cleanWs()
checkout([
$class: 'GitSCM',
branches: [[name: '*/master']],
extensions: [[
$class: 'SubmoduleOption',
recursiveSubmodules: true]],
userRemoteConfigs: [[
credentialsId: 'jenkins-to-github',
url: "${gitRepoUrl}"
]]
])
}
}
stage('Build') {
steps {
script {
if (!isUnix()) {
echo "Building plugin for Windows"
bat """
mkdir Builds
cd Builds
cmake .. -G "Visual Studio 16 2019" -DJUCE_COPY_PLUGIN_AFTER_BUILD=OFF
cmake --build . --target "${projectName}_VST3" --config Release
copy "${projectName}_artefacts\\Release\\VST3\\${projectName}.vst3\\Contents\\x86_64-win\\${projectName}.vst3" "..\\Installer\\Windows\\${projectName}.vst3"
"""
def versionScript = """
@(
more version
)
"""
version = bat(script: versionScript, returnStdout: true).trim()
} else {
echo "Building plugin for Linux/Mac"
sh """
mkdir Builds
cd Builds
cmake .. -G Xcode -DJUCE_COPY_PLUGIN_AFTER_BUILD=OFF
cmake --build . --target "${projectName}_VST3" --config Release
cmake --build . --target "${projectName}_AU" --config Release
cp -R "${projectName}_artefacts/Release/VST3/${projectName}.vst3" "../Installer/Mac/${projectName}.vst3"
cp -R "${projectName}_artefacts/Release/AU/${projectName}.component" "../Installer/Mac/${projectName}.component"
"""
version = sh(
script: "cat version",
returnStdout: true
).trim()
}
}
}
}
stage('Test') {
steps {
script {
echo "Validating plugin"
if (!isUnix()) {
bat """
curl -L "https://github.com/Tracktion/pluginval/releases/download/latest_release/pluginval_Windows.zip" -o pluginval.zip
jar xf pluginval.zip
pluginval.exe --validate-in-process --validate "Installer/Windows/${projectName}.vst3"
"""
} else {
sh """
curl -L "https://github.com/Tracktion/pluginval/releases/download/latest_release/pluginval_macOS.zip" -o pluginval.zip
unzip pluginval
pluginval.app/Contents/MacOS/pluginval --validate-in-process --validate "Installer/Mac/${projectName}.vst3" || exit 1
"""
}
}
}
}
stage('Package') {
steps {
script {
if (!isUnix()) {
echo "Packaging plugin for Windows"
bat """
curl -L https://jrsoftware.org/download.php/is.exe -o innosetup.exe
innosetup.exe /portable=1 /silent /currentuser /dir="./innosetup"
"innosetup/iscc" /DVersion=${version} "Installer/Windows/${projectName}-installer.iss"
"""
} else {
echo "Packaging plugin for Linux/Mac"
sh """
cd Installer/Mac
packagesbuild -v ${projectName}.pkgproj
"""
}
}
}
}
}
}