From 89b8c7d15be54437d84cb4949c4d2fa583d42a1d Mon Sep 17 00:00:00 2001 From: Bob Feng Date: Thu, 3 Feb 2022 11:07:21 +0800 Subject: [PATCH 1/2] AzurePipeline: Add build test to basetools CI Signed-off-by: Bob Feng --- .azurepipelines/Ovmf-Ubuntu-GCC5.yml | 144 +++++++++++++++++ .azurepipelines/Ovmf-Windows-VS2019.yml | 148 ++++++++++++++++++ .azurepipelines/build-ubuntu-gcc5.yml | 28 ++++ .azurepipelines/build-windows-vs2019.yml | 27 ++++ .../templates/basetools-build-steps.yml | 37 +++++ .../templates/platform-build-run-steps.yml | 130 +++++++++++++++ .../templates/pr-gate-build-job.yml | 64 ++++++++ .azurepipelines/templates/pr-gate-steps.yml | 143 +++++++++++++++++ 8 files changed, 721 insertions(+) create mode 100644 .azurepipelines/Ovmf-Ubuntu-GCC5.yml create mode 100644 .azurepipelines/Ovmf-Windows-VS2019.yml create mode 100644 .azurepipelines/build-ubuntu-gcc5.yml create mode 100644 .azurepipelines/build-windows-vs2019.yml create mode 100644 .azurepipelines/templates/basetools-build-steps.yml create mode 100644 .azurepipelines/templates/platform-build-run-steps.yml create mode 100644 .azurepipelines/templates/pr-gate-build-job.yml create mode 100644 .azurepipelines/templates/pr-gate-steps.yml diff --git a/.azurepipelines/Ovmf-Ubuntu-GCC5.yml b/.azurepipelines/Ovmf-Ubuntu-GCC5.yml new file mode 100644 index 00000000..cc99f634 --- /dev/null +++ b/.azurepipelines/Ovmf-Ubuntu-GCC5.yml @@ -0,0 +1,144 @@ +## @file +# Azure Pipeline build file for building a platform. +# +# Platform: OVMF +# OS: Ubuntu +# Toolchain: GCC5 +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +trigger: +- master +- newmaster +pr: +- master +- newmaster + +resources: + repositories: + - repository: edk2 + type: github + endpoint: BobCF + name: BobCF/edk2 + +jobs: + - job: Platform_CI + variables: + package: 'OvmfPkg' + vm_image: 'ubuntu-18.04' + should_run: true + run_flags: "MAKE_STARTUP_NSH=TRUE QEMU_HEADLESS=TRUE" + + #Use matrix to speed up the build process + strategy: + matrix: + OVMF_IA32_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + OVMF_X64_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_X64_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_X64_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + OVMF_IA32X64_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + OVMF_IA32X64_FULL_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM2_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_FULL_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM2_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_FULL_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM2_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + workspace: + clean: all + + pool: + vmImage: $(vm_image) + + steps: + - template: templates/platform-build-run-steps.yml + parameters: + tool_chain_tag: GCC5 + build_pkg: $(package) + build_target: $(Build.Target) + build_arch: $(Build.Arch) + build_file: $(Build.File) + build_flags: $(Build.Flags) + run_flags: $(Run.Flags) + extra_install_step: + - bash: sudo apt-get install qemu + displayName: Install qemu + condition: and(gt(variables.pkg_count, 0), succeeded()) + - bash: sudo apt-get install mtools + displayName: 'Install mtools' diff --git a/.azurepipelines/Ovmf-Windows-VS2019.yml b/.azurepipelines/Ovmf-Windows-VS2019.yml new file mode 100644 index 00000000..853b10e5 --- /dev/null +++ b/.azurepipelines/Ovmf-Windows-VS2019.yml @@ -0,0 +1,148 @@ +## @file +# Azure Pipeline build file for building a platform. +# +# Platform: OVMF +# OS: Windows +# Toolchain: VS2019 +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +trigger: +- master +- newmaster +pr: +- master +- newmaster + +resources: + repositories: + - repository: edk2 + type: github + endpoint: BobCF + name: BobCF/edk2 + +jobs: + - job: Platform_CI + variables: + package: 'OvmfPkg' + vm_image: 'windows-latest' + should_run: true + run_flags: "MAKE_STARTUP_NSH=TRUE QEMU_HEADLESS=TRUE" + + #Use matrix to speed up the build process + strategy: + matrix: + OVMF_IA32_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + OVMF_X64_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_X64_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_X64_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "X64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + OVMF_IA32X64_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_NOOPT: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "" + Build.Target: "NOOPT" + Run.Flags: $(run_flags) + Run: $(should_run) + + OVMF_IA32X64_FULL_DEBUG: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM2_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1" + Build.Target: "DEBUG" + Run.Flags: $(run_flags) + Run: $(should_run) + OVMF_IA32X64_FULL_RELEASE: + Build.File: "edk2/$(package)/PlatformCI/PlatformBuild.py" + Build.Arch: "IA32,X64" + Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM2_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1" + Build.Target: "RELEASE" + Run.Flags: $(run_flags) + Run: $(should_run) + + # This currently creates a very large image which is too big for the FDF declared range + # Ovmf maintainers suggest to skip this build for now. + # + # OVMF_IA32X64_FULL_NOOPT: + # Build.File: "$(package)/PlatformCI/PlatformBuild.py" + # Build.Arch: "IA32,X64" + # Build.Flags: "BLD_*_SECURE_BOOT_ENABLE=1 BLD_*_SMM_REQUIRE=1 BLD_*_TPM2_ENABLE=1 BLD_*_NETWORK_TLS_ENABLE=1 BLD_*_NETWORK_IP6_ENABLE=1 BLD_*_NETWORK_HTTP_BOOT_ENABLE=1" + # Build.Target: "NOOPT" + # Run.Flags: $(run_flags) + # Run: $(should_run) + + workspace: + clean: all + + pool: + vmImage: $(vm_image) + + steps: + - template: templates/platform-build-run-steps.yml + parameters: + tool_chain_tag: VS2019 + build_pkg: $(package) + build_target: $(Build.Target) + build_arch: $(Build.Arch) + build_file: $(Build.File) + build_flags: $(Build.Flags) + run_flags: $(Run.Flags) + extra_install_step: + - powershell: choco install qemu --version=2021.5.5; Write-Host "##vso[task.prependpath]c:\Program Files\qemu" + displayName: Install QEMU and Set QEMU on path # friendly name displayed in the UI + condition: and(gt(variables.pkg_count, 0), succeeded()) + diff --git a/.azurepipelines/build-ubuntu-gcc5.yml b/.azurepipelines/build-ubuntu-gcc5.yml new file mode 100644 index 00000000..3fc55ef4 --- /dev/null +++ b/.azurepipelines/build-ubuntu-gcc5.yml @@ -0,0 +1,28 @@ +## @file +# Azure Pipeline build file for a build using ubuntu and GCC5 +# +# Copyright (c) Microsoft Corporation. +# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## +trigger: +- master +- newmaster +pr: +- master +- newmaster + +resources: + repositories: + - repository: edk2 + type: github + endpoint: BobCF + name: BobCF/edk2 + +jobs: +- template: templates/pr-gate-build-job.yml + parameters: + tool_chain_tag: 'GCC5' + vm_image: 'ubuntu-latest' + arch_list: "IA32,X64,ARM,AARCH64,RISCV64" + diff --git a/.azurepipelines/build-windows-vs2019.yml b/.azurepipelines/build-windows-vs2019.yml new file mode 100644 index 00000000..cbf1d286 --- /dev/null +++ b/.azurepipelines/build-windows-vs2019.yml @@ -0,0 +1,27 @@ +## @file +# Azure Pipeline build file for a build using Windows and VS2019 +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +trigger: +- master +- newmaster + +pr: +- master +- newmaster + +resources: + repositories: + - repository: edk2 + type: github + endpoint: BobCF + name: BobCF/edk2 + +jobs: +- template: templates/pr-gate-build-job.yml + parameters: + tool_chain_tag: 'VS2019' + vm_image: 'windows-latest' + arch_list: "IA32,X64" diff --git a/.azurepipelines/templates/basetools-build-steps.yml b/.azurepipelines/templates/basetools-build-steps.yml new file mode 100644 index 00000000..34d231dc --- /dev/null +++ b/.azurepipelines/templates/basetools-build-steps.yml @@ -0,0 +1,37 @@ +## @file +# File templates/basetools-build-job.yml +# +# template file to build basetools +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +parameters: + tool_chain_tag: '' + +steps: +- ${{ if contains(parameters.tool_chain_tag, 'GCC') }}: + - bash: sudo apt-get update + displayName: Update apt + condition: and(gt(variables.pkg_count, 0), succeeded()) + + - bash: sudo apt-get install gcc g++ make uuid-dev + displayName: Install required tools + condition: and(gt(variables.pkg_count, 0), succeeded()) + +- task: CmdLine@1 + displayName: Build Base Tools from source + inputs: + filename: python + arguments: edk2/BaseTools/Edk2ToolsBuild.py -t ${{ parameters.tool_chain_tag }} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +- task: CopyFiles@2 + displayName: "Copy base tools build log" + inputs: + targetFolder: '$(Build.ArtifactStagingDirectory)' + SourceFolder: 'edk2/BaseTools/BaseToolsBuild' + contents: | + BASETOOLS_BUILD*.* + flattenFolders: true + condition: and(gt(variables.pkg_count, 0), succeededOrFailed()) diff --git a/.azurepipelines/templates/platform-build-run-steps.yml b/.azurepipelines/templates/platform-build-run-steps.yml new file mode 100644 index 00000000..1e078c21 --- /dev/null +++ b/.azurepipelines/templates/platform-build-run-steps.yml @@ -0,0 +1,130 @@ + +## @file +# File steps.yml +# +# template file containing the steps to build +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +parameters: +- name: tool_chain_tag + type: string + default: '' +- name: build_pkg + type: string + default: '' +- name: build_target + type: string + default: '' +- name: build_arch + type: string + default: '' +- name: build_file + type: string + default: '' +- name: build_flags + type: string + default: '' +- name: run_flags + type: string + default: '' + +- name: extra_install_step + type: stepList + default: [] + +steps: +- checkout: self +- checkout: edk2 + clean: true + fetchDepth: 1 + +- task: UsePythonVersion@0 + inputs: + versionSpec: "3.8.x" + architecture: "x64" + +- script: pip install -r edk2/pip-requirements.txt --upgrade + displayName: 'Install/Upgrade pip modules' + +- script: pip install -e edk2-basetools --upgrade + displayName: 'Install/Upgrade basetools pip modules' + +# Set default +- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}" + + # Setup repo +- task: CmdLine@1 + displayName: Setup + inputs: + filename: stuart_setup + arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +# Stuart Update +- task: CmdLine@1 + displayName: Update + inputs: + filename: stuart_update + arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +# build basetools +# do this after setup and update so that code base dependencies +# are all resolved. +- template: basetools-build-steps.yml + parameters: + tool_chain_tag: ${{ parameters.tool_chain_tag }} + +# Potential Extra steps +- ${{ parameters.extra_install_step }} + +# Build +- task: CmdLine@1 + displayName: Build + inputs: + filename: stuart_build + arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +# Run +- task: CmdLine@1 + displayName: Run to shell + inputs: + filename: stuart_build + arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} ${{ parameters.run_flags }} --FlashOnly + condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables['Run'], true)) + timeoutInMinutes: 1 + +# Copy the build logs to the artifact staging directory +- task: CopyFiles@2 + displayName: "Copy build logs" + inputs: + targetFolder: "$(Build.ArtifactStagingDirectory)" + SourceFolder: "edk2/Build" + contents: | + BUILDLOG_*.txt + BUILDLOG_*.md + CI_*.txt + CI_*.md + CISETUP.txt + SETUPLOG.txt + UPDATE_LOG.txt + PREVALLOG.txt + TestSuites.xml + **/BUILD_TOOLS_REPORT.html + **/OVERRIDELOG.TXT + BASETOOLS_BUILD*.* + flattenFolders: true + condition: succeededOrFailed() + +# Publish build artifacts to Azure Artifacts/TFS or a file share +- task: PublishBuildArtifacts@1 + continueOnError: true + displayName: "Publish build logs" + inputs: + pathtoPublish: "$(Build.ArtifactStagingDirectory)" + artifactName: "Build Logs $(System.JobName)" + condition: succeededOrFailed() diff --git a/.azurepipelines/templates/pr-gate-build-job.yml b/.azurepipelines/templates/pr-gate-build-job.yml new file mode 100644 index 00000000..85a5162e --- /dev/null +++ b/.azurepipelines/templates/pr-gate-build-job.yml @@ -0,0 +1,64 @@ +## @file +# File templates/pr-gate-build-job.yml +# +# template file used to build supported packages. +# +# Copyright (c) Microsoft Corporation. +# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +parameters: + tool_chain_tag: '' + vm_image: '' + arch_list: '' + +# Build step +jobs: + +- job: Build_${{ parameters.tool_chain_tag }} + timeoutInMinutes: 120 + #Use matrix to speed up the build process + strategy: + matrix: + TARGET_MDE_CPU: + Build.Pkgs: 'MdePkg,UefiCpuPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT' + TARGET_MDEMODULE_DEBUG: + Build.Pkgs: 'MdeModulePkg' + Build.Targets: 'DEBUG,NOOPT' + TARGET_MDEMODULE_RELEASE: + Build.Pkgs: 'MdeModulePkg' + Build.Targets: 'RELEASE,NO-TARGET' + TARGET_NETWORK: + Build.Pkgs: 'NetworkPkg,RedfishPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET' + TARGET_OTHER: + Build.Pkgs: 'PcAtChipsetPkg,ShellPkg,StandaloneMmPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET' + TARGET_FMP_FAT_TEST: + Build.Pkgs: 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg,DynamicTablesPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT' + TARGET_CRYPTO: + Build.Pkgs: 'CryptoPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT' + TARGET_SECURITY: + Build.Pkgs: 'SecurityPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET' + TARGET_UEFIPAYLOAD: + Build.Pkgs: 'UefiPayloadPkg' + Build.Targets: 'DEBUG,RELEASE,NO-TARGET' + + workspace: + clean: all + + pool: + vmImage: ${{ parameters.vm_image }} + + steps: + - template: pr-gate-steps.yml + parameters: + tool_chain_tag: ${{ parameters.tool_chain_tag }} + build_pkgs: $(Build.Pkgs) + build_targets: $(Build.Targets) + build_archs: ${{ parameters.arch_list }} diff --git a/.azurepipelines/templates/pr-gate-steps.yml b/.azurepipelines/templates/pr-gate-steps.yml new file mode 100644 index 00000000..8eb0dcbe --- /dev/null +++ b/.azurepipelines/templates/pr-gate-steps.yml @@ -0,0 +1,143 @@ +## @file +# File templates/pr-gate-steps.yml +# +# template file containing the steps to build +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + + +parameters: + tool_chain_tag: '' + build_pkgs: '' + build_targets: '' + build_archs: '' + +steps: +- checkout: self +- checkout: edk2 + clean: true + fetchDepth: 1 + +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.8.x' + architecture: 'x64' + +- script: pip install -r edk2/pip-requirements.txt --upgrade + displayName: 'Install/Upgrade pip modules' + +- script: pip install -e edk2-basetools --upgrade + displayName: 'Install/Upgrade basetools pip modules' + +# Set default +- bash: | + echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}" + echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}" + +# Fetch the target branch so that pr_eval can diff them. +# Seems like azure pipelines/github changed checkout process in nov 2020. +- script: git fetch origin $(System.PullRequest.targetBranch) + displayName: fetch target branch + condition: eq(variables['Build.Reason'], 'PullRequest') + +# trim the package list if this is a PR +- task: CmdLine@1 + displayName: Check if ${{ parameters.build_pkgs }} need testing + inputs: + filename: stuart_pr_eval + arguments: -c edk2/.pytool/CISettings.py -p ${{ parameters.build_pkgs }} --pr-target origin/$(System.PullRequest.targetBranch) --output-csv-format-string "##vso[task.setvariable variable=pkgs_to_build;isOutpout=true]{pkgcsv}" --output-count-format-string "##vso[task.setvariable variable=pkg_count;isOutpout=true]{pkgcount}" + condition: eq(variables['Build.Reason'], 'PullRequest') + +# install spell check prereqs +#- template: spell-check-prereq-steps.yml + +# Build repo +- task: CmdLine@1 + displayName: Setup ${{ parameters.build_pkgs }} ${{ parameters.build_archs}} + inputs: + filename: stuart_setup + arguments: -c edk2/.pytool/CISettings.py -p $(pkgs_to_build) -t ${{ parameters.build_targets}} -a ${{ parameters.build_archs}} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +- task: CmdLine@1 + displayName: Update ${{ parameters.build_pkgs }} ${{ parameters.build_archs}} + inputs: + filename: stuart_update + arguments: -c edk2/.pytool/CISettings.py -p $(pkgs_to_build) -t ${{ parameters.build_targets}} -a ${{ parameters.build_archs}} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +# build basetools +# do this after setup and update so that code base dependencies +# are all resolved. +- template: basetools-build-steps.yml + parameters: + tool_chain_tag: ${{ parameters.tool_chain_tag }} + +- task: CmdLine@1 + displayName: Build and Test ${{ parameters.build_pkgs }} ${{ parameters.build_archs}} + inputs: + filename: stuart_ci_build + arguments: -c edk2/.pytool/CISettings.py -p $(pkgs_to_build) -t ${{ parameters.build_targets}} -a ${{ parameters.build_archs}} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} + condition: and(gt(variables.pkg_count, 0), succeeded()) + +# Publish Test Results to Azure Pipelines/TFS +- task: PublishTestResults@2 + displayName: 'Publish junit test results' + continueOnError: true + condition: and( succeededOrFailed(),gt(variables.pkg_count, 0)) + inputs: + testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit + testResultsFiles: 'edk2/Build/TestSuites.xml' + #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional + mergeTestResults: true # Optional + testRunTitle: $(System.JobName) # Optional + #buildPlatform: # Optional + #buildConfiguration: # Optional + publishRunAttachments: true # Optional + +# Publish Test Results to Azure Pipelines/TFS +- task: PublishTestResults@2 + displayName: 'Publish host based test results for $(System.JobName)' + continueOnError: true + condition: and( succeededOrFailed(), gt(variables.pkg_count, 0)) + inputs: + testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit + testResultsFiles: 'edk2/Build/**/*.result.xml' + #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional + mergeTestResults: false # Optional + testRunTitle: ${{ parameters.build_pkgs }} # Optional + #buildPlatform: # Optional + #buildConfiguration: # Optional + publishRunAttachments: true # Optional + +# Copy the build logs to the artifact staging directory +- task: CopyFiles@2 + displayName: "Copy build logs" + inputs: + targetFolder: '$(Build.ArtifactStagingDirectory)' + SourceFolder: 'edk2/Build' + contents: | + BUILDLOG_*.txt + BUILDLOG_*.md + CI_*.txt + CI_*.md + CISETUP.txt + SETUPLOG.txt + UPDATE_LOG.txt + PREVALLOG.txt + TestSuites.xml + **/BUILD_TOOLS_REPORT.html + **/OVERRIDELOG.TXT + flattenFolders: true + condition: succeededOrFailed() + +# Publish build artifacts to Azure Artifacts/TFS or a file share +- task: PublishBuildArtifacts@1 + continueOnError: true + displayName: "Publish build logs" + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: 'Build Logs $(System.JobName)' + condition: succeededOrFailed() From 27fc4fe7d6f42867e17a838d363a84c07ecfe6c3 Mon Sep 17 00:00:00 2001 From: Bob Feng Date: Mon, 7 Feb 2022 12:27:59 +0800 Subject: [PATCH 2/2] ReadMe: Add CI Status Badge Signed-off-by: Bob Feng --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index 6211a468..6ff16556 100644 --- a/readme.md +++ b/readme.md @@ -3,6 +3,14 @@ This is a Tianocore maintained project consisting of a the python source files that make up EDK2 basetools. This package's intent is to provide an easy way to organize and share python code to facilitate reuse across environments, tools, and scripts. Inclusion of this package and dependency management is best managed using Pip/Pypi. This is a fundamental package and is required to be used for edk2 builds. +## CI Build Status +| Host Type & Toolchain | Build Status | +| --------------------- | ------------ | +| Windows_VS2019_ | [![Build Status](https://dev.azure.com/bobcfeng/edk2-bob/_apis/build/status/BobCF.edk2-basetools-vs2019-build?repoName=BobCF%2Fedk2-basetools&branchName=newmaster)](https://dev.azure.com/bobcfeng/edk2-bob/_build/latest?definitionId=9&repoName=BobCF%2Fedk2-basetools&branchName=newmaster) | +| Ubuntu_GCC5_ | [![Build Status](https://dev.azure.com/bobcfeng/edk2-bob/_apis/build/status/BobCF.edk2-basetools-gcc-build?repoName=BobCF%2Fedk2-basetools&branchName=newmaster)](https://dev.azure.com/bobcfeng/edk2-bob/_build/latest?definitionId=10&repoName=BobCF%2Fedk2-basetools&branchName=newmaster) | +| OvmfPkg_Win_VS2019_ |[![Build Status](https://dev.azure.com/bobcfeng/edk2-bob/_apis/build/status/BobCF.edk2-basetools-ovmf-vs2019?repoName=BobCF%2Fedk2-basetools&branchName=newmaster)](https://dev.azure.com/bobcfeng/edk2-bob/_build/latest?definitionId=11&repoName=BobCF%2Fedk2-basetools&branchName=newmaster)| +|OvmfPkg_Ubuntu_GCC5_|[![Build Status](https://dev.azure.com/bobcfeng/edk2-bob/_apis/build/status/BobCF.edk2-basetools-ovmf-gcc?repoName=BobCF%2Fedk2-basetools&branchName=newmaster)](https://dev.azure.com/bobcfeng/edk2-bob/_build/latest?definitionId=12&repoName=BobCF%2Fedk2-basetools&branchName=newmaster)| + ## How to use it