Skip to content

Commit bfb85dc

Browse files
authored
Merge pull request #1177 from asmorkalov:as/own_mac_intel
Switched MacOS Intel builds to own host
2 parents a7ca41e + 66e3128 commit bfb85dc

File tree

1 file changed

+22
-38
lines changed

1 file changed

+22
-38
lines changed

.github/workflows/build_wheels_macos.yml

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ on:
1818

1919
jobs:
2020
Build:
21-
runs-on: macos-13
22-
defaults:
23-
run:
24-
shell: bash
21+
runs-on: python-macos-intel
2522
strategy:
2623
fail-fast: false
2724
matrix:
@@ -31,6 +28,7 @@ jobs:
3128
without_gui: [0, 1]
3229
build_sdist: [0]
3330
env:
31+
CI_BUILD: 1
3432
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
3533
REPO_DIR: .
3634
PROJECT_SPEC: opencv-python
@@ -46,6 +44,7 @@ jobs:
4644
SDIST: ${{ matrix.build_sdist || 0 }}
4745
ENABLE_HEADLESS: ${{ matrix.without_gui }}
4846
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
47+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
4948
steps:
5049
- name: Cleanup
5150
run: find . -mindepth 1 -delete
@@ -55,34 +54,20 @@ jobs:
5554
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
5655
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
5756
fi
58-
# hack for image issue on mac: https://github.com/actions/runner-images/issues/6817
59-
rm /usr/local/bin/2to3*
60-
rm /usr/local/bin/idle3*
61-
rm /usr/local/bin/pydoc3*
62-
rm /usr/local/bin/python3*
63-
# end hack
6457
- name: Checkout
6558
uses: actions/checkout@v3
6659
with:
6760
submodules: false
6861
fetch-depth: 0
6962
- name: Build a package
7063
run: |
71-
set -e
72-
# Check out and prepare the source
73-
# Multibuild doesn't have releases, so --depth would break eventually (see
74-
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
7564
git submodule update --init multibuild
76-
source multibuild/common_utils.sh
77-
# https://github.com/matthew-brett/multibuild/issues/116
78-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
79-
source multibuild/travis_steps.sh
80-
# This sets -x
81-
# source travis_multibuild_customize.sh
8265
echo $ENABLE_CONTRIB > contrib.enabled
8366
echo $ENABLE_HEADLESS > headless.enabled
84-
set -x
85-
build_wheel $REPO_DIR $PLAT
67+
export MACOSX_DEPLOYMENT_TARGET=14.0
68+
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
69+
python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
70+
delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
8671
- name: Saving a wheel accordingly to matrix
8772
uses: actions/upload-artifact@v4
8873
with:
@@ -91,10 +76,7 @@ jobs:
9176

9277
Test:
9378
needs: [Build]
94-
runs-on: macos-13
95-
defaults:
96-
run:
97-
shell: bash
79+
runs-on: python-macos-intel
9880
strategy:
9981
fail-fast: false
10082
matrix:
@@ -112,6 +94,7 @@ jobs:
11294
PLAT: x86_64
11395
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
11496
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
97+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
11598
steps:
11699
- name: Cleanup
117100
run: find . -mindepth 1 -delete
@@ -121,32 +104,33 @@ jobs:
121104
with:
122105
submodules: true
123106
fetch-depth: 0
124-
- name: Set up Python ${{ matrix.python-version }}
125-
uses: actions/setup-python@v4
126-
with:
127-
python-version: ${{ matrix.python-version }}
128-
architecture: ${{ matrix.platform }}
129-
- name: Setup Environment variables
130-
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
131107
- name: Download a wheel accordingly to matrix
132108
uses: actions/download-artifact@v4
133109
with:
134110
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
135111
path: wheelhouse/
112+
- name: Create Venv for test
113+
run: |
114+
test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
115+
python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
136116
- name: Package installation
137117
run: |
138-
python -m pip install wheelhouse/opencv*.whl
118+
source ${{ github.workspace }}/opencv_test/bin/activate
119+
python${{ matrix.python-version }} -m pip install --upgrade pip
120+
python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
139121
cd ${{ github.workspace }}/tests
140-
python get_build_info.py
122+
python${{ matrix.python-version }} get_build_info.py
141123
- name: Run tests
142124
run: |
125+
source ${{ github.workspace }}/opencv_test/bin/activate
143126
cd ${{ github.workspace }}/opencv
144-
python modules/python/test/test.py -v --repo .
127+
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
145128
- name: Pylint test
146129
run: |
147-
python -m pip install pylint==2.15.9
130+
source ${{ github.workspace }}/opencv_test/bin/activate
131+
python${{ matrix.python-version }} -m pip install pylint==2.15.9
148132
cd ${{ github.workspace }}/tests
149-
python -m pylint $PYLINT_TEST_FILE
133+
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
150134
151135
Release_rolling:
152136
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

0 commit comments

Comments
 (0)