microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/OneBranch.PullRequest.yml
129lines · 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 | variables: |
| 20 | CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] |
| 21 | system.debug: ${{ parameters.debug }} |
| 22 | ENABLE_PRS_DELAYSIGN: 1 |
| 23 | ROOT: $(Build.SourcesDirectory) |
| 24 | REPOROOT: $(Build.SourcesDirectory) |
| 25 | OUTPUTROOT: $(REPOROOT)\out |
| 26 | NUGET_XMLDOC_MODE: none |
| 27 | CIBW_BUILD: "cp3{7,8,9,10}-*amd64" |
| 28 | DEBIAN_FRONTEND: noninteractive |
| 29 | |
| 30 | resources: |
| 31 | repositories: |
| 32 | - repository: templates |
| 33 | type: git |
| 34 | name: OneBranch.Pipelines/GovernedTemplates |
| 35 | ref: refs/heads/main |
| 36 | |
| 37 | extends: |
| 38 | template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates |
| 39 | parameters: |
| 40 | cloudvault: |
| 41 | enabled: false |
| 42 | globalSdl: |
| 43 | tsa: |
| 44 | enabled: false |
| 45 | binskim: |
| 46 | break: true # always break the build on binskim issues in addition to TSA upload |
| 47 | analyzeTargetGlob: '**\bin\*' # only scan the DLLs in extensions bin folder. |
| 48 | codeql: |
| 49 | python: |
| 50 | enabled: true |
| 51 | policheck: |
| 52 | break: true # always break the build on policheck issues. You can disable it by setting to 'false' |
| 53 | exclusionsFile: '$(REPOROOT)\.config\policheck_exclusions.xml' |
| 54 | |
| 55 | stages: |
| 56 | - stage: Windows_Build |
| 57 | jobs: |
| 58 | - job: main |
| 59 | pool: |
| 60 | type: windows |
| 61 | |
| 62 | variables: |
| 63 | ob_outputDirectory: '$(REPOROOT)\out' |
| 64 | ob_sdl_binskim_break: true |
| 65 | steps: |
| 66 | - script: | |
| 67 | @echo off |
| 68 | set vswherepath="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" |
| 69 | for /f "usebackq delims=" %%i in (`%vswherepath% -latest -property installationPath`) do ( |
| 70 | set vslatest="%%i" |
| 71 | if exist "%%i\Common7\Tools\vsdevcmd.bat" ( |
| 72 | set vsdevcmd="%%i\Common7\Tools\vsdevcmd.bat" |
| 73 | ) |
| 74 | if exist "%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" ( |
| 75 | set vscmake="%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" |
| 76 | ) |
| 77 | if exist "%%i\MSBuild\Current\Bin\amd64\msbuild.exe" ( |
| 78 | set vsmsbuild="%%i\MSBuild\Current\Bin\amd64\msbuild.exe" |
| 79 | ) |
| 80 | ) |
| 81 | |
| 82 | @echo vslatest %vslatest% |
| 83 | @echo vsdevcmd %vsdevcmd% |
| 84 | @echo vscmake %vscmake% |
| 85 | @echo vsmsbuild %vsmsbuild% |
| 86 | |
| 87 | @echo ##vso[task.setvariable variable=vslatest]%vslatest% |
| 88 | @echo ##vso[task.setvariable variable=vsdevcmd]%vsdevcmd% |
| 89 | @echo ##vso[task.setvariable variable=vscmake]%vscmake% |
| 90 | @echo ##vso[task.setvariable variable=vsmsbuild]%vsmsbuild% |
| 91 | displayName: 'locate vsdevcmd via vswhere' |
| 92 | - script: | |
| 93 | call $(vsdevcmd) |
| 94 | set PYTHONPATH= |
| 95 | set PYTHONHOME= |
| 96 | python -m pip install --upgrade pip |
| 97 | python -m pip install cibuildwheel numpy |
| 98 | python -m cibuildwheel --platform windows --output-dir $(REPOROOT)\out |
| 99 | del /s /q /f .setuptools-cmake-build\*onnxruntime.dll |
| 100 | displayName: Build wheels |
| 101 | - task: SDLNativeRules@3 |
| 102 | inputs: |
| 103 | msBuildArchitecture: amd64 |
| 104 | setupCommandlines: '"$(vscmake)" $(REPOROOT) -A x64 -B $(REPOROOT)\windows_out -DOCOS_BUILD_PYTHON=ON -DOCOS_ENABLE_CTEST=OFF -DCMAKE_BUILD_TYPE=Release' |
| 105 | msBuildCommandline: '"$(vsmsbuild)" "$(REPOROOT)\windows_out\onnxruntime_extensions.sln" /p:RunCodeAnalysis=true /p:platform=x64 /p:configuration=Release /p:VisualStudioVersion="16.0" /m /p:PreferredToolArchitecture=x64' |
| 106 | excludedPaths: '$(REPOROOT)\windows_out#$(Build.SourcesDirectory)\cmake#C:\program files (x86)' |
| 107 | displayName: 'Run the PREfast SDL Native Rules for MSBuild' |
| 108 | - task: PostAnalysis@2 |
| 109 | inputs: |
| 110 | GdnBreakGdnToolSDLNativeRulesSeverity: Warning |
| 111 | GdnBreakGdnToolSDLNativeRules: true |
| 112 | displayName: 'Guardian Break' |
| 113 | - script: | |
| 114 | 7z x $(REPOROOT)\out\*.whl -o$(REPOROOT)\out\* |
| 115 | displayName: unzip the package |
| 116 | - task: onebranch.pipeline.signing@1 |
| 117 | inputs: |
| 118 | command: 'sign' |
| 119 | signing_profile: 'external_distribution' |
| 120 | files_to_sign: '**/**/*.pyd;**/**/*.dll' |
| 121 | search_root: '$(REPOROOT)\out' |
| 122 | displayName: 'Sign runtime DLLs' |
| 123 | - script: | |
| 124 | for /D %%i in ("out\onnxruntime_extensions*-win32") do ( |
| 125 | 7z u %%i.whl .\%%i\* |
| 126 | rmdir /s /q %%i |
| 127 | ) |
| 128 | workingDirectory: '$(REPOROOT)' |
| 129 | displayName: zip package |
| 130 | |