forked from Thrifleganger/ci-plugin-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile-projucer
More file actions
127 lines (123 loc) · 4.41 KB
/
Copy pathJenkinsfile-projucer
File metadata and controls
127 lines (123 loc) · 4.41 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
127
/*
This is a declarative pipeline script for Jenkins for Projucer 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 name of projucer file / plugin name configured within the projucer 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: [],
userRemoteConfigs: [[
credentialsId: 'jenkins-to-github',
url: "${gitRepoUrl}"
]]
])
}
}
stage('Build') {
steps {
script {
if (!isUnix()) {
echo "Building plugin for Windows"
bat """
curl -L "https://api.juce.com/api/v1/download/juce/latest/windows" -o juce.zip
jar xf juce.zip
"JUCE/projucer.exe" --set-global-search-path windows defaultJuceModulePath JUCE/modules
"JUCE/projucer.exe" --resave "${projectName}.jucer"
cd Builds/VisualStudio2019
if not defined MSBUILD_EXE set MSBUILD_EXE=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
"%MSBUILD_EXE%" ${projectName}.sln /p:VisualStudioVersion=16.0 /m /p:Configuration=Release /p:Platform=x64 /p:PreferredToolArchitecture=x64
copy "x64\\Release\\VST3\\${projectName}.vst3" "..\\..\\Installer\\Windows\\${projectName}.vst3"
"""
def versionScript = """
@(
"JUCE/projucer.exe" --get-version ${projectName}.jucer
)
"""
version = bat(script: versionScript, returnStdout: true).trim()
} else {
echo "Building plugin for Mac"
sh """
curl -L https://api.juce.com/api/v1/download/juce/latest/osx -o juce.zip
unzip juce
./JUCE/Projucer.app/Contents/MacOS/Projucer --resave ${projectName}.jucer
cd Builds/MacOSX
xcodebuild -configuration Release -scheme "${projectName} - All" build
cp -R `readlink build/Release/${projectName}.vst3` ../../Installer/Mac/${projectName}.vst3
cp -R `readlink build/Release/${projectName}.component` ../../Installer/Mac/${projectName}.component
"""
version = sh(
script: "./JUCE/Projucer.app/Contents/MacOS/Projucer --get-version ${projectName}.jucer",
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 Mac"
sh """
cd Installer/Mac
packagesbuild -v ${projectName}.pkgproj
"""
}
}
}
}
}
}