platform-build-run-steps.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ## @file
  2. # File steps.yml
  3. #
  4. # template file containing the steps to build
  5. #
  6. # Copyright (c) Microsoft Corporation.
  7. # SPDX-License-Identifier: BSD-2-Clause-Patent
  8. ##
  9. parameters:
  10. - name: tool_chain_tag
  11. type: string
  12. default: ''
  13. - name: build_pkg
  14. type: string
  15. default: ''
  16. - name: build_target
  17. type: string
  18. default: ''
  19. - name: build_arch
  20. type: string
  21. default: ''
  22. - name: build_file
  23. type: string
  24. default: ''
  25. - name: build_flags
  26. type: string
  27. default: ''
  28. - name: run_flags
  29. type: string
  30. default: ''
  31. - name: extra_install_step
  32. type: stepList
  33. default: []
  34. steps:
  35. - checkout: self
  36. clean: true
  37. fetchDepth: 1
  38. - task: UsePythonVersion@0
  39. inputs:
  40. versionSpec: ">=3.10.6"
  41. architecture: "x64"
  42. - script: pip install -r pip-requirements.txt --upgrade
  43. displayName: 'Install/Upgrade pip modules'
  44. # Set default
  45. - bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
  46. # Fetch the target branch so that pr_eval can diff them.
  47. # Seems like azure pipelines/github changed checkout process in nov 2020.
  48. - script: git fetch origin $(System.PullRequest.targetBranch)
  49. displayName: fetch target branch
  50. condition: eq(variables['Build.Reason'], 'PullRequest')
  51. # trim the package list if this is a PR
  52. - task: CmdLine@1
  53. displayName: Check if ${{ parameters.build_pkg }} need testing
  54. inputs:
  55. filename: stuart_pr_eval
  56. 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}"
  57. condition: eq(variables['Build.Reason'], 'PullRequest')
  58. # Setup repo
  59. - task: CmdLine@1
  60. displayName: Setup
  61. inputs:
  62. filename: stuart_setup
  63. arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
  64. condition: and(gt(variables.pkg_count, 0), succeeded())
  65. # Stuart Update
  66. - task: CmdLine@1
  67. displayName: Update
  68. inputs:
  69. filename: stuart_update
  70. arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
  71. condition: and(gt(variables.pkg_count, 0), succeeded())
  72. # build basetools
  73. # do this after setup and update so that code base dependencies
  74. # are all resolved.
  75. - template: basetools-build-steps.yml
  76. parameters:
  77. tool_chain_tag: ${{ parameters.tool_chain_tag }}
  78. # Potential Extra steps
  79. - ${{ parameters.extra_install_step }}
  80. # Build
  81. - task: CmdLine@1
  82. displayName: Build
  83. inputs:
  84. filename: stuart_build
  85. arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
  86. condition: and(gt(variables.pkg_count, 0), succeeded())
  87. # Run
  88. - task: CmdLine@1
  89. displayName: Run to shell
  90. inputs:
  91. filename: stuart_build
  92. 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
  93. condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables['Run'], true))
  94. timeoutInMinutes: 1
  95. # Copy the build logs to the artifact staging directory
  96. - task: CopyFiles@2
  97. displayName: "Copy build logs"
  98. inputs:
  99. targetFolder: "$(Build.ArtifactStagingDirectory)"
  100. SourceFolder: "Build"
  101. contents: |
  102. BUILDLOG_*.txt
  103. BUILDLOG_*.md
  104. CI_*.txt
  105. CI_*.md
  106. CISETUP.txt
  107. SETUPLOG.txt
  108. UPDATE_LOG.txt
  109. PREVALLOG.txt
  110. TestSuites.xml
  111. **/BUILD_TOOLS_REPORT.html
  112. **/OVERRIDELOG.TXT
  113. BASETOOLS_BUILD*.*
  114. flattenFolders: true
  115. condition: succeededOrFailed()
  116. # Publish build artifacts to Azure Artifacts/TFS or a file share
  117. - task: PublishBuildArtifacts@1
  118. continueOnError: true
  119. displayName: "Publish build logs"
  120. inputs:
  121. pathtoPublish: "$(Build.ArtifactStagingDirectory)"
  122. artifactName: "Build Logs $(System.JobName)"
  123. condition: succeededOrFailed()