blob: 75fc500a60d49d7d8f01a504a4ceae87b75d0b95 [file] [log] [blame]
# Copyright (C) 2018-2022 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from buildbot.process import factory
from buildbot.steps import trigger
from steps import (AddAuthorToCommitMessage, AddReviewerToCommitMessage, ApplyPatch, ApplyWatchList, Canonicalize, CommitPatch,
CheckOutPullRequest, CheckOutSource, CheckOutSpecificRevision, CheckChangeRelevance,
CheckPatchStatusOnEWSQueues, CheckStyle, CleanGitRepo, CompileJSC, CompileWebKit, ConfigureBuild,
DetermineAuthor, DownloadBuiltProduct, ExtractBuiltProduct, FetchBranches, FindModifiedLayoutTests, GitSvnFetch,
InstallGtkDependencies, InstallWpeDependencies, KillOldProcesses, PrintConfiguration, PushCommitToWebKitRepo,
RunAPITests, RunBindingsTests, RunBuildWebKitOrgUnitTests, RunBuildbotCheckConfigForBuildWebKit, RunBuildbotCheckConfigForEWS,
RunEWSUnitTests, RunResultsdbpyTests, RunJavaScriptCoreTests, RunWebKit1Tests, RunWebKitPerlTests, RunWebKitPyPython2Tests,
RunWebKitPyPython3Tests, RunWebKitTests, RunWebKitTestsRedTree, RunWebKitTestsInStressMode, RunWebKitTestsInStressGuardmallocMode,
SetBuildSummary, ShowIdentifier, TriggerCrashLogSubmission, UpdateWorkingDirectory,
ValidateCommitMessage, ValidateChange, ValidateCommitterAndReviewer, WaitForCrashCollection,
InstallBuiltProduct, VerifyGitHubIntegrity, ValidateSquashed)
class Factory(factory.BuildFactory):
findModifiedLayoutTests = False
def __init__(self, platform, configuration=None, architectures=None, buildOnly=True, triggers=None, triggered_by=None, remotes=None, additionalArguments=None, checkRelevance=False, **kwargs):
factory.BuildFactory.__init__(self)
self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architectures=architectures, buildOnly=buildOnly, triggers=triggers, triggered_by=triggered_by, remotes=remotes, additionalArguments=additionalArguments))
if checkRelevance:
self.addStep(CheckChangeRelevance())
if self.findModifiedLayoutTests:
self.addStep(FindModifiedLayoutTests())
self.addStep(ValidateChange())
self.addStep(PrintConfiguration())
self.addStep(CleanGitRepo())
self.addStep(CheckOutSource())
# CheckOutSource step pulls the latest revision, since we use alwaysUseLatest=True. Without alwaysUseLatest Buildbot will
# automatically apply the patch to the repo, and that doesn't handle ChangeLogs well. See https://webkit.org/b/193138
# Therefore we add CheckOutSpecificRevision step to checkout required revision.
self.addStep(CheckOutSpecificRevision())
self.addStep(FetchBranches())
self.addStep(ShowIdentifier())
self.addStep(ApplyPatch())
self.addStep(CheckOutPullRequest())
class StyleFactory(factory.BuildFactory):
def __init__(self, platform, configuration=None, architectures=None, triggers=None, remotes=None, additionalArguments=None, **kwargs):
factory.BuildFactory.__init__(self)
self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=triggers, remotes=remotes, additionalArguments=additionalArguments))
self.addStep(ValidateChange())
self.addStep(PrintConfiguration())
self.addStep(CleanGitRepo())
self.addStep(CheckOutSource())
self.addStep(FetchBranches())
self.addStep(ShowIdentifier())
self.addStep(UpdateWorkingDirectory())
self.addStep(ApplyPatch())
self.addStep(CheckOutPullRequest())
self.addStep(CheckStyle())
class WatchListFactory(factory.BuildFactory):
def __init__(self, platform, configuration=None, architectures=None, triggers=None, remotes=None, additionalArguments=None, **kwargs):
factory.BuildFactory.__init__(self)
self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=triggers, remotes=remotes, additionalArguments=additionalArguments))
self.addStep(ValidateChange())
self.addStep(PrintConfiguration())
self.addStep(CleanGitRepo())
self.addStep(CheckOutSource())
self.addStep(FetchBranches())
self.addStep(ShowIdentifier())
self.addStep(UpdateWorkingDirectory())
self.addStep(ApplyPatch())
self.addStep(CheckOutPullRequest())
self.addStep(ApplyWatchList())
class BindingsFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, additionalArguments=additionalArguments, checkRelevance=True)
self.addStep(RunBindingsTests())
class WebKitPerlFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, additionalArguments=additionalArguments)
self.addStep(RunWebKitPerlTests())
class WebKitPyFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, additionalArgument=additionalArguments, checkRelevance=True)
self.addStep(RunWebKitPyPython2Tests())
self.addStep(RunWebKitPyPython3Tests())
self.addStep(SetBuildSummary())
class BuildFactory(Factory):
skipUpload = False
def __init__(self, platform, configuration=None, architectures=None, triggers=None, additionalArguments=None, checkRelevance=False, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=triggers, additionalArguments=additionalArguments, checkRelevance=checkRelevance)
self.addStep(KillOldProcesses())
if platform == 'gtk':
self.addStep(InstallGtkDependencies())
self.addStep(CompileWebKit(skipUpload=self.skipUpload))
if platform == 'gtk':
self.addStep(InstallBuiltProduct())
class TestFactory(Factory):
LayoutTestClass = None
APITestClass = None
willTriggerCrashLogSubmission = False
def getProduct(self):
self.addStep(DownloadBuiltProduct())
self.addStep(ExtractBuiltProduct())
def __init__(self, platform, configuration=None, architectures=None, triggered_by=None, additionalArguments=None, checkRelevance=False, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggered_by=triggered_by, additionalArguments=additionalArguments, checkRelevance=checkRelevance)
if platform == 'gtk':
self.addStep(InstallGtkDependencies())
self.getProduct()
if self.willTriggerCrashLogSubmission:
self.addStep(WaitForCrashCollection())
self.addStep(KillOldProcesses())
if self.LayoutTestClass:
self.addStep(FindModifiedLayoutTests(skipBuildIfNoResult=False))
self.addStep(RunWebKitTestsInStressMode(num_iterations=10))
self.addStep(self.LayoutTestClass())
if self.APITestClass:
self.addStep(self.APITestClass())
if self.willTriggerCrashLogSubmission:
self.addStep(TriggerCrashLogSubmission())
if self.LayoutTestClass:
self.addStep(SetBuildSummary())
class StressTestFactory(TestFactory):
findModifiedLayoutTests = True
def __init__(self, platform, configuration=None, architectures=None, triggered_by=None, additionalArguments=None, checkRelevance=False, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggered_by=triggered_by, additionalArguments=additionalArguments, checkRelevance=checkRelevance)
self.getProduct()
self.addStep(WaitForCrashCollection())
self.addStep(KillOldProcesses())
self.addStep(RunWebKitTestsInStressMode())
self.addStep(TriggerCrashLogSubmission())
self.addStep(SetBuildSummary())
class JSCBuildFactory(Factory):
def __init__(self, platform, configuration='release', architectures=None, triggers=None, remotes=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=triggers, remotes=remotes, additionalArguments=additionalArguments, checkRelevance=True)
self.addStep(KillOldProcesses())
self.addStep(CompileJSC())
class JSCBuildAndTestsFactory(Factory):
def __init__(self, platform, configuration='release', architectures=None, remotes=None, additionalArguments=None, runTests='true', **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, remotes=remotes, additionalArguments=additionalArguments, checkRelevance=True)
self.addStep(KillOldProcesses())
self.addStep(CompileJSC(skipUpload=True))
if runTests.lower() == 'true':
self.addStep(RunJavaScriptCoreTests())
class JSCTestsFactory(Factory):
def __init__(self, platform, configuration='release', architectures=None, remotes=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, remotes=remotes, additionalArguments=additionalArguments, checkRelevance=True)
self.addStep(DownloadBuiltProduct())
self.addStep(ExtractBuiltProduct())
self.addStep(KillOldProcesses())
self.addStep(RunJavaScriptCoreTests())
class APITestsFactory(TestFactory):
APITestClass = RunAPITests
class iOSBuildFactory(BuildFactory):
pass
class iOSEmbeddedBuildFactory(BuildFactory):
skipUpload = True
class iOSTestsFactory(TestFactory):
LayoutTestClass = RunWebKitTests
willTriggerCrashLogSubmission = True
class macOSBuildFactory(BuildFactory):
pass
class macOSBuildOnlyFactory(BuildFactory):
skipUpload = True
def __init__(self, platform, configuration=None, architectures=None, triggers=None, additionalArguments=None, checkRelevance=True, **kwargs):
super(macOSBuildOnlyFactory, self).__init__(platform=platform, configuration=configuration, architectures=architectures, triggers=triggers, additionalArguments=additionalArguments, checkRelevance=checkRelevance, **kwargs)
class watchOSBuildFactory(BuildFactory):
skipUpload = True
class tvOSBuildFactory(BuildFactory):
skipUpload = True
class macOSWK1Factory(TestFactory):
LayoutTestClass = RunWebKit1Tests
willTriggerCrashLogSubmission = True
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, checkRelevance=False, **kwargs):
super(macOSWK1Factory, self).__init__(platform=platform, configuration=configuration, architectures=architectures, additionalArguments=additionalArguments, checkRelevance=True, **kwargs)
class macOSWK2Factory(TestFactory):
LayoutTestClass = RunWebKitTests
willTriggerCrashLogSubmission = True
class WindowsFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, triggers=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=triggers, additionalArguments=additionalArguments, checkRelevance=True)
self.addStep(KillOldProcesses())
self.addStep(CompileWebKit(skipUpload=True))
self.addStep(ValidateChange(verifyBugClosed=False, addURLs=False))
self.addStep(RunWebKit1Tests())
self.addStep(SetBuildSummary())
class WinCairoFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, triggers=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=True, triggers=triggers, additionalArguments=additionalArguments)
self.addStep(KillOldProcesses())
self.addStep(CompileWebKit(skipUpload=True))
class GTKBuildFactory(BuildFactory):
pass
class GTKTestsFactory(TestFactory):
LayoutTestClass = RunWebKitTestsRedTree
class WPEFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, triggers=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=True, triggers=triggers, additionalArguments=additionalArguments)
self.addStep(KillOldProcesses())
self.addStep(InstallWpeDependencies())
self.addStep(CompileWebKit(skipUpload=True))
class ServicesFactory(Factory):
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
Factory.__init__(self, platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, additionalArguments=additionalArguments, checkRelevance=True)
self.addStep(RunBuildWebKitOrgUnitTests())
self.addStep(RunBuildbotCheckConfigForBuildWebKit())
self.addStep(RunEWSUnitTests())
self.addStep(RunBuildbotCheckConfigForEWS())
self.addStep(RunResultsdbpyTests())
class CommitQueueFactory(factory.BuildFactory):
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
factory.BuildFactory.__init__(self)
self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=None, remotes=None, additionalArguments=additionalArguments))
self.addStep(ValidateChange(verifycqplus=True))
self.addStep(ValidateCommitterAndReviewer())
self.addStep(PrintConfiguration())
self.addStep(CleanGitRepo())
self.addStep(CheckOutSource())
self.addStep(GitSvnFetch()) # FIXME: Remove when migrating to pure git
self.addStep(FetchBranches())
self.addStep(ShowIdentifier())
self.addStep(VerifyGitHubIntegrity())
self.addStep(UpdateWorkingDirectory())
self.addStep(CommitPatch())
self.addStep(ValidateSquashed())
self.addStep(AddReviewerToCommitMessage())
self.addStep(DetermineAuthor())
self.addStep(AddAuthorToCommitMessage())
self.addStep(ValidateCommitMessage())
self.addStep(KillOldProcesses())
self.addStep(CompileWebKit(skipUpload=True))
self.addStep(KillOldProcesses())
self.addStep(ValidateChange(addURLs=False, verifycqplus=True))
self.addStep(CheckPatchStatusOnEWSQueues())
self.addStep(RunWebKitTests())
self.addStep(ValidateChange(addURLs=False, verifycqplus=True))
self.addStep(Canonicalize())
self.addStep(PushCommitToWebKitRepo())
self.addStep(SetBuildSummary())
class MergeQueueFactoryBase(factory.BuildFactory):
def __init__(self, platform, configuration=None, architectures=None, additionalArguments=None, **kwargs):
super(MergeQueueFactoryBase, self).__init__()
self.addStep(ConfigureBuild(platform=platform, configuration=configuration, architectures=architectures, buildOnly=False, triggers=None, remotes=None, additionalArguments=additionalArguments))
self.addStep(ValidateChange(verifyMergeQueue=True, verifyNoDraftForMergeQueue=True))
self.addStep(ValidateCommitterAndReviewer())
self.addStep(PrintConfiguration())
self.addStep(CleanGitRepo())
self.addStep(CheckOutSource())
self.addStep(GitSvnFetch()) # FIXME: Remove when migrating to pure git
self.addStep(FetchBranches())
self.addStep(ShowIdentifier())
self.addStep(VerifyGitHubIntegrity())
self.addStep(UpdateWorkingDirectory())
self.addStep(CheckOutPullRequest())
self.addStep(ValidateSquashed())
self.addStep(AddReviewerToCommitMessage())
self.addStep(DetermineAuthor())
self.addStep(AddAuthorToCommitMessage())
self.addStep(ValidateCommitMessage())
class MergeQueueFactory(MergeQueueFactoryBase):
def __init__(self, platform, **kwargs):
super(MergeQueueFactory, self).__init__(platform, **kwargs)
self.addStep(KillOldProcesses())
self.addStep(CompileWebKit(skipUpload=True))
self.addStep(KillOldProcesses())
self.addStep(ValidateChange(verifyMergeQueue=True, verifyNoDraftForMergeQueue=True))
self.addStep(Canonicalize())
self.addStep(PushCommitToWebKitRepo())
self.addStep(SetBuildSummary())
class UnsafeMergeQueueFactory(MergeQueueFactoryBase):
def __init__(self, platform, **kwargs):
super(UnsafeMergeQueueFactory, self).__init__(platform, **kwargs)
self.addStep(ValidateChange(verifyMergeQueue=True, verifyNoDraftForMergeQueue=True))
self.addStep(Canonicalize())
self.addStep(PushCommitToWebKitRepo())
self.addStep(SetBuildSummary())