diff --git a/py3-onnxruntime.yaml b/py3-onnxruntime.yaml new file mode 100644 index 00000000000..233a1266a33 --- /dev/null +++ b/py3-onnxruntime.yaml @@ -0,0 +1,185 @@ +package: + name: onnxruntime + version: 1.22.0 + epoch: 0 + description: Cross-platform, high performance ML inferencing and training accelerator + copyright: + - license: MIT + resources: + cpu: 64 + memory: 128Gi + options: + no-depends: true + +vars: + pypi-package: onnxruntime + import: onnxruntime + +data: + - name: py-versions + items: + 3.10: "310" + 3.11: "311" + 3.12: "312" + 3.13: "313" + +environment: + contents: + packages: + - abseil-cpp-dev + - bash + - build-base + - busybox + - ca-certificates-bundle + - cmake + - coreutils + - curl + - eigen-dev + - gcc-14-default + - patch + - py3-supported-build-base-dev + - py3-supported-flatbuffers + - py3-supported-numpy + - py3-supported-packaging + - py3-supported-protobuf + - py3-supported-setuptools + - py3-supported-wheel + - python3 + - zlib-dev + environment: + CXXFLAGS: "-fdelete-null-pointer-checks" + +pipeline: + - uses: git-checkout + with: + repository: https://github.com/microsoft/onnxruntime.git + tag: v${{package.version}} + expected-commit: f217402897f40ebba457e2421bc0a4702771968e + recurse-submodules: true + + - uses: patch + with: + patches: eigen.patch + + - name: Builds onnxruntime wheel + runs: | + bash ./build.sh --allow_running_as_root --skip_submodule_sync --config Release --update --build --parallel $(nproc --ignore=2) --build_shared_lib --cmake_extra_defines CMAKE_INSTALL_PREFIX=/usr + make install -C ./build/Linux/Release/ DESTDIR=${{targets.contextdir}} + make install -C ./build/Linux/Release/ + +subpackages: + - name: ${{vars.pypi-package}}-dev + description: onnxruntime header file and development files + pipeline: + - uses: split/dev + + - name: ${{vars.pypi-package}}-static + description: onnxruntime static files + pipeline: + - uses: split/static + + - range: py-versions + name: py${{range.key}}-${{vars.pypi-package}} + description: python${{range.key}} version of ${{vars.pypi-package}} + dependencies: + runtime: + - py${{range.key}}-numpy + - py${{range.key}}-coloredlogs + - py${{range.key}}-mpmath + - py${{range.key}}-flatbuffers + - py${{range.key}}-protobuf + - py${{range.key}}-packaging + - py${{range.key}}-setuptools + - py${{range.key}}-humanfriendly + - py${{range.key}}-sympy + options: + no-depends: true + pipeline: + - runs: | + #python${{range.key}} -m venv /usr/share/onnxruntime + #source /usr/share/onnxruntime/bin/activate + #pip install numpy wheel flatbuffers protobuf packaging setuptools + #cd ./build/Release + #python${{range.key}} ../../setup.py bdist_wheel + #ln -sf /usr/lib/python${{range.key}}/site-packages/numpy/core/include/numpy /usr/include/numpy + #rm -r /usr/include/numpy + + export NUMPY_INCLUDE=$(python3.11 -c "import numpy; print(numpy.get_include())") + python${{range.key}} tools/ci_build/build.py --build_dir build --config Release --build_wheel --skip_tests --parallel $(nproc --ignore=2) --allow_running_as_root --cmake_extra_defines "Python_NumPy_INCLUDE_DIR=$NUMPY_INCLUDE" + + python${{range.key}} -m pip install --verbose --no-index --no-build-isolation --no-deps --no-compile --prefix=/usr "--root=${{targets.contextdir}}" ./build/Release/dist/onnxruntime-${{package.version}}-cp${{range.value}}-cp${{range.value}}-linux_*.whl + + sitepkgd=$(python${{range.key}} -c 'import site; print(site.getsitepackages()[0])') + python${{range.key}} -m compileall --invalidation-mode=unchecked-hash \ + -r100 ${{targets.contextdir}}/$sitepkgd + apk del py${{range.key}}-numpy-bin py${{range.key}}-pybind11-bin + + + - name: move /usr/bin contents for -bin package to collect + runs: | + mkdir -p bin-save/${{range.key}} + mv ${{targets.contextdir}}/usr/bin bin-save/${{range.key}} + - uses: strip + test: + pipeline: + - uses: python/import + with: + python: python${{range.key}} + import: ${{vars.pypi-package}} + - uses: test/tw/ldd-check + + - range: py-versions + name: py${{range.key}}-${{vars.pypi-package}}-bin + description: commands for python${{range.key}} version of ${{vars.pypi-package}} + dependencies: + runtime: + - py${{range.key}}-${{vars.pypi-package}} + pipeline: + - runs: | + mkdir -p ${{targets.contextdir}}/usr + mv bin-save/${{range.key}}/bin ${{targets.contextdir}}/usr + - uses: strip + test: + pipeline: + - runs: onnxruntime -h + - uses: test/tw/ldd-check + + - name: py3-supported-${{vars.pypi-package}} + description: meta package providing ${{vars.pypi-package}} for supported python versions. + dependencies: + runtime: + - py3.10-${{vars.pypi-package}} + - py3.11-${{vars.pypi-package}} + - py3.12-${{vars.pypi-package}} + - py3.13-${{vars.pypi-package}} + test: + pipeline: + - uses: test/emptypackage + - uses: python/import + with: + python: python3.10 + import: ${{vars.import}} + - uses: python/import + with: + python: python3.11 + import: ${{vars.import}} + - uses: python/import + with: + python: python3.12 + import: ${{vars.import}} + - uses: python/import + with: + python: python3.13 + import: ${{vars.import}} + +update: + enabled: true + github: + identifier: microsoft/onnxruntime + strip-prefix: v + tag-filter: v1. + +test: + pipeline: + - runs: | + ls