microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/ci_optional.yml
197lines · modecode
| 1 | trigger: |
| 2 | branches: |
| 3 | include: |
| 4 | - main |
| 5 | - rel-* |
| 6 | paths: |
| 7 | exclude: |
| 8 | - docs/** |
| 9 | - README.md |
| 10 | - tutorials/** |
| 11 | pr: |
| 12 | branches: |
| 13 | include: |
| 14 | - main |
| 15 | - rel-* |
| 16 | paths: |
| 17 | exclude: |
| 18 | - docs/** |
| 19 | - README.md |
| 20 | - tutorials/** |
| 21 | |
| 22 | stages: |
| 23 | - stage: AndroidBuilds |
| 24 | dependsOn: [] |
| 25 | jobs: |
| 26 | |
| 27 | ############# |
| 28 | # Android - Need resolve the unstable issue of start-emulator task before move it back |
| 29 | ############# |
| 30 | - job: AndroidPackage |
| 31 | pool: |
| 32 | vmImage: 'macOS-14' |
| 33 | timeoutInMinutes: 120 |
| 34 | steps: |
| 35 | - task: UsePythonVersion@0 |
| 36 | inputs: |
| 37 | versionSpec: "3.9" |
| 38 | addToPath: true |
| 39 | architecture: "x64" |
| 40 | displayName: "Use Python 3.9" |
| 41 | |
| 42 | - task: JavaToolInstaller@0 |
| 43 | displayName: Use jdk 17 |
| 44 | inputs: |
| 45 | versionSpec: '17' |
| 46 | jdkArchitectureOption: 'x64' |
| 47 | jdkSourceOption: 'PreInstalled' |
| 48 | |
| 49 | - script: brew install coreutils ninja |
| 50 | displayName: Install coreutils and ninja |
| 51 | |
| 52 | - bash: | |
| 53 | set -e -x |
| 54 | |
| 55 | _BUILD_CFG="x86_64 $(Build.BinariesDirectory)/android_aar" ./build.android |
| 56 | |
| 57 | VERSION=$(cat ./version.txt) |
| 58 | AAR_PATH="$(Build.BinariesDirectory)/android_aar/aar_out/com/microsoft/onnxruntime/onnxruntime-extensions-android/${VERSION}/onnxruntime-extensions-android-${VERSION}.aar" |
| 59 | |
| 60 | # Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote. |
| 61 | set +x |
| 62 | echo "##vso[task.setvariable variable=ORT_EXTENSIONS_AAR_PATH]${AAR_PATH}" |
| 63 | displayName: Build onnxruntime-extensions AAR package |
| 64 | |
| 65 | - template: templates/run-with-android-emulator-steps.yml |
| 66 | parameters: |
| 67 | steps: |
| 68 | |
| 69 | - bash: | |
| 70 | set -e -x |
| 71 | |
| 72 | cp -r $(Build.SourcesDirectory)/java/src/test/android $(Build.BinariesDirectory)/android_test |
| 73 | |
| 74 | cd $(Build.BinariesDirectory)/android_test |
| 75 | |
| 76 | ./gradlew connectedDebugAndroidTest --no-daemon -DortExtensionsAarLocalPath="${ORT_EXTENSIONS_AAR_PATH}" |
| 77 | displayName: Build and run onnxruntime-extensions Android test with Android Emulator |
| 78 | |
| 79 | - job: AndroidCpp |
| 80 | pool: |
| 81 | vmImage: 'macOS-14' |
| 82 | timeoutInMinutes: 30 |
| 83 | steps: |
| 84 | - task: UsePythonVersion@0 |
| 85 | inputs: |
| 86 | versionSpec: "3.9" |
| 87 | addToPath: true |
| 88 | architecture: "x64" |
| 89 | displayName: "Use Python 3.9" |
| 90 | |
| 91 | - task: JavaToolInstaller@0 |
| 92 | displayName: Use jdk 17 |
| 93 | inputs: |
| 94 | versionSpec: '17' |
| 95 | jdkArchitectureOption: 'x64' |
| 96 | jdkSourceOption: 'PreInstalled' |
| 97 | |
| 98 | - script: brew install ninja |
| 99 | displayName: Install ninja |
| 100 | |
| 101 | - bash: | |
| 102 | python ./tools/build.py \ |
| 103 | --config RelWithDebInfo \ |
| 104 | --android \ |
| 105 | --android_abi x86_64 \ |
| 106 | --enable_cxx_tests \ |
| 107 | --update --build --parallel |
| 108 | displayName: Build onnxruntime-extensions for Android |
| 109 | |
| 110 | - template: templates/run-with-android-emulator-steps.yml |
| 111 | parameters: |
| 112 | steps: |
| 113 | - bash: | |
| 114 | python ./tools/build.py \ |
| 115 | --config RelWithDebInfo \ |
| 116 | --android \ |
| 117 | --android_abi x86_64 \ |
| 118 | --enable_cxx_tests \ |
| 119 | --test |
| 120 | displayName: Run C++ tests on emulator |
| 121 | |
| 122 | - stage: WindowsBuilds |
| 123 | dependsOn: [] |
| 124 | jobs: |
| 125 | |
| 126 | - job: OrtNightlyCPU |
| 127 | pool: |
| 128 | name: 'onnxruntime-extensions-Windows-CPU' |
| 129 | |
| 130 | steps: |
| 131 | - task: UsePythonVersion@0 |
| 132 | inputs: |
| 133 | versionSpec: '3.12' |
| 134 | disableDownloadFromRegistry: true |
| 135 | addToPath: true |
| 136 | architecture: 'x64' |
| 137 | displayName: Use ADO python task |
| 138 | |
| 139 | - script: | |
| 140 | python -m pip install --upgrade setuptools pip |
| 141 | python -m pip install numpy |
| 142 | python -m pip install -U --index-url https://pkgs.dev.azure.com/aiinfra/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ ort-nightly |
| 143 | python -m pip install -v -e . |
| 144 | displayName: Build onnxruntime-extensions in editable mode. |
| 145 | |
| 146 | - script: | |
| 147 | python -m pip install -r requirements-dev.txt |
| 148 | python -m pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 |
| 149 | displayName: Install dependencies for pytest |
| 150 | |
| 151 | - script: | |
| 152 | cd test |
| 153 | python -m pytest . --verbose |
| 154 | displayName: Run python test |
| 155 | |
| 156 | - job: WindowsPyCUDA |
| 157 | pool: |
| 158 | name: 'onnxruntime-extensions-Win2022-GPU-A10' |
| 159 | steps: |
| 160 | - template: templates/set_winenv.yml |
| 161 | parameters: |
| 162 | EnvSetupScript: 'set_env_cuda.bat' |
| 163 | DownloadCUDA: true |
| 164 | |
| 165 | - script: | |
| 166 | nvidia-smi |
| 167 | nvcc --version |
| 168 | where nvcc |
| 169 | displayName: check cuda version |
| 170 | |
| 171 | - task: UsePythonVersion@0 |
| 172 | inputs: |
| 173 | versionSpec: '3.12' |
| 174 | disableDownloadFromRegistry: true |
| 175 | addToPath: true |
| 176 | architecture: 'x64' |
| 177 | displayName: Use ADO python task |
| 178 | |
| 179 | - script: | |
| 180 | set CUDA_PATH=$(Agent.TempDirectory)\v11.8 |
| 181 | python -m pip install --upgrade setuptools pip |
| 182 | python -m pip install numpy coloredlogs flatbuffers packaging protobuf sympy |
| 183 | python -m pip install -U --index-url https://pkgs.dev.azure.com/aiinfra/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ ort-nightly-gpu |
| 184 | python -m pip install -v --config-settings "ortx-user-option=use-cuda,cuda_archs=70;86" . |
| 185 | displayName: Build and install onnxruntime-extensions CUDA package. |
| 186 | |
| 187 | - script: | |
| 188 | python -m pip install -r requirements-dev.txt |
| 189 | python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 |
| 190 | displayName: Install dependencies for Python unit tests |
| 191 | |
| 192 | - script: | |
| 193 | cd test |
| 194 | python -m pytest . --verbose |
| 195 | cd cuda |
| 196 | python -m pytest . --verbose |
| 197 | displayName: Run python test |
| 198 | |