Skip to content

where-not optimization #554

where-not optimization

where-not optimization #554

Workflow file for this run

name: Build and Test
on: [push, pull_request]
jobs:
build_wheels:
env:
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: WD=`pwd` && /opt/python/cp38-cp38/bin/python -m pip install --target tmp_cmake cmake && cp tmp_cmake/bin/cmake /usr/local/bin/cmake && rm -rf tmp_cmake && /opt/python/cp38-cp38/bin/python -m pip install cmake && cmake --version && whereis cmake
CIBW_BEFORE_ALL_MACOS: WD=`pwd` && pip install cmake
CIBW_TEST_REQUIRES_LINUX: pytest nbval flake8 mypy onnxruntime
CIBW_TEST_REQUIRES_MACOS: pytest nbval
CIBW_TEST_REQUIRES_WINDOWS: pytest nbval
CIBW_BEFORE_TEST_LINUX: pip install torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
CIBW_TEST_COMMAND: pytest {project}/onnxoptimizer/test
CIBW_TEST_COMMAND_LINUX: cd {project} && flake8 && pytest
# Python3.11 doesn't have torchvision prebuilt wheel
CIBW_TEST_SKIP: "cp311-* *_arm64 *_universal2:arm64"
CIBW_ENVIRONMENT: CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON"
CIBW_ENVIRONMENT_WINDOWS: USE_MSVC_STATIC_RUNTIME=0 CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON"
# Only build on Python 3 and skip 32-bit builds
CIBW_BUILD: "cp3?-* cp310-* cp311-*"
# Skip python 3.6
CIBW_SKIP: "cp36-* *-win32 *-manylinux_i686 *-musllinux_*"
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build wheels
uses: pypa/[email protected]
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build sdist
run: pipx run build --sdist
- name: Install and test sdist
run: |
# It's important to leave the project directory where a 'onnxoptimizer' subdirectory exists
cd dist
python3 -m pip install *.tar.gz
python3 -c "import onnxoptimizer; print(onnxoptimizer.get_fuse_and_elimination_passes())"
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}