2c2660f96e6099b02cfe89d121343bfcc4cdb4c0
[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 JSCTestsFactory(Factory):
89     def __init__(self, platform, configuration='release', architectures=None, additionalArguments=None, **kwargs):
90         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
91         self.addStep(CheckPatchRelevance())
92         self.addStep(CompileJSCOnly())
93         self.addStep(UnApplyPatchIfRequired())
94         self.addStep(CompileJSCOnlyToT())
95         self.addStep(RunJavaScriptCoreTests())
96         self.addStep(ReRunJavaScriptCoreTests())
97         self.addStep(UnApplyPatchIfRequired())
98         self.addStep(RunJavaScriptCoreTestsToT())
99
100
101 class APITestsFactory(Factory):
102     def getProduct(self):
103         self.addStep(DownloadBuiltProduct())
104         self.addStep(ExtractBuiltProduct())
105
106     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
107         Factory.__init__(self, platform, configuration, architectures, False, additionalArguments)
108         self.getProduct()
109         self.addStep(RunAPITests())
110
111
112 class GTKFactory(Factory):
113     pass
114
115
116 class iOSFactory(BuildFactory):
117     pass
118
119
120 class iOSSimulatorFactory(BuildFactory):
121     def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, triggers=None, **kwargs):
122         BuildFactory.__init__(self, platform, configuration, architectures, additionalArguments, triggers)
123         self.addStep(RunWebKitTests())
124
125
126 class MacWK1Factory(BuildFactory):
127     pass
128
129
130 class MacWK2Factory(BuildFactory):
131     pass
132
133
134 class WindowsFactory(Factory):
135     pass
136
137
138 class WinCairoFactory(Factory):
139     pass
140
141
142 class WPEFactory(Factory):
143     pass