Skip to content

Commit ddcbeec

Browse files
authored
Update build_wheels_macos_m1.yml
1 parent d751cc8 commit ddcbeec

File tree

1 file changed

+66
-37
lines changed

1 file changed

+66
-37
lines changed

.github/workflows/build_wheels_macos_m1.yml

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: macOS ARM64
1+
name: macOS x86_64
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.yml'
13+
- '.github/workflows/build_wheels_macos_m1.yml'
1414
release:
1515
types: [published, edited]
1616
schedule:
@@ -20,7 +20,10 @@ on:
2020

2121
jobs:
2222
Build:
23-
runs-on: python-macos12-m1
23+
runs-on: macos-13
24+
defaults:
25+
run:
26+
shell: bash
2427
strategy:
2528
fail-fast: false
2629
matrix:
@@ -30,11 +33,21 @@ jobs:
3033
without_gui: [0, 1]
3134
build_sdist: [0]
3235
env:
33-
CI_BUILD: 1
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
3448
SDIST: ${{ matrix.build_sdist || 0 }}
3549
ENABLE_HEADLESS: ${{ matrix.without_gui }}
3650
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
37-
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
3851
steps:
3952
- name: Cleanup
4053
run: find . -mindepth 1 -delete
@@ -44,34 +57,46 @@ jobs:
4457
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
4558
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
4659
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
4766
- name: Checkout
4867
uses: actions/checkout@v3
4968
with:
5069
submodules: false
5170
fetch-depth: 0
5271
- name: Build a package
5372
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)
5477
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
5584
echo $ENABLE_CONTRIB > contrib.enabled
5685
echo $ENABLE_HEADLESS > headless.enabled
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*
61-
- name: Saving all wheels
62-
uses: actions/upload-artifact@v3
63-
with:
64-
name: wheels
65-
path: wheelhouse/opencv*.whl
86+
set -x
87+
build_wheel $REPO_DIR $PLAT
6688
- name: Saving a wheel accordingly to matrix
67-
uses: actions/upload-artifact@v3
89+
uses: actions/upload-artifact@v4
6890
with:
6991
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
7092
path: wheelhouse/opencv*.whl
7193

7294
Test:
7395
needs: [Build]
74-
runs-on: python-macos12-m1
96+
runs-on: macos-13
97+
defaults:
98+
run:
99+
shell: bash
75100
strategy:
76101
fail-fast: false
77102
matrix:
@@ -81,9 +106,14 @@ jobs:
81106
without_gui: [0, 1]
82107
build_sdist: [0]
83108
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
84115
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
85116
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
86-
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
87117
steps:
88118
- name: Cleanup
89119
run: find . -mindepth 1 -delete
@@ -93,44 +123,43 @@ jobs:
93123
with:
94124
submodules: true
95125
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
96133
- name: Download a wheel accordingly to matrix
97-
uses: actions/download-artifact@v3
134+
uses: actions/download-artifact@v4
98135
with:
99136
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
100137
path: wheelhouse/
101-
- name: Create Venv for test
102-
run: |
103-
test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
104-
python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
105138
- name: Package installation
106139
run: |
107-
source ${{ github.workspace }}/opencv_test/bin/activate
108-
python${{ matrix.python-version }} -m pip install --upgrade pip
109-
python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
140+
python -m pip install wheelhouse/opencv*.whl
110141
cd ${{ github.workspace }}/tests
111-
python${{ matrix.python-version }} get_build_info.py
142+
python get_build_info.py
112143
- name: Run tests
113144
run: |
114-
source ${{ github.workspace }}/opencv_test/bin/activate
115145
cd ${{ github.workspace }}/opencv
116-
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
146+
python modules/python/test/test.py -v --repo .
117147
- name: Pylint test
118148
run: |
119-
source ${{ github.workspace }}/opencv_test/bin/activate
120-
python${{ matrix.python-version }} -m pip install pylint==2.15.9
149+
python -m pip install pylint==2.15.9
121150
cd ${{ github.workspace }}/tests
122-
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
151+
python -m pylint $PYLINT_TEST_FILE
123152
124153
Release_rolling:
125154
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
126155
needs: [Build, Test]
127-
runs-on: ubuntu-20.04
156+
runs-on: ubuntu-22.04
128157
environment: opencv-python-rolling-release
129158
defaults:
130159
run:
131160
shell: bash
132161
steps:
133-
- uses: actions/download-artifact@v3
162+
- uses: actions/download-artifact@v4
134163
with:
135164
name: wheels
136165
path: wheelhouse/
@@ -154,13 +183,13 @@ jobs:
154183
Pre-release:
155184
if: github.event_name == 'release' && github.event.release.prerelease
156185
needs: [Build, Test]
157-
runs-on: ubuntu-20.04
186+
runs-on: ubuntu-22.04
158187
environment: test-opencv-python-release
159188
defaults:
160189
run:
161190
shell: bash
162191
steps:
163-
- uses: actions/download-artifact@v3
192+
- uses: actions/download-artifact@v4
164193
with:
165194
name: wheels
166195
path: wheelhouse/
@@ -172,13 +201,13 @@ jobs:
172201
Release:
173202
if: github.event_name == 'release' && !github.event.release.prerelease
174203
needs: [Build, Test]
175-
runs-on: ubuntu-20.04
204+
runs-on: ubuntu-22.04
176205
environment: opencv-python-release
177206
defaults:
178207
run:
179208
shell: bash
180209
steps:
181-
- uses: actions/download-artifact@v3
210+
- uses: actions/download-artifact@v4
182211
with:
183212
name: wheels
184213
path: wheelhouse/

0 commit comments

Comments
 (0)