| name: linux-x64-cpu-clang-python | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - '.github/workflows/linux-x64-cpu-clang-python.yml' | |
| - 'CMakeLists.txt' | |
| - 'cmake/**' | |
| - 'src/*' | |
| - 'src/layer/*' | |
| - 'src/layer/x86/**' | |
| - 'python/**' | |
| pull_request: | |
| branches: [master] | |
| paths: | |
| - '.github/workflows/linux-x64-cpu-clang-python.yml' | |
| - 'CMakeLists.txt' | |
| - 'cmake/**' | |
| - 'src/*' | |
| - 'src/layer/*' | |
| - 'src/layer/x86/**' | |
| - 'python/**' | |
| concurrency: | |
| group: linux-x64-cpu-clang-python-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| linux-clang-python: | |
| runs-on: ubuntu-20.04 | |
| strategy: | |
| matrix: | |
| python-version: [3.7, 3.9, 3.11] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: set up python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest setuptools wheel twine | |
| - name: configure | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| run: mkdir build && cd build && cmake -DNCNN_PYTHON=ON -DNCNN_DISABLE_RTTI=OFF -DNCNN_DISABLE_EXCEPTION=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | |
| - name: build | |
| run: cmake --build build -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/* | |