From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.14194.1635264125715517806 for ; Tue, 26 Oct 2021 09:02:05 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5829113D5; Tue, 26 Oct 2021 09:02:05 -0700 (PDT) Received: from e120189.arm.com (unknown [10.57.74.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 481153F70D; Tue, 26 Oct 2021 09:02:03 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io, Ard Biesheuvel , Leif Lindholm , Sean Brogan , Bret Barkelew , Michael D Kinney , Liming Gao , Sami Mujawar Subject: [PATCH edk2-platforms v4 3/6] .pytool/Plugin: Add CI plugins Date: Tue, 26 Oct 2021 17:01:38 +0100 Message-Id: <20211026160141.17400-4-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211026160141.17400-1-Pierre.Gondois@arm.com> References: <20211026160141.17400-1-Pierre.Gondois@arm.com> From: Pierre Gondois To enable CI support of the tianocore/edk2-platforms repository, add a .pytool directory containing the following files: - .pytool/CISettings.py - .pytool/Readme.md These files are largely inspired from the same files available in the edk2 repository. The .pytool/Plugin/* files containing the CI tests to run are not copied. edk2-platforms will rely on the edk2basetools python package and on the edk2 python files, as edk2 is imported as a submodule of edk2-platforms. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3509 Change-Id: Ib6cf074a6eda79b522dbd55fca99c2402a5dc13c Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sean Brogan Cc: Bret Barkelew Cc: Michael D Kinney Cc: Liming Gao Cc: Sami Mujawar Signed-off-by: Sami Mujawar Signed-off-by: Pierre Gondois --- Notes: v3: - Remove edk2-platforms's path from $PACKAGES_PATH. [Sean] - Replace Readme's content with a reference to the edk2 repository. [Sean] .pytool/CISettings.py | 184 ++++++++++++++++++++++++++++++++++++++++++ .pytool/Readme.md | 16 ++++ 2 files changed, 200 insertions(+) create mode 100644 .pytool/CISettings.py create mode 100644 .pytool/Readme.md diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py new file mode 100644 index 000000000000..551ec3954058 --- /dev/null +++ b/.pytool/CISettings.py @@ -0,0 +1,184 @@ +# @file +# +# Copyright (c) Microsoft Corporation. +# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.
+# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## +import os +import logging +import edk2basetools + +from edk2toolext.environment import shell_environment +from edk2toolext.invocables.edk2_ci_build import CiBuildSettingsManager +from edk2toolext.invocables.edk2_setup import SetupSettingsManager, RequiredSubmodule +from edk2toolext.invocables.edk2_update import UpdateSettingsManager +from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager +from edk2toollib.utility_functions import GetHostInfo + + +class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManager, PrEvalSettingsManager): + + def __init__(self): + self.ActualPackages = [] + self.ActualTargets = [] + self.ActualArchitectures = [] + self.ActualToolChainTag = "" + self.ActualScopes = None + + # ####################################################################################### # + # Extra CmdLine configuration # + # ####################################################################################### # + + def AddCommandLineOptions(self, parserObj): + pass + def RetrieveCommandLineOptions(self, args): + pass + + # ####################################################################################### # + # Default Support for this Ci Build # + # ####################################################################################### # + + def GetPackagesSupported(self): + ''' return iterable of edk2 packages supported by this build. + These should be edk2 workspace relative paths ''' + return ( + "JunoPkg", + "VExpressPkg" + ) + + def GetArchitecturesSupported(self): + ''' return iterable of edk2 architectures supported by this build ''' + return ( + "IA32", + "X64", + "ARM", + "AARCH64", + "RISCV64") + + def GetTargetsSupported(self): + ''' return iterable of edk2 target tags supported by this build ''' + return ("DEBUG", "RELEASE", "NO-TARGET", "NOOPT") + + # ####################################################################################### # + # Verify and Save requested Ci Build Config # + # ####################################################################################### # + + def SetPackages(self, list_of_requested_packages): + ''' Confirm the requested package list is valid and configure SettingsManager + to build the requested packages. + + Raise UnsupportedException if a requested_package is not supported + ''' + unsupported = set(list_of_requested_packages) - \ + set(self.GetPackagesSupported()) + if(len(unsupported) > 0): + logging.critical( + "Unsupported Package Requested: " + " ".join(unsupported)) + raise Exception("Unsupported Package Requested: " + + " ".join(unsupported)) + self.ActualPackages = list_of_requested_packages + + def SetArchitectures(self, list_of_requested_architectures): + ''' Confirm the requests architecture list is valid and configure SettingsManager + to run only the requested architectures. + + Raise Exception if a list_of_requested_architectures is not supported + ''' + unsupported = set(list_of_requested_architectures) - \ + set(self.GetArchitecturesSupported()) + if(len(unsupported) > 0): + logging.critical( + "Unsupported Architecture Requested: " + " ".join(unsupported)) + raise Exception( + "Unsupported Architecture Requested: " + " ".join(unsupported)) + self.ActualArchitectures = list_of_requested_architectures + + def SetTargets(self, list_of_requested_target): + ''' Confirm the request target list is valid and configure SettingsManager + to run only the requested targets. + + Raise UnsupportedException if a requested_target is not supported + ''' + unsupported = set(list_of_requested_target) - \ + set(self.GetTargetsSupported()) + if(len(unsupported) > 0): + logging.critical( + "Unsupported Targets Requested: " + " ".join(unsupported)) + raise Exception("Unsupported Targets Requested: " + + " ".join(unsupported)) + self.ActualTargets = list_of_requested_target + + # ####################################################################################### # + # Actual Configuration for Ci Build # + # ####################################################################################### # + + def GetActiveScopes(self): + ''' return tuple containing scopes that should be active for this process ''' + if self.ActualScopes is None: + scopes = ("cibuild", "edk2-build", "host-based-test") + + self.ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "") + + is_linux = GetHostInfo().os.upper() == "LINUX" + scopes += ('pipbuild-unix',) if is_linux else ('pipbuild-win',) + + if is_linux and self.ActualToolChainTag.upper().startswith("GCC"): + if "AARCH64" in self.ActualArchitectures: + scopes += ("gcc_aarch64_linux",) + if "ARM" in self.ActualArchitectures: + scopes += ("gcc_arm_linux",) + if "RISCV64" in self.ActualArchitectures: + scopes += ("gcc_riscv64_unknown",) + self.ActualScopes = scopes + return self.ActualScopes + + def GetRequiredSubmodules(self): + ''' return iterable containing RequiredSubmodule objects. + If no RequiredSubmodules return an empty iterable + ''' + rs = [] + rs.append(RequiredSubmodule( + "edk2", True)) + rs.append(RequiredSubmodule( + "Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi", False)) + return rs + + def GetName(self): + return "Edk2-platforms" + + def GetDependencies(self): + return [ + ] + + def GetPackagesPath(self): + ''' Return a list of workspace relative paths that should be mapped as edk2 PackagesPath ''' + edk2_platforms_path = self.GetWorkspaceRoot() + return [ + os.path.join(edk2_platforms_path, "Platform", "ARM"), + os.path.join(edk2_platforms_path, "edk2") + ] + + def GetWorkspaceRoot(self): + ''' get WorkspacePath ''' + return os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + def FilterPackagesToTest(self, changedFilesList: list, potentialPackagesList: list) -> list: + ''' Filter potential packages to test based on changed files. ''' + build_these_packages = [] + possible_packages = potentialPackagesList.copy() + for f in changedFilesList: + # split each part of path for comparison later + nodes = f.split("/") + + # python file change in .pytool folder causes building all + if f.endswith(".py") and ".pytool" in nodes: + build_these_packages = possible_packages + break + + # BaseTools files that might change the build + if "BaseTools" in nodes: + if os.path.splitext(f) not in [".txt", ".md"]: + build_these_packages = possible_packages + break + return build_these_packages diff --git a/.pytool/Readme.md b/.pytool/Readme.md new file mode 100644 index 000000000000..9e59b30043fc --- /dev/null +++ b/.pytool/Readme.md @@ -0,0 +1,16 @@ +# Edk2-platforms Continuous Integration + +## Basic Status + +| Package | Windows VS2019 (IA32/X64)| Ubuntu GCC (IA32/X64/ARM/AARCH64) | Known Issues | +| :---- | :----- | :---- | :--- | +| Platfrom/ARM/JunoPkg | | :heavy_check_mark: | Spell checking in audit mode. CompilerCheck disabled (need a PlatformCI). + +For more detailed status look at the test results of the latest CI run on the +repo readme. + +## Readme + +As the content of the .pytool folder has been imported from the tianocore repository at: +https://github.com/tianocore/edk2 +Please use the Readme.md that can be found there. -- 2.17.1