Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unified python ci #5407

Merged
merged 11 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions .github/workflows/linux-x64-cpu-clang-python.yml

This file was deleted.

133 changes: 0 additions & 133 deletions .github/workflows/macos-x64-cpu-python.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: linux-x64-gpu-clang-python
name: python
on:
push:
branches: [master]
paths:
- '.github/workflows/linux-x64-gpu-clang-python.yml'
- '.github/workflows/python.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
Expand All @@ -14,7 +14,7 @@ on:
pull_request:
branches: [master]
paths:
- '.github/workflows/linux-x64-gpu-clang-python.yml'
- '.github/workflows/python.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
Expand All @@ -23,77 +23,102 @@ on:
- 'src/layer/vulkan/**'
- 'python/**'
concurrency:
group: linux-x64-gpu-clang-python-${{ github.ref }}
group: python-${{ github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
MAC_DEPLOYMENT_TARGET: '11.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
CMAKE_BUILD_PARALLEL_LEVEL: 4
UseMultiToolTask: true
permissions:
contents: read

jobs:
linux-clang-gpu:
runs-on: ubuntu-20.04
build:
strategy:
matrix:
python-version: [3.7, 3.9, 3.11]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: [3.9, 3.12]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: cache-swiftshader
if: matrix.os == 'ubuntu-latest'
id: cache-swiftshader
uses: actions/cache@v4
with:
path: swiftshader-install
key: swiftshader-linux-install-20230420
- name: checkout-swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
if: matrix.os == 'ubuntu-latest' && steps.cache-swiftshader.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: google/swiftshader
path: swiftshader
ref: dd55e592406dc0bae219df11adec6363840aff4a
- name: checkout-swiftshader-submodules
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
if: matrix.os == 'ubuntu-latest' && steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
git -c submodule."third_party/git-hooks".update=none submodule update --init --recursive
- name: swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
if: matrix.os == 'ubuntu-latest' && steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
mkdir -p build; cd build
cmake -DCMAKE_INSTALL_PREFIX=install -DSWIFTSHADER_BUILD_EGL=FALSE -DSWIFTSHADER_BUILD_GLESv2=FALSE -DSWIFTSHADER_BUILD_GLES_CM=FALSE -DSWIFTSHADER_BUILD_VULKAN=TRUE -DSWIFTSHADER_BUILD_PVR=FALSE -DSWIFTSHADER_BUILD_TESTS=FALSE -DSWIFTSHADER_ENABLE_ASTC=FALSE -DSWIFTSHADER_WARNINGS_AS_ERRORS=FALSE -DREACTOR_BACKEND=Subzero -DREACTOR_DEFAULT_OPT_LEVEL=Default -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j $(nproc)
mkdir $GITHUB_WORKSPACE/swiftshader-install
cp Linux/* $GITHUB_WORKSPACE/swiftshader-install
- name: set up python ${{ matrix.python-version }}

- name: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: install-deps
run: |
python -m pip install --upgrade pip
pip install pytest setuptools wheel twine

- name: build
if: matrix.os == 'ubuntu-latest'
env:
CC: clang
CXX: clang++
run: |
mkdir build && cd build
cmake -DNCNN_VULKAN=ON -DNCNN_PYTHON=ON -DNCNN_DISABLE_RTTI=OFF -DNCNN_DISABLE_EXCEPTION=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF ..
cmake -DNCNN_VULKAN=ON -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF ..
cmake --build . -j $(nproc)
- name: install python
- name: build
if: matrix.os == 'macos-13'
run: |
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC -DARCHS="x86_64" \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DNCNN_VULKAN=OFF -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF ..
cmake --build . -j 4
- name: build
if: matrix.os == 'windows-latest'
run: |
mkdir build; cd build
cmake -T v142,host=x64 -A x64 -DNCNN_VULKAN=OFF -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF ..
cmake --build . --config Release -j 4
- name: build-python
run: cd python && pip install .
- name: test
if: matrix.os == 'ubuntu-latest'
run: |
export VK_ICD_FILENAMES="$GITHUB_WORKSPACE/swiftshader-install/vk_swiftshader_icd.json"
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/"
- name: test
if: matrix.os != 'ubuntu-latest'
run: |
cd python
python setup.py bdist_wheel
twine upload dist/*
cd python && pytest tests
Loading
Loading