[TASK] Activate bamboo nightly mssql functional tests
[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 = 10;
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 // MAIN stage
69 ArrayList<Job> jobsMainStage = new ArrayList<Job>();
70
71 jobsMainStage.add(this.getJobComposerValidate("PHP72"));
72
73 // jobsMainStage.add(this.getJobAcceptanceTestInstallMysql("PHP70"));
74 // jobsMainStage.add(this.getJobAcceptanceTestInstallMysql("PHP71"));
75 // jobsMainStage.add(this.getJobAcceptanceTestInstallMysql("PHP72"));
76
77 // jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql("PHP70"));
78 // jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql("PHP71"));
79 // jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql("PHP72"));
80
81 // jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, "PHP70"));
82 // jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, "PHP71"));
83 // jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, "PHP72"));
84
85 jobsMainStage.add(this.getJobCglCheckFullCore("PHP72"));
86
87 jobsMainStage.add(this.getJobIntegrationVarious("PHP72"));
88
89 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, "PHP70"));
90 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, "PHP71"));
91 jobsMainStage.addAll(this.getJobsFunctionalTestsMysql(this.numberOfFunctionalMysqlJobs, "PHP72"));
92
93 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, "PHP70"));
94 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, "PHP71"));
95 jobsMainStage.addAll(this.getJobsFunctionalTestsMssql(this.numberOfFunctionalMssqlJobs, "PHP72"));
96
97 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, "PHP70"));
98 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, "PHP71"));
99 jobsMainStage.addAll(this.getJobsFunctionalTestsPgsql(this.numberOfFunctionalPgsqlJobs, "PHP72"));
100
101 jobsMainStage.add(this.getJobUnitJavaScript("PHP72"));
102
103 jobsMainStage.add(this.getJobLintPhp("PHP70"));
104 jobsMainStage.add(this.getJobLintPhp("PHP71"));
105 jobsMainStage.add(this.getJobLintPhp("PHP72"));
106
107 jobsMainStage.add(this.getJobLintScssTs("PHP72"));
108
109 jobsMainStage.add(this.getJobUnitPhp("PHP70"));
110 jobsMainStage.add(this.getJobUnitPhp("PHP71"));
111 jobsMainStage.add(this.getJobUnitPhp("PHP72"));
112
113 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, "PHP70"));
114 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, "PHP71"));
115 jobsMainStage.addAll(this.getJobUnitPhpRandom(this.numberOfUnitRandomOrderJobs, "PHP72"));
116
117 Stage stageMainStage = new Stage("Main stage")
118 .jobs(jobsMainStage.toArray(new Job[jobsMainStage.size()]));
119
120
121 // Compile plan
122 return new Plan(project(), planName, planKey)
123 .description("Execute TYPO3 core 8.7 nightly tests. Auto generated! See Build/bamboo of core git repository.")
124 .pluginConfigurations(this.getDefaultPlanPluginConfiguration())
125 .stages(
126 stageMainStage
127 )
128 .linkedRepositories("github TYPO3 TYPO3.CMS 8.7")
129 .triggers(
130 new ScheduledTrigger()
131 .name("Scheduled")
132 .description("daily at night")
133 // daily 04:42
134 .cronExpression("0 42 4 ? * *")
135 )
136 .variables(
137 new Variable("changeUrl", ""),
138 new Variable("patchset", "")
139 )
140 .planBranchManagement(
141 new PlanBranchManagement()
142 .delete(new BranchCleanup())
143 .notificationForCommitters()
144 );
145 }
146
147 /**
148 * Job checking CGL of all core php files
149 *
150 * @param String requirementIdentifier
151 */
152 protected Job getJobCglCheckFullCore(String requirementIdentifier) {
153 return new Job("Integration CGL", new BambooKey("CGLCHECK"))
154 .description("Check coding guidelines of full core")
155 .pluginConfigurations(this.getDefaultJobPluginConfiguration())
156 .tasks(
157 this.getTaskGitCloneRepository(),
158 this.getTaskGitCherryPick(),
159 this.getTaskComposerInstall(requirementIdentifier),
160 new ScriptTask()
161 .description("Execute cgl check")
162 .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
163 .inlineBody(
164 this.getScriptTaskBashInlineBody() +
165 "function phpCsFixer() {\n" +
166 " docker run \\\n" +
167 " -u ${HOST_UID} \\\n" +
168 " -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
169 " -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
170 " --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
171 " --rm \\\n" +
172 " typo3gmbh/" + requirementIdentifier.toLowerCase() + ":latest \\\n" +
173 " bin/bash -c \"cd ${PWD}; php -n -c /etc/php/cli-no-xdebug/php.ini bin/php-cs-fixer $*\"\n" +
174 "}\n" +
175 "\n" +
176 "phpCsFixer fix -v --dry-run --path-mode intersection --config=Build/.php_cs typo3/\n" +
177 "exit $?"
178 )
179 )
180 .requirements(
181 this.getRequirementDocker10()
182 )
183 .cleanWorkingDirectory(true);
184 }
185 }