[TASK] bamboo: Include php 7.2 in test suite
[Packages/TYPO3.CMS.git] / Build / bamboo / src / main / java / core / PreMergeSpec.java
1 package core;
2
3 /*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16 import java.util.ArrayList;
17
18 import com.atlassian.bamboo.specs.api.BambooSpec;
19 import com.atlassian.bamboo.specs.api.builders.AtlassianModule;
20 import com.atlassian.bamboo.specs.api.builders.BambooKey;
21 import com.atlassian.bamboo.specs.api.builders.Variable;
22 import com.atlassian.bamboo.specs.api.builders.notification.AnyNotificationRecipient;
23 import com.atlassian.bamboo.specs.api.builders.notification.Notification;
24 import com.atlassian.bamboo.specs.api.builders.plan.Job;
25 import com.atlassian.bamboo.specs.api.builders.plan.Plan;
26 import com.atlassian.bamboo.specs.api.builders.plan.Stage;
27 import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
28 import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
29 import com.atlassian.bamboo.specs.api.builders.plan.configuration.AllOtherPluginsConfiguration;
30 import com.atlassian.bamboo.specs.api.builders.project.Project;
31 import com.atlassian.bamboo.specs.api.builders.requirement.Requirement;
32 import com.atlassian.bamboo.specs.builders.notification.PlanCompletedNotification;
33 import com.atlassian.bamboo.specs.builders.task.ScriptTask;
34 import com.atlassian.bamboo.specs.builders.trigger.RemoteTrigger;
35 import com.atlassian.bamboo.specs.builders.trigger.RepositoryPollingTrigger;
36 import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
37 import com.atlassian.bamboo.specs.util.BambooServer;
38 import com.atlassian.bamboo.specs.util.MapBuilder;
39
40 /**
41 * Core 8.7 pre-merge test plan.
42 */
43 @BambooSpec
44 public class PreMergeSpec extends AbstractCoreSpec {
45
46 protected static String planName = "Core 8.7 pre-merge";
47 protected static String planKey = "GTC87";
48
49 protected int numberOfAcceptanceTestJobs = 8;
50 protected int numberOfFunctionalMysqlJobs = 10;
51 protected int numberOfFunctionalMssqlJobs = 10;
52 protected int numberOfFunctionalPgsqlJobs = 10;
53 protected int numberOfUnitRandomOrderJobs = 1;
54
55 /**
56 * Run main to publish plan on Bamboo
57 */
58 public static void main(final String[] args) throws Exception {
59 // By default credentials are read from the '.credentials' file.
60 BambooServer bambooServer = new BambooServer(bambooServerName);
61 bambooServer.publish(new PreMergeSpec().createPlan());
62 bambooServer.publish(new PreMergeSpec().getDefaultPlanPermissions(projectKey, planKey));
63 }
64
65 /**
66 * Core 8.7 pre-merge plan is in "TYPO3 core" project of bamboo
67 */
68 Project project() {
69 return new Project().name(projectName).key(projectKey);
70 }
71
72 /**
73 * Returns full Plan definition
74 */
75 Plan createPlan() {
76 // PREPARATION stage
77 ArrayList<Job> jobsPreparationStage = new ArrayList<Job>();
78
79 jobsPreparationStage.add(this.getJobBuildLabels());
80
81 jobsPreparationStage.add(this.getJobCglCheckGitCommit());
82
83 jobsPreparationStage.add(this.getJobComposerValidate());
84
85 Stage stagePreparation = new Stage("Preparation")
86 .jobs(jobsPreparationStage.toArray(new Job[jobsPreparationStage.size()]));
87
88 // MAIN stage
89 ArrayList<Job> jobsMainStage = new ArrayList<Job>();
90
91 jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion70Or71Or72(), "PHP707172"));
92 jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion70Or71Or72(), "PHP707172"));
93
94 jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion70Or71Or72(), "PHP707172"));
95
96 jobsMainStage.add(this.getJobIntegrationVarious());
97
98 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion70Or71Or72(), "PHP707172"));
99
100 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, this.getRequirementPhpVersion70Or71Or72(), "PHP707172"));
101
102 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, this.getRequirementPhpVersion70Or71Or72(), "PHP707172"));
103
104 jobsMainStage.add(this.getJobUnitJavaScript());
105
106 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion70(), "PHP70"));
107 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion71(), "PHP71"));
108 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion72(), "PHP72"));
109
110 jobsMainStage.add(this.getJobLintScssTs());
111
112 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion70(), "PHP70"));
113 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion71(), "PHP71"));
114 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion72(), "PHP72"));
115
116 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, this.getRequirementPhpVersion70(), "PHP70"));
117 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, this.getRequirementPhpVersion71(), "PHP71"));
118 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, this.getRequirementPhpVersion72(), "PHP72"));
119
120 Stage stageMainStage = new Stage("Main stage")
121 .jobs(jobsMainStage.toArray(new Job[jobsMainStage.size()]));
122
123 // Compile plan
124 return new Plan(project(), planName, planKey)
125 .description("Execute TYPO3 core 8.7 pre-merge tests. Auto generated! See Build/bamboo of core git repository.")
126 .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
127 .stages(
128 stagePreparation,
129 stageMainStage
130 )
131 .linkedRepositories("git.typo3.org Core 8.7")
132 .triggers(
133 new RepositoryPollingTrigger()
134 .name("Repository polling for post-merge builds"),
135 new RemoteTrigger()
136 .name("Remote trigger for pre-merge builds")
137 .description("Gerrit")
138 .triggerIPAddresses("5.10.165.218,91.184.35.13"))
139 .variables(
140 new Variable("changeUrl", ""),
141 new Variable("patchset", "")
142 )
143 .planBranchManagement(
144 new PlanBranchManagement()
145 .delete(new BranchCleanup())
146 .notificationForCommitters()
147 )
148 .notifications(new Notification()
149 .type(new PlanCompletedNotification())
150 .recipients(new AnyNotificationRecipient(new AtlassianModule("com.atlassian.bamboo.plugins.bamboo-slack:recipient.slack"))
151 .recipientString("https://intercept.typo3.com/index.php")
152 )
153 );
154 }
155
156 /**
157 * Job creating labels needed for intercept communication
158 */
159 protected Job getJobBuildLabels() {
160 return new Job("Create build labels", new BambooKey("CLFB"))
161 .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
162 .pluginConfigurations(new AllOtherPluginsConfiguration()
163 .configuration(new MapBuilder()
164 .put("repositoryDefiningWorkingDirectory", -1)
165 .put("custom", new MapBuilder()
166 .put("auto", new MapBuilder()
167 .put("regex", "https:\\/\\/review\\.typo3\\.org\\/(#\\/c\\/)?(\\d+)")
168 .put("label", "change-\\2\\, patchset-${bamboo.patchset}")
169 .build()
170 )
171 .put("buildHangingConfig.enabled", "false")
172 .put("ncover.path", "")
173 .put("clover", new MapBuilder()
174 .put("path", "")
175 .put("license", "")
176 .put("useLocalLicenseKey", "true")
177 .build()
178 )
179 .build()
180 )
181 .build()
182 )
183 )
184 .tasks(
185 new ScriptTask()
186 .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
187 .inlineBody("echo \"I'm just here for the labels!\"")
188 )
189 .cleanWorkingDirectory(true);
190 }
191
192 /**
193 * Job checking CGL of last git commit
194 */
195 protected Job getJobCglCheckGitCommit() {
196 return new Job("Integration CGL", new BambooKey("CGLCHECK"))
197 .description("Check coding guidelines by executing Build/Scripts/cglFixMyCommit.sh script")
198 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
199 .tasks(
200 this.getTaskGitCloneRepository(),
201 this.getTaskGitCherryPick(),
202 this.getTaskComposerInstall(),
203 new ScriptTask()
204 .description("Execute cgl check script")
205 .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
206 .inlineBody(
207 this.getScriptTaskBashInlineBody() +
208 "./Build/Scripts/cglFixMyCommit.sh dryrun\n"
209 )
210 )
211 .requirements(
212 this.getRequirementPhpVersion70Or71Or72()
213 )
214 .cleanWorkingDirectory(true);
215 }
216 }