Skip to content

Commit

Permalink
Add files to support the Repo and CI Build
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeytdisco committed Jan 23, 2023
1 parent fa09333 commit bdd51c2
Show file tree
Hide file tree
Showing 11 changed files with 543 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .azurepipelines/Matrix-Build-Job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## @file
# Template file for generating a build job matrix for the packages currently supported for
# build in Mu Plus.
#
# Copyright (c) Microsoft Corporation.
# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

parameters:
- name: arch_list
displayName: Architectures (e.g. IA32, X64)
type: string
default: ''
- name: extra_build_args
displayName: Extra Build Command Arguments
type: string
default: ''
- name: extra_install_step
displayName: Extra Install Steps
type: stepList
default:
- script: echo No extra steps provided
- name: tool_chain_tag
displayName: Tool Chain (e.g. VS2022)
type: string
default: ''
- name: vm_image
displayName: Virtual Machine Image (e.g. windows-latest)
type: string
default: 'windows-latest'

jobs:

- job: Build
timeoutInMinutes: 120
# Use matrix to speed up the build process
strategy:
matrix:
TARGET_DFCI:
Build.Pkgs: 'DfciPkg'
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
TARGET_ZERO:
Build.Pkgs: 'ZeroTouchPkg'
Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'

workspace:
clean: all

pool:
vmImage: ${{ parameters.vm_image }}

steps:
- template: Steps/PrGate.yml@mu_devops
parameters:
build_archs: ${{ parameters.arch_list }}
build_pkgs: $(Build.Pkgs)
build_targets: $(Build.Targets)
do_ci_build: true
do_ci_setup: true
do_non_ci_build: false
do_non_ci_setup: true
do_pr_eval: true
extra_build_args: ${{ parameters.extra_build_args }}
extra_install_step: ${{ parameters.extra_install_step }}
tool_chain_tag: ${{ parameters.tool_chain_tag }}
32 changes: 32 additions & 0 deletions .azurepipelines/Ubuntu-GCC5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## @file
# Azure Pipeline build file for a build using Ubuntu and GCC.
#
# Copyright (c) Microsoft Corporation.
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

resources:
repositories:
- repository: mu_devops
type: github
endpoint: microsoft
name: microsoft/mu_devops
ref: main

variables:
- group: architectures-arm-64-x86-64
- group: tool-chain-ubuntu-gcc

jobs:
- template: Matrix-Build-Job.yml
parameters:
arch_list: $(arch_list)
extra_build_args: CODE_COVERAGE=TRUE CC_HTML=TRUE
extra_install_step:
- script: |
sudo apt-get install -y mingw-w64 lcov
pip install lcov_cobertura pycobertura
displayName: Install Windows Resource Compiler for Linux & Code Coverage Tools
tool_chain_tag: $(tool_chain_tag)
vm_image: $(vm_image)
26 changes: 26 additions & 0 deletions .azurepipelines/Windows-VS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## @file
# Azure Pipeline build file for a build using Windows and the latest Visual Studio toolchain supported.
#
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

resources:
repositories:
- repository: mu_devops
type: github
endpoint: microsoft
name: microsoft/mu_devops
ref: main

variables:
- group: architectures-x86-64
- group: tool-chain-windows-visual-studio-latest

jobs:
- template: Matrix-Build-Job.yml
parameters:
arch_list: $(arch_list)
tool_chain_tag: $(tool_chain_tag)
vm_image: $(vm_image)

8 changes: 8 additions & 0 deletions .config/CredScanSuppressions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"suppressions": [
{
"file": "DfciPkg/UnitTests/DfciTests/Certs",
"_justification": "Test case test certificates."
}
]
}
14 changes: 14 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## @file
# markdownlint configuration
#
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

# Rules can be found here: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
# Config info: https://github.com/DavidAnson/markdownlint#configuration
{
"default": true,
"MD013": {"line_length": 120, "code_blocks": false, "tables": false},
"MD033": {"allowed_elements": ["br"]}
}
11 changes: 11 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ignore build directory
/Build/

# Ignore external dependencies
*_extdep/

# Ignore cloned dependencies
/Common/MU_TIANO
/Silicon/Arm/MU_TIANO
/Silicon/Intel/MU_TIANO
/MU_BASECORE
204 changes: 204 additions & 0 deletions .pytool/CISettings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
# @file
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import os
import logging
from edk2toolext.environment import shell_environment
from edk2toolext.invocables.edk2_ci_build import CiBuildSettingsManager
from edk2toolext.invocables.edk2_ci_setup import CiSetupSettingsManager
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(CiSetupSettingsManager, CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManager, PrEvalSettingsManager):

def __init__(self):
self.ActualPackages = []
self.ActualTargets = []
self.ActualArchitectures = []
self.ActualToolChainTag = ""
self.UseBuiltInBaseTools = None
self.ActualScopes = None

# ####################################################################################### #
# Extra CmdLine configuration #
# ####################################################################################### #

def AddCommandLineOptions(self, parserObj):
group = parserObj.add_mutually_exclusive_group()
group.add_argument("-force_piptools", "--fpt", dest="force_piptools", action="store_true", default=False, help="Force the system to use pip tools")
group.add_argument("-no_piptools", "--npt", dest="no_piptools", action="store_true", default=False, help="Force the system to not use pip tools")

def RetrieveCommandLineOptions(self, args):
super().RetrieveCommandLineOptions(args)
if args.force_piptools:
self.UseBuiltInBaseTools = True
if args.no_piptools:
self.UseBuiltInBaseTools = False

# ####################################################################################### #
# 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 (
"DfciPkg",
"ZeroTouchPkg"
)

def GetArchitecturesSupported(self):
''' return iterable of edk2 architectures supported by this build '''
return ("IA32",
"X64",
"ARM",
"AARCH64")

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"

if self.UseBuiltInBaseTools is None:
is_linux = GetHostInfo().os.upper() == "LINUX"
# try and import the pip module for basetools
try:
import edk2basetools
self.UseBuiltInBaseTools = True
except ImportError:
self.UseBuiltInBaseTools = False
pass

if self.UseBuiltInBaseTools == True:
scopes += ('pipbuild-unix',) if is_linux else ('pipbuild-win',)
logging.warning("Using Pip Tools based BaseTools")
else:
logging.warning("Falling back to using in-tree BaseTools")

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 = []
return rs

def GetName(self):
return "MuFeatureDfci"

def GetDependencies(self):
''' Return Git Repository Dependencies
Return an iterable of dictionary objects with the following fields
{
Path: <required> Workspace relative path
Url: <required> Url of git repo
Commit: <optional> Commit to checkout of repo
Branch: <optional> Branch to checkout (will checkout most recent commit in branch)
Full: <optional> Boolean to do shallow or Full checkout. (default is False)
ReferencePath: <optional> Workspace relative path to git repo to use as "reference"
}
'''
return [
{
"Path": "MU_BASECORE",
"Url": "https://github.com/microsoft/mu_basecore.git",
"Branch": "release/202208"
},
{
"Path": "Common/MU",
"Url": "https://github.com/microsoft/mu_plus.git",
"Branch": "release/202208"
},
]

def GetPackagesPath(self):
''' Return a list of workspace relative paths that should be mapped as edk2 PackagesPath '''
result = []
for a in self.GetDependencies():
result.append(a["Path"])
return result

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. '''
return []
9 changes: 9 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
Loading

0 comments on commit bdd51c2

Please sign in to comment.