Skip to content

Commit db71ed2

Browse files
committed
Switched MacOS Intel builds to own host.
1 parent 1a2d0f6 commit db71ed2

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

.github/workflows/build_wheels_macos.yml

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818

1919
jobs:
2020
Build:
21-
runs-on: macos-13
21+
runs-on: python-macos-intel
2222
defaults:
2323
run:
2424
shell: bash
@@ -46,6 +46,7 @@ jobs:
4646
SDIST: ${{ matrix.build_sdist || 0 }}
4747
ENABLE_HEADLESS: ${{ matrix.without_gui }}
4848
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
49+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
4950
steps:
5051
- name: Cleanup
5152
run: find . -mindepth 1 -delete
@@ -55,34 +56,20 @@ jobs:
5556
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
5657
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
5758
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
6459
- name: Checkout
6560
uses: actions/checkout@v3
6661
with:
6762
submodules: false
6863
fetch-depth: 0
6964
- name: Build a package
7065
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)
7566
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
8267
echo $ENABLE_CONTRIB > contrib.enabled
8368
echo $ENABLE_HEADLESS > headless.enabled
84-
set -x
85-
build_wheel $REPO_DIR $PLAT
69+
export MACOSX_DEPLOYMENT_TARGET=14.0
70+
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
71+
python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
72+
delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
8673
- name: Saving a wheel accordingly to matrix
8774
uses: actions/upload-artifact@v4
8875
with:
@@ -91,7 +78,7 @@ jobs:
9178

9279
Test:
9380
needs: [Build]
94-
runs-on: macos-13
81+
runs-on: python-macos-intel
9582
defaults:
9683
run:
9784
shell: bash
@@ -112,6 +99,7 @@ jobs:
11299
PLAT: x86_64
113100
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
114101
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
102+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
115103
steps:
116104
- name: Cleanup
117105
run: find . -mindepth 1 -delete
@@ -121,32 +109,33 @@ jobs:
121109
with:
122110
submodules: true
123111
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
131112
- name: Download a wheel accordingly to matrix
132113
uses: actions/download-artifact@v4
133114
with:
134115
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
135116
path: wheelhouse/
117+
- name: Create Venv for test
118+
run: |
119+
test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
120+
python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
136121
- name: Package installation
137122
run: |
138-
python -m pip install wheelhouse/opencv*.whl
123+
source ${{ github.workspace }}/opencv_test/bin/activate
124+
python${{ matrix.python-version }} -m pip install --upgrade pip
125+
python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
139126
cd ${{ github.workspace }}/tests
140-
python get_build_info.py
127+
python${{ matrix.python-version }} get_build_info.py
141128
- name: Run tests
142129
run: |
130+
source ${{ github.workspace }}/opencv_test/bin/activate
143131
cd ${{ github.workspace }}/opencv
144-
python modules/python/test/test.py -v --repo .
132+
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
145133
- name: Pylint test
146134
run: |
147-
python -m pip install pylint==2.15.9
135+
source ${{ github.workspace }}/opencv_test/bin/activate
136+
python${{ matrix.python-version }} -m pip install pylint==2.15.9
148137
cd ${{ github.workspace }}/tests
149-
python -m pylint $PYLINT_TEST_FILE
138+
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
150139
151140
Release_rolling:
152141
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

0 commit comments

Comments
 (0)