|
- name: windows-x64-cpu-vs2019-python
- on:
- push:
- branches: [master]
- paths:
- - '.github/workflows/windows-x64-cpu-vs2019-python.yml'
- - 'CMakeLists.txt'
- - 'cmake/**'
- - 'src/*'
- - 'src/layer/*'
- - 'src/layer/x86/**'
- - 'python/**'
- pull_request:
- branches: [master]
- paths:
- - '.github/workflows/windows-x64-cpu-vs2019-python.yml'
- - 'CMakeLists.txt'
- - 'cmake/**'
- - 'src/*'
- - 'src/layer/*'
- - 'src/layer/x86/**'
- - 'python/**'
- concurrency:
- group: windows-x64-cpu-vs2019-python-${{ github.ref }}
- cancel-in-progress: true
- jobs:
- windows-vs2019-python:
- runs-on: windows-latest
- strategy:
- matrix:
- python-version: [3.6, 3.7, 3.8, 3.9]
- steps:
- - uses: actions/checkout@v2
- with:
- submodules: true
- - name: set up python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
- with:
- python-version: ${{ matrix.python-version }}
- - name: install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install pytest setuptools wheel twine
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v2.1.7
- with:
- path: "protobuf-install"
- key: protobuf-windows-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-vs2019; cd build-vs2019; cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DNCNN_BUILD_TESTS=ON ../cmake
- cmake --build . --config Release -j 2
- cmake --build . --config Release --target install
- - name: build
- run: |
- mkdir build; cd build
- cmake -DProtobuf_INCLUDE_DIR="$env:GITHUB_WORKSPACE\protobuf-install\include" -DProtobuf_LIBRARIES="$env:GITHUB_WORKSPACE\protobuf-install\lib\libprotobuf.lib" -DProtobuf_PROTOC_EXECUTABLE="$env:GITHUB_WORKSPACE\protobuf-install\bin\protoc.exe" -DNCNN_PYTHON=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=OFF ..
- cmake --build . --config Release -j 2
- - name: install python
- run: cd python && pip install .
- - name: test
- run: cd python && pytest tests
- - name: build and publish
- if: startsWith(github.ref, 'refs/tags')
- env:
- TWINE_USERNAME: __token__
- TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
- TWINE_REPOSITORY_URL: "https://test.pypi.org/legacy/"
- run: |
- cd python
- python setup.py bdist_wheel
- twine upload dist/*
|