[TASK] bamboo v7: 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.builders.notification.PlanCompletedNotification;
32 import com.atlassian.bamboo.specs.builders.task.ScriptTask;
33 import com.atlassian.bamboo.specs.builders.trigger.RemoteTrigger;
34 import com.atlassian.bamboo.specs.builders.trigger.RepositoryPollingTrigger;
35 import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
36 import com.atlassian.bamboo.specs.util.BambooServer;
37 import com.atlassian.bamboo.specs.util.MapBuilder;
38
39 /**
40 * Core 7.6 pre-merge test plan.
41 */
42 @BambooSpec
43 public class PreMergeSpec extends AbstractCoreSpec {
44
45 protected static String planName = "Core 7.6 pre-merge";
46 protected static String planKey = "GTC76";
47
48 protected int numberOfFunctionalMysqlJobs = 5;
49
50 /**
51 * Run main to publish plan on Bamboo
52 */
53 public static void main(final String[] args) throws Exception {
54 // By default credentials are read from the '.credentials' file.
55 BambooServer bambooServer = new BambooServer(bambooServerName);
56 bambooServer.publish(new PreMergeSpec().createPlan());
57 bambooServer.publish(new PreMergeSpec().getDefaultPlanPermissions(projectKey, planKey));
58 }
59
60 /**
61 * Core 7.6 pre-merge plan is in "TYPO3 core" project of bamboo
62 */
63 Project project() {
64 return new Project().name(projectName).key(projectKey);
65 }
66
67 /**
68 * Returns full Plan definition
69 */
70 Plan createPlan() {
71 // PREPARATION stage
72 ArrayList<Job> jobsPreparationStage = new ArrayList<Job>();
73
74 jobsPreparationStage.add(this.getJobBuildLabels());
75
76 jobsPreparationStage.add(this.getJobComposerValidate());
77
78 Stage stagePreparation = new Stage("Preparation")
79 .jobs(jobsPreparationStage.toArray(new Job[jobsPreparationStage.size()]));
80
81 // MAIN stage
82 ArrayList<Job> jobsMainStage = new ArrayList<Job>();
83
84 jobsMainStage.add(this.getJobIntegrationVarious());
85
86 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion55(), "PHP55"));
87 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion56(), "PHP56"));
88 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion70(), "PHP70"));
89 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion71(), "PHP71"));
90 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion72(), "PHP72"));
91
92 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion55(), "PHP55"));
93 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion56(), "PHP56"));
94 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion70(), "PHP70"));
95 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion71(), "PHP71"));
96 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion72(), "PHP72"));
97
98 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion55(), "PHP55"));
99 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion56(), "PHP56"));
100 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion70(), "PHP70"));
101 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion71(), "PHP71"));
102 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion72(), "PHP72"));
103
104 Stage stageMainStage = new Stage("Main stage")
105 .jobs(jobsMainStage.toArray(new Job[jobsMainStage.size()]));
106
107 // Compile plan
108 return new Plan(project(), planName, planKey)
109 .description("Execute TYPO3 core 7.6 pre-merge tests. Auto generated! See Build/bamboo of core git repository.")
110 .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
111 .stages(
112 stagePreparation,
113 stageMainStage
114 )
115 .linkedRepositories("git.typo3.org Core 7.6")
116 .triggers(
117 new RepositoryPollingTrigger()
118 .name("Repository polling for post-merge builds"),
119 new RemoteTrigger()
120 .name("Remote trigger for pre-merge builds")
121 .description("Gerrit")
122 .triggerIPAddresses("5.10.165.218,91.184.35.13"))
123 .variables(
124 new Variable("changeUrl", ""),
125 new Variable("patchset", "")
126 )
127 .planBranchManagement(
128 new PlanBranchManagement()
129 .delete(new BranchCleanup())
130 .notificationForCommitters()
131 )
132 .notifications(new Notification()
133 .type(new PlanCompletedNotification())
134 .recipients(new AnyNotificationRecipient(new AtlassianModule("com.atlassian.bamboo.plugins.bamboo-slack:recipient.slack"))
135 .recipientString("https://intercept.typo3.com/index.php")
136 )
137 );
138 }
139
140 /**
141 * Job creating labels needed for intercept communication
142 */
143 protected Job getJobBuildLabels() {
144 return new Job("Create build labels", new BambooKey("CLFB"))
145 .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
146 .pluginConfigurations(new AllOtherPluginsConfiguration()
147 .configuration(new MapBuilder()
148 .put("repositoryDefiningWorkingDirectory", -1)
149 .put("custom", new MapBuilder()
150 .put("auto", new MapBuilder()
151 .put("regex", "https:\\/\\/review\\.typo3\\.org\\/(#\\/c\\/)?(\\d+)")
152 .put("label", "change-\\2\\, patchset-${bamboo.patchset}")
153 .build()
154 )
155 .put("buildHangingConfig.enabled", "false")
156 .put("ncover.path", "")
157 .put("clover", new MapBuilder()
158 .put("path", "")
159 .put("license", "")
160 .put("useLocalLicenseKey", "true")
161 .build()
162 )
163 .build()
164 )
165 .build()
166 )
167 )
168 .tasks(
169 new ScriptTask()
170 .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
171 .inlineBody("echo \"I'm just here for the labels!\"")
172 )
173 .cleanWorkingDirectory(true);
174 }
175 }