[TASK] bamboo: Include php 7.2 in test suite
[Packages/TYPO3.CMS.git] / Build / bamboo / src / main / java / core / NightlySpec.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.BambooKey;
20 import com.atlassian.bamboo.specs.api.builders.Variable;
21 import com.atlassian.bamboo.specs.api.builders.plan.Job;
22 import com.atlassian.bamboo.specs.api.builders.plan.Plan;
23 import com.atlassian.bamboo.specs.api.builders.plan.Stage;
24 import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;
25 import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;
26 import com.atlassian.bamboo.specs.api.builders.project.Project;
27 import com.atlassian.bamboo.specs.builders.task.ScriptTask;
28 import com.atlassian.bamboo.specs.builders.trigger.ScheduledTrigger;
29 import com.atlassian.bamboo.specs.model.task.ScriptTaskProperties;
30 import com.atlassian.bamboo.specs.util.BambooServer;
31
32 /**
33 * Core 8.7 nightly test plan.
34 */
35 @BambooSpec
36 public class NightlySpec extends AbstractCoreSpec {
37
38 protected static String planName = "Core 8.7 nightly";
39 protected static String planKey = "GTN87";
40
41 protected int numberOfAcceptanceTestJobs = 8;
42 protected int numberOfFunctionalMysqlJobs = 6;
43 protected int numberOfFunctionalMssqlJobs = 6;
44 protected int numberOfFunctionalPgsqlJobs = 6;
45 protected int numberOfUnitRandomOrderJobs = 2;
46
47 /**
48 * Run main to publish plan on Bamboo
49 */
50 public static void main(final String[] args) throws Exception {
51 // By default credentials are read from the '.credentials' file.
52 BambooServer bambooServer = new BambooServer(bambooServerName);
53 bambooServer.publish(new NightlySpec().createPlan());
54 bambooServer.publish(new NightlySpec().getDefaultPlanPermissions(projectKey, planKey));
55 }
56
57 /**
58 * Core 8.7 pre-merge plan is in "TYPO3 core" project of bamboo
59 */
60 Project project() {
61 return new Project().name(projectName).key(projectKey);
62 }
63
64 /**
65 * Returns full Plan definition
66 */
67 Plan createPlan() {
68 // PREPARATION stage
69 ArrayList<Job> jobsPreparationStage = new ArrayList<Job>();
70
71 jobsPreparationStage.add(this.getJobComposerValidate());
72
73 Stage stagePreparation = new Stage("Preparation")
74 .jobs(jobsPreparationStage.toArray(new Job[jobsPreparationStage.size()]));
75
76
77 // MAIN stage
78 ArrayList<Job> jobsMainStage = new ArrayList<Job>();
79
80 jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion70(), "PHP70"));
81 jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion71(), "PHP71"));
82 jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion72(), "PHP72"));
83
84 jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion70(), "PHP70"));
85 jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion71(), "PHP71"));
86 jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion72(), "PHP72"));
87
88 jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion70(), "PHP70"));
89 jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion71(), "PHP71"));
90 jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion72(), "PHP72"));
91
92 jobsMainStage.add(this.getJobCglCheckFullCore());
93
94 jobsMainStage.add(this.getJobIntegrationVarious());
95
96 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion70(), "PHP70"));
97 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion71(), "PHP71"));
98 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, this.getRequirementPhpVersion72(), "PHP72"));
99
100 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, this.getRequirementPhpVersion70(), "PHP70"));
101 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, this.getRequirementPhpVersion71(), "PHP71"));
102 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, this.getRequirementPhpVersion72(), "PHP72"));
103
104 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, this.getRequirementPhpVersion70(), "PHP70"));
105 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, this.getRequirementPhpVersion71(), "PHP71"));
106 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, this.getRequirementPhpVersion72(), "PHP72"));
107
108 jobsMainStage.add(this.getJobUnitJavaScript());
109
110 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion70(), "PHP70"));
111 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion71(), "PHP71"));
112 jobsMainStage.add(this.getJobLintPhp(this.getRequirementPhpVersion72(), "PHP72"));
113
114 jobsMainStage.add(this.getJobLintScssTs());
115
116 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion70(), "PHP70"));
117 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion71(), "PHP71"));
118 jobsMainStage.add(this.getJobUnitPhp(this.getRequirementPhpVersion72(), "PHP72"));
119
120 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, this.getRequirementPhpVersion70(), "PHP70"));
121 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, this.getRequirementPhpVersion71(), "PHP71"));
122 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, this.getRequirementPhpVersion72(), "PHP72"));
123
124 Stage stageMainStage = new Stage("Main stage")
125 .jobs(jobsMainStage.toArray(new Job[jobsMainStage.size()]));
126
127
128 // Compile plan
129 return new Plan(project(), planName, planKey)
130 .description("Execute TYPO3 core 8.7 nightly tests. Auto generated! See Build/bamboo of core git repository.")
131 .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
132 .stages(
133 stagePreparation,
134 stageMainStage
135 )
136 .linkedRepositories("git.typo3.org Core 8.7")
137 .triggers(
138 new ScheduledTrigger()
139 .name("Scheduled")
140 .description("daily at night")
141 // daily 04:42
142 .cronExpression("0 42 4 ? * *")
143 )
144 .variables(
145 new Variable("changeUrl", ""),
146 new Variable("patchset", "")
147 )
148 .planBranchManagement(
149 new PlanBranchManagement()
150 .delete(new BranchCleanup())
151 .notificationForCommitters()
152 );
153 }
154
155 /**
156 * Job checking CGL of all core php files
157 */
158 protected Job getJobCglCheckFullCore() {
159 return new Job("Integration CGL", new BambooKey("CGLCHECK"))
160 .description("Check coding guidelines of full core")
161 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
162 .tasks(
163 this.getTaskGitCloneRepository(),
164 this.getTaskGitCherryPick(),
165 this.getTaskComposerInstall(),
166 new ScriptTask()
167 .description("Execute cgl check")
168 .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
169 .inlineBody(
170 this.getScriptTaskBashInlineBody() +
171 this.getScriptTaskBashPhpNoXdebug() +
172 "php_no_xdebug ./bin/php-cs-fixer fix -v --dry-run --config=Build/.php_cs typo3/\n" +
173 "exit $?\n"
174 )
175 )
176 .requirements(
177 this.getRequirementPhpVersion70Or71Or72()
178 )
179 .cleanWorkingDirectory(true);
180 }
181 }