Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2344814

Browse filesBrowse files
authored
Merge pull request opencv#507 from asenyaev/asen/macos_m1
Added MacOS with M1 build
2 parents 7a751f7 + 9136e86 commit 2344814
Copy full SHA for 2344814

7 files changed

+139
-7
lines changed

‎.github/workflows/build_wheels_linux.yml

Copy file name to clipboardExpand all lines: .github/workflows/build_wheels_linux.yml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
branches:
66
- master
7+
paths-ignore:
8+
- '.github/workflows/build_wheels_linux_arm.yml'
9+
- '.github/workflows/build_wheels_windows*'
10+
- '.github/workflows/build_wheels_macos*'
711
release:
812
types: [published, edited]
913

‎.github/workflows/build_wheels_linux_arm.yml

Copy file name to clipboardExpand all lines: .github/workflows/build_wheels_linux_arm.yml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
branches:
66
- master
7+
paths-ignore:
8+
- '.github/workflows/build_wheels_linux.yml'
9+
- '.github/workflows/build_wheels_windows*'
10+
- '.github/workflows/build_wheels_macos*'
711
release:
812
types: [published, edited]
913

‎.github/workflows/build_wheels_macos.yml

Copy file name to clipboardExpand all lines: .github/workflows/build_wheels_macos.yml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
branches:
66
- master
7+
paths-ignore:
8+
- '.github/workflows/build_wheels_linux*'
9+
- '.github/workflows/build_wheels_windows*'
10+
- '.github/workflows/build_wheels_macos_m1.yml'
711
release:
812
types: [published, edited]
913

+117Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build PYPI wheels for opencv-python on Macos M1
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '.github/workflows/build_wheels_linux*'
9+
- '.github/workflows/build_wheels_windows*'
10+
- '.github/workflows/build_wheels_macos.yml'
11+
release:
12+
types: [published, edited]
13+
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [macOS-M1]
23+
python-version: [3.7, 3.8, 3.9]
24+
platform: [x64]
25+
with_contrib: [0, 1]
26+
without_gui: [0, 1]
27+
build_sdist: [0]
28+
29+
env:
30+
SDIST: ${{ matrix.build_sdist || 0 }}
31+
ENABLE_HEADLESS: ${{ matrix.without_gui }}
32+
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
33+
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
with:
39+
submodules: false
40+
fetch-depth: 0
41+
42+
- name: Update submodules
43+
if: github.event_name == 'pull_request'
44+
run: git submodule update --remote
45+
46+
- name: build script
47+
run: |
48+
git submodule update --init multibuild
49+
echo $ENABLE_CONTRIB > contrib.enabled
50+
echo $ENABLE_HEADLESS > headless.enabled
51+
export MACOSX_DEPLOYMENT_TARGET=11.0
52+
arch -arm64 python${{ matrix.python-version }} -m pip wheel --wheel-dir=wheelhouse . --verbose
53+
- name: before test
54+
run: |
55+
git submodule update --init --recursive
56+
arch -arm64 python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl
57+
cd ${{ github.workspace }}/tests
58+
arch -arm64 python${{ matrix.python-version }} get_build_info.py
59+
- name: run test
60+
run: |
61+
cd ${{ github.workspace }}/opencv
62+
arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
63+
- name: saving artifacts
64+
uses: actions/upload-artifact@v2
65+
with:
66+
name: wheels
67+
path: wheelhouse/opencv*.whl
68+
69+
test_release_opencv_python:
70+
if: github.event_name == 'release' && github.event.release.prerelease
71+
needs: [build]
72+
runs-on: ubuntu-latest
73+
environment: test-opencv-python-release
74+
defaults:
75+
run:
76+
shell: bash
77+
steps:
78+
- uses: actions/download-artifact@v2
79+
with:
80+
name: wheels
81+
path: wheelhouse/
82+
83+
- name: Upload all wheels
84+
run: |
85+
python -m pip install twine
86+
python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
87+
88+
release_opencv_python:
89+
if: github.event_name == 'release' && !github.event.release.prerelease
90+
needs: [build]
91+
runs-on: ubuntu-latest
92+
environment: opencv-python-release
93+
defaults:
94+
run:
95+
shell: bash
96+
steps:
97+
- uses: actions/download-artifact@v2
98+
with:
99+
name: wheels
100+
path: wheelhouse/
101+
102+
- name: Upload wheels for opencv_python
103+
run: |
104+
python -m pip install twine
105+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-*
106+
- name: Upload wheels for opencv_contrib_python
107+
run: |
108+
python -m pip install twine
109+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-*
110+
- name: Upload wheels for opencv_python_headless
111+
run: |
112+
python -m pip install twine
113+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-*
114+
- name: Upload wheels for opencv_contrib_python_headless
115+
run: |
116+
python -m pip install twine
117+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-*

‎.github/workflows/build_wheels_windows.yml

Copy file name to clipboardExpand all lines: .github/workflows/build_wheels_windows.yml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
branches:
66
- master
7+
paths-ignore:
8+
- '.github/workflows/build_wheels_linux*'
9+
- '.github/workflows/build_wheels_macos*'
710
release:
811
types: [published, edited]
912

‎pyproject.toml

Copy file name to clipboard
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
22
requires = [
33
"setuptools", "wheel", "scikit-build", "cmake", "pip",
4-
"numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64'",
4+
"numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
55
"numpy==1.19.3; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'",
6-
"numpy==1.20.1; python_version>='3.6' and sys_platform == 'darwin' and platform_machine == 'aarch64'",
7-
"numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64'",
8-
"numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64'",
9-
"numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64'"
6+
"numpy==1.21.0; python_version>='3.6' and sys_platform == 'darwin' and platform_machine == 'arm64'",
7+
"numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
8+
"numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
9+
"numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'"
1010
]

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def main():
3636
minimum_supported_numpy = "1.19.3"
3737

3838
# macos arm64 is a special case
39-
if sys.platform == "darwin" and sys.version_info[:2] >= (3, 6) and platform.machine() == "aarch64":
40-
minimum_supported_numpy = "1.20.1"
39+
if sys.platform == "darwin" and sys.version_info[:2] >= (3, 6) and platform.machine() == "arm64":
40+
minimum_supported_numpy = "1.21.0"
4141

4242
numpy_version = "numpy>=%s" % minimum_supported_numpy
4343

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.