[ews-build] Separate queues for Builders and Testers - iOS
[WebKit-https.git] / Tools / BuildSlaveSupport / ews-build / factories.py
1 # Copyright (C) 2018 Apple Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1.  Redistributions of source code must retain the above copyright
7 #     notice, this list of conditions and the following disclaimer.
8 # 2.  Redistributions in binary form must reproduce the above copyright
9 #     notice, this list of conditions and the following disclaimer in the
10 #     documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
16 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23
24 from buildbot.process import factory, properties
25 from buildbot.steps import trigger
26
27 from steps import *
28
29 Property = properties.Property
30
31
32 class Factory(factory.BuildFactory):
33     def __init__(self, platform, configuration=None, architectures=None, buildOnly=True, additionalArguments=None, **kwargs):
34         factory.BuildFactory.__init__(self)
35         self.addStep(ConfigureBuild(platform, configuration, architectures, buildOnly, additionalArguments))
36         self.addStep(CheckOutSource())
37
38
39 class StyleFactory(Factory):
40     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
41         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
42         self.addStep(CheckStyle())
43
44
45 class BindingsFactory(Factory):
46     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
47         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
48         self.addStep(CheckPatchRelevance())
49         self.addStep(RunBindingsTests())
50
51
52 class WebKitPerlFactory(Factory):
53     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
54         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
55         self.addStep(RunWebKitPerlTests())
56
57
58 class WebKitPyFactory(Factory):
59     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
60         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
61         self.addStep(CheckPatchRelevance())
62         self.addStep(RunWebKitPyTests())
63
64
65 class BuildFactory(Factory):
66     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, triggers=None, **kwargs):
67         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
68         self.addStep(KillOldProcesses())
69         self.addStep(CleanBuild())
70         self.addStep(CompileWebKit())
71         self.addStep(UnApplyPatchIfRequired())
72         self.addStep(CompileWebKitToT())
73         if triggers:
74             self.addStep(ArchiveBuiltProduct())
75             self.addStep(UploadBuiltProduct())
76             self.addStep(trigger.Trigger(schedulerNames=triggers, set_properties=self.propertiesToPassToTriggers() or {}))
77
78     def propertiesToPassToTriggers(self):
79         return {
80             "ewspatchid": Property("ewspatchid"),
81             "configuration": Property("configuration"),
82             "platform": Property("platform"),
83             "fullPlatform": Property("fullPlatform"),
84             "architecture": Property("architecture"),
85         }
86
87
88 class TestFactory(Factory):
89     LayoutTestClass = None
90     APITestClass = None
91
92     def getProduct(self):
93         self.addStep(DownloadBuiltProduct())
94         self.addStep(ExtractBuiltProduct())
95
96     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
97         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
98         self.getProduct()
99         if self.LayoutTestClass:
100             self.addStep(self.LayoutTestClass())
101         if self.APITestClass:
102             self.addStep(self.APITestClass())
103
104
105 class JSCTestsFactory(Factory):
106     def __init__(self, platform, configuration='release', architectures=None, additionalArguments=None, **kwargs):
107         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
108         self.addStep(CheckPatchRelevance())
109         self.addStep(CompileJSCOnly())
110         self.addStep(UnApplyPatchIfRequired())
111         self.addStep(CompileJSCOnlyToT())
112         self.addStep(RunJavaScriptCoreTests())
113         self.addStep(ReRunJavaScriptCoreTests())
114         self.addStep(UnApplyPatchIfRequired())
115         self.addStep(RunJavaScriptCoreTestsToT())
116
117
118 class APITestsFactory(TestFactory):
119     APITestClass = RunAPITests
120
121
122 class GTKFactory(Factory):
123     pass
124
125
126 class iOSBuildFactory(BuildFactory):
127     pass
128
129
130 class iOSTestsFactory(TestFactory):
131     LayoutTestClass = RunWebKitTests
132
133
134 class MacWK1Factory(BuildFactory):
135     pass
136
137
138 class MacWK2Factory(BuildFactory):
139     pass
140
141
142 class WindowsFactory(Factory):
143     pass
144
145
146 class WinCairoFactory(Factory):
147     pass
148
149
150 class WPEFactory(Factory):
151     pass