microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/OneBranch.PullRequest.yml
140lines · modecode
| 1 | ################################################################################# |
| 2 | # OneBranch Pipelines - Official # |
| 3 | # This pipeline was created by EasyStart from a sample located at: # |
| 4 | # https://aka.ms/obpipelines/easystart/samples # |
| 5 | # Documentation: https://aka.ms/obpipelines # |
| 6 | # Yaml Schema: https://aka.ms/obpipelines/yaml/schema # |
| 7 | # Retail Tasks: https://aka.ms/obpipelines/tasks # |
| 8 | # Support: https://aka.ms/onebranchsup # |
| 9 | ################################################################################# |
| 10 | |
| 11 | trigger: none |
| 12 | |
| 13 | parameters: # parameters are shown up in ADO UI in a build queue time |
| 14 | - name: 'debug' |
| 15 | displayName: 'Enable debug output' |
| 16 | type: boolean |
| 17 | default: false |
| 18 | |
| 19 | - name: BuildAzureOp |
| 20 | displayName: 'Build and test AzureEP ops' |
| 21 | type: string |
| 22 | values: |
| 23 | - '0' |
| 24 | - '1' |
| 25 | default: '0' |
| 26 | |
| 27 | variables: |
| 28 | CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] |
| 29 | system.debug: ${{ parameters.debug }} |
| 30 | ENABLE_PRS_DELAYSIGN: 1 |
| 31 | ROOT: $(Build.SourcesDirectory) |
| 32 | REPOROOT: $(Build.SourcesDirectory) |
| 33 | OUTPUTROOT: $(REPOROOT)\out |
| 34 | NUGET_XMLDOC_MODE: none |
| 35 | CIBW_BUILD: cp3{8,9,10,11}-*amd64 |
| 36 | CIBW_ARCHS: AMD64 |
| 37 | CIBW_BUILD_VERBOSITY: 1 |
| 38 | DEBIAN_FRONTEND: noninteractive |
| 39 | CIBW_ENVIRONMENT: "OCOS_ENABLE_AZURE=${{ parameters.BuildAzureOp }}" |
| 40 | |
| 41 | resources: |
| 42 | repositories: |
| 43 | - repository: templates |
| 44 | type: git |
| 45 | name: OneBranch.Pipelines/GovernedTemplates |
| 46 | ref: refs/heads/main |
| 47 | |
| 48 | extends: |
| 49 | template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates |
| 50 | parameters: |
| 51 | cloudvault: |
| 52 | enabled: false |
| 53 | globalSdl: |
| 54 | tsa: |
| 55 | enabled: false |
| 56 | binskim: |
| 57 | break: true # always break the build on binskim issues in addition to TSA upload |
| 58 | analyzeTargetGlob: '**\RelWithDebInfo\ortextensions.dll' # avoid scanning the 3rd party DLLs. |
| 59 | codeql: |
| 60 | compiled: |
| 61 | enabled: true |
| 62 | cadence: 10 |
| 63 | policheck: |
| 64 | break: true # always break the build on policheck issues. You can disable it by setting to 'false' |
| 65 | exclusionsFile: '$(REPOROOT)\.config\policheck_exclusions.xml' |
| 66 | |
| 67 | stages: |
| 68 | - stage: Windows_Build |
| 69 | jobs: |
| 70 | - job: main |
| 71 | pool: |
| 72 | type: windows |
| 73 | |
| 74 | variables: |
| 75 | ob_outputDirectory: '$(REPOROOT)\out' |
| 76 | ob_sdl_binskim_break: true |
| 77 | steps: |
| 78 | - script: | |
| 79 | @echo off |
| 80 | set vswherepath="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" |
| 81 | for /f "usebackq delims=" %%i in (`%vswherepath% -latest -property installationPath`) do ( |
| 82 | set vslatest="%%i" |
| 83 | if exist "%%i\Common7\Tools\vsdevcmd.bat" ( |
| 84 | set vsdevcmd="%%i\Common7\Tools\vsdevcmd.bat" |
| 85 | ) |
| 86 | if exist "%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" ( |
| 87 | set vscmake="%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" |
| 88 | ) |
| 89 | if exist "%%i\MSBuild\Current\Bin\amd64\msbuild.exe" ( |
| 90 | set vsmsbuild="%%i\MSBuild\Current\Bin\amd64\msbuild.exe" |
| 91 | ) |
| 92 | ) |
| 93 | |
| 94 | @echo vslatest %vslatest% |
| 95 | @echo vsdevcmd %vsdevcmd% |
| 96 | @echo vscmake %vscmake% |
| 97 | @echo vsmsbuild %vsmsbuild% |
| 98 | |
| 99 | @echo ##vso[task.setvariable variable=vslatest]%vslatest% |
| 100 | @echo ##vso[task.setvariable variable=vsdevcmd]%vsdevcmd% |
| 101 | @echo ##vso[task.setvariable variable=vscmake]%vscmake% |
| 102 | @echo ##vso[task.setvariable variable=vsmsbuild]%vsmsbuild% |
| 103 | displayName: 'locate vsdevcmd via vswhere' |
| 104 | - script: | |
| 105 | call $(vsdevcmd) |
| 106 | set PYTHONPATH= |
| 107 | set PYTHONHOME= |
| 108 | python -m pip install --upgrade pip |
| 109 | python -m pip install cibuildwheel numpy |
| 110 | python -m cibuildwheel --platform windows --archs AMD64 --output-dir $(REPOROOT)\out |
| 111 | displayName: Build wheels |
| 112 | - task: SDLNativeRules@3 |
| 113 | inputs: |
| 114 | msBuildArchitecture: amd64 |
| 115 | setupCommandlines: '"$(vscmake)" $(REPOROOT) -A x64 -B $(REPOROOT)\windows_out -DOCOS_BUILD_PYTHON=ON -DOCOS_ENABLE_CTEST=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo' |
| 116 | msBuildCommandline: '"$(vsmsbuild)" "$(REPOROOT)\windows_out\onnxruntime_extensions.sln" /p:RunCodeAnalysis=true /p:platform=x64 /p:configuration=RelWithDebInfo /p:VisualStudioVersion="16.0" /m /p:PreferredToolArchitecture=x64' |
| 117 | excludedPaths: '$(REPOROOT)\windows_out#$(Build.SourcesDirectory)\cmake#C:\program files (x86)' |
| 118 | displayName: 'Run the PREfast SDL Native Rules for MSBuild' |
| 119 | - task: PostAnalysis@2 |
| 120 | inputs: |
| 121 | GdnBreakGdnToolSDLNativeRulesSeverity: Warning |
| 122 | GdnBreakGdnToolSDLNativeRules: true |
| 123 | displayName: 'Guardian Break' |
| 124 | - script: | |
| 125 | 7z x $(REPOROOT)\out\*.whl -o$(REPOROOT)\out\* |
| 126 | displayName: unzip the package |
| 127 | - task: onebranch.pipeline.signing@1 |
| 128 | inputs: |
| 129 | command: 'sign' |
| 130 | signing_profile: 'external_distribution' |
| 131 | files_to_sign: '**/**/*.pyd;**/**/*.dll' |
| 132 | search_root: '$(REPOROOT)\out' |
| 133 | displayName: 'Sign runtime DLLs' |
| 134 | - script: | |
| 135 | for /D %%i in ("out\onnxruntime_extensions*-win*") do ( |
| 136 | 7z u %%i.whl .\%%i\* |
| 137 | rmdir /s /q %%i |
| 138 | ) |
| 139 | workingDirectory: '$(REPOROOT)' |
| 140 | displayName: zip package |
| 141 | |