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