Skip to content

Commit fd3bf88

Browse files
authored
Merge pull request #595 from asenyaev/asen/python_limited_api
Added python limited API support
2 parents d0ebd71 + 040dc8d commit fd3bf88

7 files changed

+592
-92
lines changed

.github/workflows/build_wheels_linux.yml

+100-23
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-latest]
26-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
26+
python-version: ['3.6']
2727
platform: [x64]
2828
with_contrib: [0, 1]
2929
without_gui: [0, 1]
@@ -37,13 +37,12 @@ jobs:
3737
MB_PYTHON_VERSION: ${{ matrix.python-version }}
3838
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
3939
MB_ML_VER: 2014
40-
NP_TEST_DEP: numpy==1.19.4
41-
NP_TEST_DEP_LATEST: numpy==1.21.2
4240
TRAVIS_BUILD_DIR: ${{ github.workspace }}
4341
CONFIG_PATH: travis_config.sh
4442
DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
4543
USE_CCACHE: 1
4644
UNICODE_WIDTH: 32
45+
PLAT: x86_64
4746
SDIST: ${{ matrix.build_sdist || 0 }}
4847
ENABLE_HEADLESS: ${{ matrix.without_gui }}
4948
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
@@ -59,25 +58,108 @@ jobs:
5958
if: github.event_name == 'pull_request'
6059
run: git submodule update --remote
6160

62-
- name: Setup Environment variables
63-
run: |
64-
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
65-
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
66-
if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi
67-
if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
68-
69-
- name: build
61+
- name: Build a package
7062
run: source scripts/build.sh
7163

72-
- name: install and test
73-
run: source scripts/install.sh
74-
75-
- name: saving artifacts
64+
- name: Saving all wheels
7665
uses: actions/upload-artifact@v2
7766
with:
7867
name: wheels
7968
path: wheelhouse/opencv*.whl
8069

70+
- name: Saving opencv-python wheels
71+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 0 }}
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: opencv-python-wheels
75+
path: wheelhouse/opencv_python-*.whl
76+
77+
- name: Saving opencv-python-headless wheels
78+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 0 }}
79+
uses: actions/upload-artifact@v2
80+
with:
81+
name: opencv-python-headless-wheels
82+
path: wheelhouse/opencv_python_headless-*.whl
83+
84+
- name: Saving opencv-contrib-python wheels
85+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 1 }}
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: opencv-contrib-python-wheels
89+
path: wheelhouse/opencv_contrib_python-*.whl
90+
91+
- name: Saving opencv-contrib-python-headless wheels
92+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 1 }}
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: opencv-contrib-python-headless-wheels
96+
path: wheelhouse/opencv_contrib_python_headless-*.whl
97+
98+
test:
99+
needs: [build]
100+
runs-on: ${{ matrix.os }}
101+
defaults:
102+
run:
103+
shell: bash
104+
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
os: [ubuntu-latest]
109+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
110+
platform: [x64]
111+
with_contrib: [0, 1]
112+
without_gui: [0, 1]
113+
build_sdist: [0]
114+
115+
env:
116+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
117+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
118+
NP_TEST_DEP: numpy==1.19.4
119+
NP_TEST_DEP_LATEST: numpy==1.21.2
120+
CONFIG_PATH: travis_config.sh
121+
PLAT: x86_64
122+
123+
steps:
124+
- name: Checkout
125+
uses: actions/checkout@v2
126+
with:
127+
submodules: false
128+
fetch-depth: 0
129+
130+
- name: Setup Environment variables
131+
run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
132+
133+
- name: Download opencv-python wheels
134+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 0 }}
135+
uses: actions/download-artifact@v2
136+
with:
137+
name: opencv-python-wheels
138+
path: wheelhouse/
139+
140+
- name: Download opencv-python-headless wheels
141+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 0 }}
142+
uses: actions/download-artifact@v2
143+
with:
144+
name: opencv-python-headless-wheels
145+
path: wheelhouse/
146+
147+
- name: Download opencv-contrib-python wheels
148+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 1 }}
149+
uses: actions/download-artifact@v2
150+
with:
151+
name: opencv-contrib-python-wheels
152+
path: wheelhouse/
153+
154+
- name: Download opencv-contrib-python-headless wheels
155+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 1 }}
156+
uses: actions/download-artifact@v2
157+
with:
158+
name: opencv-contrib-python-headless-wheels
159+
path: wheelhouse/
160+
161+
- name: Package installation and run tests
162+
run: source scripts/install.sh
81163

82164
build_sdist:
83165
runs-on: ${{ matrix.os }}
@@ -131,12 +213,7 @@ jobs:
131213
python-version: ${{ matrix.python-version }}
132214
architecture: ${{ matrix.platform }}
133215

134-
- name: Setup Environment variables
135-
run: |
136-
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
137-
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
138-
139-
- name: before install
216+
- name: Build a package
140217
run: |
141218
set -e
142219
# Build and package
@@ -157,7 +234,7 @@ jobs:
157234

158235
test_release_opencv_python:
159236
if: github.event_name == 'release' && github.event.release.prerelease
160-
needs: [build, build_sdist]
237+
needs: [build, build_sdist, test]
161238
runs-on: ubuntu-latest
162239
environment: test-opencv-python-release
163240
defaults:
@@ -176,7 +253,7 @@ jobs:
176253
177254
release_opencv_python:
178255
if: github.event_name == 'release' && !github.event.release.prerelease
179-
needs: [build, build_sdist]
256+
needs: [build, build_sdist, test]
180257
runs-on: ubuntu-latest
181258
environment: opencv-python-release
182259
defaults:

.github/workflows/build_wheels_linux_arm.yml

+105-16
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ARM64]
26-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
26+
python-version: ['3.6']
2727
platform: [x64]
2828
with_contrib: [0, 1]
2929
without_gui: [0, 1]
@@ -38,12 +38,9 @@ jobs:
3838
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
3939
PLAT: aarch64
4040
MB_ML_VER: 2014
41-
NP_TEST_DEP: numpy==1.19.4
42-
NP_TEST_DEP_LATEST: numpy==1.21.2
4341
TRAVIS_BUILD_DIR: ${{ github.workspace }}
4442
CONFIG_PATH: travis_config.sh
4543
DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
46-
DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
4744
USE_CCACHE: 0
4845
UNICODE_WIDTH: 32
4946
SDIST: ${{ matrix.build_sdist || 0 }}
@@ -61,26 +58,118 @@ jobs:
6158
submodules: false
6259
fetch-depth: 0
6360

64-
- name: Setup Environment variables
65-
run: |
66-
if [ "ARM64" == "${{ matrix.os }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; fi
67-
if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
68-
69-
- name: build
61+
- name: Build a package
7062
run: source scripts/build.sh
7163

72-
- name: install and test
73-
run: source scripts/install.sh
74-
75-
- name: saving artifacts
64+
- name: Saving all wheels
7665
uses: actions/upload-artifact@v2
7766
with:
7867
name: wheels
7968
path: wheelhouse/opencv*.whl
8069

70+
- name: Saving opencv-python wheels
71+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 0 }}
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: opencv-python-wheels
75+
path: wheelhouse/opencv_python-*.whl
76+
77+
- name: Saving opencv-python-headless wheels
78+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 0 }}
79+
uses: actions/upload-artifact@v2
80+
with:
81+
name: opencv-python-headless-wheels
82+
path: wheelhouse/opencv_python_headless-*.whl
83+
84+
- name: Saving opencv-contrib-python wheels
85+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 1 }}
86+
uses: actions/upload-artifact@v2
87+
with:
88+
name: opencv-contrib-python-wheels
89+
path: wheelhouse/opencv_contrib_python-*.whl
90+
91+
- name: Saving opencv-contrib-python-headless wheels
92+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 1 }}
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: opencv-contrib-python-headless-wheels
96+
path: wheelhouse/opencv_contrib_python_headless-*.whl
97+
98+
test:
99+
needs: [build_arm]
100+
runs-on: ${{ matrix.os }}
101+
defaults:
102+
run:
103+
shell: bash
104+
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
os: [ARM64]
109+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
110+
platform: [x64]
111+
with_contrib: [0, 1]
112+
without_gui: [0, 1]
113+
build_sdist: [0]
114+
115+
env:
116+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
117+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
118+
PLAT: aarch64
119+
NP_TEST_DEP: numpy==1.19.4
120+
NP_TEST_DEP_LATEST: numpy==1.21.4
121+
CONFIG_PATH: travis_config.sh
122+
DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
123+
UNICODE_WIDTH: 32
124+
125+
steps:
126+
- name: Cleanup
127+
if: always()
128+
uses: AutoModality/action-clean@v1
129+
130+
- name: Checkout
131+
uses: actions/checkout@v2
132+
with:
133+
submodules: true
134+
fetch-depth: 0
135+
136+
- name: Setup Environment variables
137+
run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
138+
139+
- name: Download opencv-python wheels
140+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 0 }}
141+
uses: actions/download-artifact@v2
142+
with:
143+
name: opencv-python-wheels
144+
path: wheelhouse/
145+
146+
- name: Download opencv-python-headless wheels
147+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 0 }}
148+
uses: actions/download-artifact@v2
149+
with:
150+
name: opencv-python-headless-wheels
151+
path: wheelhouse/
152+
153+
- name: Download opencv-contrib-python wheels
154+
if: ${{ matrix.without_gui == 0 && matrix.with_contrib == 1 }}
155+
uses: actions/download-artifact@v2
156+
with:
157+
name: opencv-contrib-python-wheels
158+
path: wheelhouse/
159+
160+
- name: Download opencv-contrib-python-headless wheels
161+
if: ${{ matrix.without_gui == 1 && matrix.with_contrib == 1 }}
162+
uses: actions/download-artifact@v2
163+
with:
164+
name: opencv-contrib-python-headless-wheels
165+
path: wheelhouse/
166+
167+
- name: Package installation and run tests
168+
run: source scripts/install.sh
169+
81170
test_release_opencv_python:
82171
if: github.event_name == 'release' && github.event.release.prerelease
83-
needs: [build_arm]
172+
needs: [build_arm, test]
84173
runs-on: ubuntu-latest
85174
environment: test-opencv-python-release
86175
defaults:
@@ -99,7 +188,7 @@ jobs:
99188
100189
release_opencv_python:
101190
if: github.event_name == 'release' && !github.event.release.prerelease
102-
needs: [build_arm]
191+
needs: [build_arm, test]
103192
runs-on: ubuntu-latest
104193
environment: opencv-python-release
105194
defaults:

0 commit comments

Comments
 (0)