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.web11.7416.1637157959595416531 for ; Wed, 17 Nov 2021 06:05:59 -0800 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 4473C11B3; Wed, 17 Nov 2021 06:05:59 -0800 (PST) Received: from e120189.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4D88E3F70D; Wed, 17 Nov 2021 06:05:57 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sean Brogan , Bret Barkelew , Michael D Kinney , Liming Gao , Sami Mujawar Subject: [PATCH edk2-platforms v6 3/6] .pytool/Plugin: Add CI plugins Date: Wed, 17 Nov 2021 14:05:25 +0000 Message-Id: <20211117140528.13600-4-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211117140528.13600-1-Pierre.Gondois@arm.com> References: <20211117140528.13600-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 Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sean Brogan Cc: Bret Barkelew Cc: Michael D Kinney Cc: Liming Gao Cc: Sami Mujawar Co-authored-by: Sami Mujawar Signed-off-by: Pierre Gondois --- .pytool/CISettings.py | 186 ++++++++++++++++++++++++++++++++++++++++++ .pytool/Readme.md | 30 +++++++ 2 files changed, 216 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..6435c60a4bc5 --- /dev/null +++ b/.pytool/CISettings.py @@ -0,0 +1,186 @@ +# @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-platforms packages supported by this build. + These should be edk2-platforms workspace relative paths ''' + return ( + "JunoPkg", + "VExpressPkg" + ) + + def GetArchitecturesSupported(self): + ''' return iterable of edk2-platforms architectures supported by this build ''' + return ( + "IA32", + "X64", + "ARM", + "AARCH64", + "RISCV64") + + def GetTargetsSupported(self): + ''' return iterable of edk2-platforms 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",) + + # If EDK2_REPO is not provided, download it. + if not shell_environment.GetBuildVars().GetValue("EDK2_REPO", ""): + scopes += ("edk2-repo",) + + 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( + "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-platforms PackagesPath ''' + packages = [] + + edk2_repo = shell_environment.GetBuildVars().GetValue("EDK2_REPO", "") + if not edk2_repo: + edk2_repo = os.path.join("edk2_extdep", "edk2") + packages.append(edk2_repo) + + packages.append(os.path.join("Platform", "ARM")) + return packages + + 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 + + return build_these_packages diff --git a/.pytool/Readme.md b/.pytool/Readme.md new file mode 100644 index 000000000000..b084ff642b2f --- /dev/null +++ b/.pytool/Readme.md @@ -0,0 +1,30 @@ +# 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. + +## edk2 dependency + +It is possible that the edk2-platforms repository relies on new modifications +in the edk2 repository. The edk2-platforms CI fetches the edk2 repository +via the edk2_ext_dep.yaml. The edk2 repository is hence treated as an external +dependency. +To use a custom edk2 repository: +- Place it inside the edk2-platforms folder +- Run the stuart_[update|build] commands with EDK2_REPO pointing to your + custom edk2 repository. +E.g.: +stuart_update -c .pytool/CISettings.py EDK2_REPO=./my_edk2_repo` +stuart_ci_build -c .pytool/CISettings.py EDK2_REPO=./my_edk2_repo` + +## 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