Skip to content

Commit 6a5fe03

Browse files
authored
Update build_wheels_macos_m1.yml
1 parent ddcbeec commit 6a5fe03

File tree

1 file changed

+24
-58
lines changed

1 file changed

+24
-58
lines changed

.github/workflows/build_wheels_macos_m1.yml

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: macOS x86_64
1+
name: macOS ARM64
22

33
on:
44
pull_request:
@@ -10,7 +10,7 @@ on:
1010
paths-ignore:
1111
- '.github/workflows/build_wheels_linux*'
1212
- '.github/workflows/build_wheels_windows*'
13-
- '.github/workflows/build_wheels_macos_m1.yml'
13+
- '.github/workflows/build_wheels_macos.yml'
1414
release:
1515
types: [published, edited]
1616
schedule:
@@ -20,10 +20,7 @@ on:
2020

2121
jobs:
2222
Build:
23-
runs-on: macos-13
24-
defaults:
25-
run:
26-
shell: bash
23+
runs-on: python-macos12-m1
2724
strategy:
2825
fail-fast: false
2926
matrix:
@@ -33,21 +30,11 @@ jobs:
3330
without_gui: [0, 1]
3431
build_sdist: [0]
3532
env:
36-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
37-
REPO_DIR: .
38-
PROJECT_SPEC: opencv-python
39-
MB_PYTHON_VERSION: ${{ matrix.python-version }}
40-
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
41-
MB_ML_VER: 2014
42-
TRAVIS_BUILD_DIR: ${{ github.workspace }}
43-
TRAVIS_OS_NAME: osx
44-
CONFIG_PATH: travis_config.sh
45-
USE_CCACHE: 1
46-
UNICODE_WIDTH: 32
47-
PLAT: x86_64
33+
CI_BUILD: 1
4834
SDIST: ${{ matrix.build_sdist || 0 }}
4935
ENABLE_HEADLESS: ${{ matrix.without_gui }}
5036
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
37+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
5138
steps:
5239
- name: Cleanup
5340
run: find . -mindepth 1 -delete
@@ -57,34 +44,20 @@ jobs:
5744
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
5845
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
5946
fi
60-
# hack for image issue on mac: https://github.com/actions/runner-images/issues/6817
61-
rm /usr/local/bin/2to3*
62-
rm /usr/local/bin/idle3*
63-
rm /usr/local/bin/pydoc3*
64-
rm /usr/local/bin/python3*
65-
# end hack
6647
- name: Checkout
6748
uses: actions/checkout@v3
6849
with:
6950
submodules: false
7051
fetch-depth: 0
7152
- name: Build a package
7253
run: |
73-
set -e
74-
# Check out and prepare the source
75-
# Multibuild doesn't have releases, so --depth would break eventually (see
76-
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
7754
git submodule update --init multibuild
78-
source multibuild/common_utils.sh
79-
# https://github.com/matthew-brett/multibuild/issues/116
80-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
81-
source multibuild/travis_steps.sh
82-
# This sets -x
83-
# source travis_multibuild_customize.sh
8455
echo $ENABLE_CONTRIB > contrib.enabled
8556
echo $ENABLE_HEADLESS > headless.enabled
86-
set -x
87-
build_wheel $REPO_DIR $PLAT
57+
export MACOSX_DEPLOYMENT_TARGET=13.0
58+
python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin
59+
python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
60+
delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
8861
- name: Saving a wheel accordingly to matrix
8962
uses: actions/upload-artifact@v4
9063
with:
@@ -93,10 +66,7 @@ jobs:
9366

9467
Test:
9568
needs: [Build]
96-
runs-on: macos-13
97-
defaults:
98-
run:
99-
shell: bash
69+
runs-on: python-macos12-m1
10070
strategy:
10171
fail-fast: false
10272
matrix:
@@ -106,14 +76,9 @@ jobs:
10676
without_gui: [0, 1]
10777
build_sdist: [0]
10878
env:
109-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
110-
MB_PYTHON_VERSION: ${{ matrix.python-version }}
111-
NP_TEST_DEP: numpy==1.19.4
112-
NP_TEST_DEP_LATEST: numpy==2.2.1
113-
CONFIG_PATH: travis_config.sh
114-
PLAT: x86_64
11579
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
11680
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
81+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
11782
steps:
11883
- name: Cleanup
11984
run: find . -mindepth 1 -delete
@@ -123,32 +88,33 @@ jobs:
12388
with:
12489
submodules: true
12590
fetch-depth: 0
126-
- name: Set up Python ${{ matrix.python-version }}
127-
uses: actions/setup-python@v4
128-
with:
129-
python-version: ${{ matrix.python-version }}
130-
architecture: ${{ matrix.platform }}
131-
- name: Setup Environment variables
132-
run: if ["3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ 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
13391
- name: Download a wheel accordingly to matrix
13492
uses: actions/download-artifact@v4
13593
with:
13694
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
13795
path: wheelhouse/
96+
- name: Create Venv for test
97+
run: |
98+
test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
99+
python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
138100
- name: Package installation
139101
run: |
140-
python -m pip install wheelhouse/opencv*.whl
102+
source ${{ github.workspace }}/opencv_test/bin/activate
103+
python${{ matrix.python-version }} -m pip install --upgrade pip
104+
python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
141105
cd ${{ github.workspace }}/tests
142-
python get_build_info.py
106+
python${{ matrix.python-version }} get_build_info.py
143107
- name: Run tests
144108
run: |
109+
source ${{ github.workspace }}/opencv_test/bin/activate
145110
cd ${{ github.workspace }}/opencv
146-
python modules/python/test/test.py -v --repo .
111+
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
147112
- name: Pylint test
148113
run: |
149-
python -m pip install pylint==2.15.9
114+
source ${{ github.workspace }}/opencv_test/bin/activate
115+
python${{ matrix.python-version }} -m pip install pylint==2.15.9
150116
cd ${{ github.workspace }}/tests
151-
python -m pylint $PYLINT_TEST_FILE
117+
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
152118
153119
Release_rolling:
154120
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

0 commit comments

Comments
 (0)