]> git.proxmox.com Git - mirror_edk2.git/blobdiff - .azurepipelines/templates/platform-build-run-steps.yml
.azurepipelines: Add Platform CI template
[mirror_edk2.git] / .azurepipelines / templates / platform-build-run-steps.yml
diff --git a/.azurepipelines/templates/platform-build-run-steps.yml b/.azurepipelines/templates/platform-build-run-steps.yml
new file mode 100644 (file)
index 0000000..ebf674b
--- /dev/null
@@ -0,0 +1,134 @@
+\r
+## @file\r
+# File steps.yml\r
+#\r
+# template file containing the steps to build\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+\r
+parameters:\r
+- name: tool_chain_tag\r
+  type: string\r
+  default: ''\r
+- name: build_pkg\r
+  type: string\r
+  default: ''\r
+- name: build_target\r
+  type: string\r
+  default: ''\r
+- name: build_arch\r
+  type: string\r
+  default: ''\r
+- name: build_file\r
+  type: string\r
+  default: ''\r
+- name: build_flags\r
+  type: string\r
+  default: ''\r
+- name: run_flags\r
+  type: string\r
+  default: ''\r
+\r
+- name: extra_install_step\r
+  type: stepList\r
+  default: []\r
+\r
+steps:\r
+- checkout: self\r
+  clean: true\r
+  fetchDepth: 1\r
+\r
+- task: UsePythonVersion@0\r
+  inputs:\r
+    versionSpec: "3.8.x"\r
+    architecture: "x64"\r
+\r
+- script: pip install -r pip-requirements.txt --upgrade\r
+  displayName: 'Install/Upgrade pip modules'\r
+\r
+# Set default\r
+- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"\r
+\r
+# trim the package list if this is a PR\r
+- task: CmdLine@1\r
+  displayName: Check if ${{ parameters.build_pkg }} need testing\r
+  inputs:\r
+    filename: stuart_pr_eval\r
+    arguments: -c ${{ parameters.build_file }} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} --pr-target origin/$(System.PullRequest.targetBranch) --output-count-format-string "##vso[task.setvariable variable=pkg_count;isOutpout=true]{pkgcount}"\r
+  condition: eq(variables['Build.Reason'], 'PullRequest')\r
+\r
+ # Setup repo\r
+- task: CmdLine@1\r
+  displayName: Setup\r
+  inputs:\r
+    filename: stuart_setup\r
+    arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}\r
+  condition: and(gt(variables.pkg_count, 0), succeeded())\r
+\r
+# Stuart Update\r
+- task: CmdLine@1\r
+  displayName: Update\r
+  inputs:\r
+    filename: stuart_update\r
+    arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}\r
+  condition: and(gt(variables.pkg_count, 0), succeeded())\r
+\r
+# build basetools\r
+#   do this after setup and update so that code base dependencies\r
+#   are all resolved.\r
+- template: basetools-build-steps.yml\r
+  parameters:\r
+    tool_chain_tag: ${{ parameters.tool_chain_tag }}\r
+\r
+# Potential Extra steps\r
+- ${{ parameters.extra_install_step }}\r
+\r
+# Build\r
+- task: CmdLine@1\r
+  displayName: Build\r
+  inputs:\r
+    filename: stuart_build\r
+    arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}\r
+  condition: and(gt(variables.pkg_count, 0), succeeded())\r
+\r
+# Run\r
+- task: CmdLine@1\r
+  displayName: Run to shell\r
+  inputs:\r
+    filename: stuart_build\r
+    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\r
+  condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables['Run'], true))\r
+  timeoutInMinutes: 1\r
+\r
+# Copy the build logs to the artifact staging directory\r
+- task: CopyFiles@2\r
+  displayName: "Copy build logs"\r
+  inputs:\r
+    targetFolder: "$(Build.ArtifactStagingDirectory)"\r
+    SourceFolder: "Build"\r
+    contents: |\r
+      BUILDLOG_*.txt\r
+      BUILDLOG_*.md\r
+      CI_*.txt\r
+      CI_*.md\r
+      CISETUP.txt\r
+      SETUPLOG.txt\r
+      UPDATE_LOG.txt\r
+      PREVALLOG.txt\r
+      TestSuites.xml\r
+      **/BUILD_TOOLS_REPORT.html\r
+      **/OVERRIDELOG.TXT\r
+      BASETOOLS_BUILD*.*\r
+    flattenFolders: true\r
+  condition: succeededOrFailed()\r
+\r
+# Publish build artifacts to Azure Artifacts/TFS or a file share\r
+- task: PublishBuildArtifacts@1\r
+  continueOnError: true\r
+  displayName: "Publish build logs"\r
+  inputs:\r
+    pathtoPublish: "$(Build.ArtifactStagingDirectory)"\r
+    artifactName: "Build Logs $(System.JobName)"\r
+  condition: succeededOrFailed()\r