Skip to content

Commit eba69d8

Browse files
committed
Rename as release workflow, revert merging build/test jobs into one file, call in release workflow
1 parent 1a2136c commit eba69d8

7 files changed

Lines changed: 701 additions & 639 deletions

File tree

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: macOS x86_64
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 4.x
7+
- 5.x
8+
paths-ignore:
9+
- '.github/workflows/build_wheels_manylinux*'
10+
- '.github/workflows/build_wheels_windows*'
11+
- '.github/workflows/build_wheels_macos_m1.yml'
12+
workflow_call:
13+
inputs:
14+
enable-rolling:
15+
type: boolean
16+
workflow_dispatch:
17+
18+
19+
jobs:
20+
Build:
21+
runs-on: python-macos-intel
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ['3.9']
26+
platform: [x64]
27+
with_contrib: [0, 1]
28+
without_gui: [0, 1]
29+
build_sdist: [0]
30+
env:
31+
CI_BUILD: 1
32+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
33+
REPO_DIR: .
34+
PROJECT_SPEC: opencv-python
35+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
36+
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
37+
MB_ML_VER: 2014
38+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
39+
TRAVIS_OS_NAME: osx
40+
CONFIG_PATH: travis_config.sh
41+
USE_CCACHE: 1
42+
UNICODE_WIDTH: 32
43+
PLAT: x86_64
44+
SDIST: ${{ matrix.build_sdist || 0 }}
45+
ENABLE_HEADLESS: ${{ matrix.without_gui }}
46+
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
47+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
48+
steps:
49+
- name: Cleanup
50+
run: find . -mindepth 1 -delete
51+
working-directory: ${{ github.workspace }}
52+
- name: Setup environment
53+
run: |
54+
if [[ "${{ case(inputs.enable-rolling, '1', '') }}" ]] ; then
55+
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
56+
fi
57+
- name: Checkout
58+
uses: actions/checkout@v7
59+
with:
60+
submodules: false
61+
fetch-depth: 0
62+
- name: Build a package
63+
run: |
64+
git submodule update --init multibuild
65+
echo $ENABLE_CONTRIB > contrib.enabled
66+
echo $ENABLE_HEADLESS > headless.enabled
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*
71+
- name: Saving a wheel accordingly to matrix
72+
uses: actions/upload-artifact@v7
73+
with:
74+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
75+
path: wheelhouse/opencv*.whl
76+
77+
Test:
78+
needs: [Build]
79+
runs-on: python-macos-intel
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
84+
platform: [x64]
85+
with_contrib: [0, 1]
86+
without_gui: [0, 1]
87+
build_sdist: [0]
88+
env:
89+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
90+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
91+
NP_TEST_DEP: numpy==1.19.4
92+
NP_TEST_DEP_LATEST: numpy==2.2.6
93+
CONFIG_PATH: travis_config.sh
94+
PLAT: x86_64
95+
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
96+
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
97+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
98+
steps:
99+
- name: Cleanup
100+
run: find . -mindepth 1 -delete
101+
working-directory: ${{ github.workspace }}
102+
- name: Checkout
103+
uses: actions/checkout@v7
104+
with:
105+
submodules: true
106+
fetch-depth: 0
107+
- name: Download a wheel accordingly to matrix
108+
uses: actions/download-artifact@v8
109+
with:
110+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
111+
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
116+
- name: Package installation
117+
run: |
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
121+
cd ${{ github.workspace }}/tests
122+
python${{ matrix.python-version }} get_build_info.py
123+
- name: Run tests
124+
run: |
125+
source ${{ github.workspace }}/opencv_test/bin/activate
126+
cd ${{ github.workspace }}/opencv
127+
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
128+
- name: Pylint test
129+
run: |
130+
source ${{ github.workspace }}/opencv_test/bin/activate
131+
python${{ matrix.python-version }} -m pip install pylint==2.15.9
132+
cd ${{ github.workspace }}/tests
133+
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: macOS ARM64
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 4.x
7+
- 5.x
8+
paths-ignore:
9+
- '.github/workflows/build_wheels_manylinux*'
10+
- '.github/workflows/build_wheels_windows*'
11+
- '.github/workflows/build_wheels_macos.yml'
12+
workflow_call:
13+
inputs:
14+
enable-rolling:
15+
type: boolean
16+
workflow_dispatch:
17+
18+
19+
jobs:
20+
Build:
21+
runs-on: python-macos12-m1
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ['3.9']
26+
platform: [x64]
27+
with_contrib: [0, 1]
28+
without_gui: [0, 1]
29+
build_sdist: [0]
30+
env:
31+
CI_BUILD: 1
32+
SDIST: ${{ matrix.build_sdist || 0 }}
33+
ENABLE_HEADLESS: ${{ matrix.without_gui }}
34+
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
35+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
36+
steps:
37+
- name: Cleanup
38+
run: find . -mindepth 1 -delete
39+
working-directory: ${{ github.workspace }}
40+
- name: Setup environment
41+
run: |
42+
if [[ "${{ case(inputs.enable-rolling, '1', '') }}" ]]; then
43+
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
44+
fi
45+
- name: Checkout
46+
uses: actions/checkout@v7
47+
with:
48+
submodules: false
49+
fetch-depth: 0
50+
- name: Build a package
51+
run: |
52+
git submodule update --init multibuild
53+
echo $ENABLE_CONTRIB > contrib.enabled
54+
echo $ENABLE_HEADLESS > headless.enabled
55+
export MACOSX_DEPLOYMENT_TARGET=13.0
56+
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
57+
python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
58+
delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
59+
- name: Saving a wheel accordingly to matrix
60+
uses: actions/upload-artifact@v7
61+
with:
62+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
63+
path: wheelhouse/opencv*.whl
64+
65+
Test:
66+
needs: [Build]
67+
runs-on: python-macos12-m1
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
72+
platform: [x64]
73+
with_contrib: [0, 1]
74+
without_gui: [0, 1]
75+
build_sdist: [0]
76+
env:
77+
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
78+
PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
79+
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
80+
steps:
81+
- name: Cleanup
82+
run: find . -mindepth 1 -delete
83+
working-directory: ${{ github.workspace }}
84+
- name: Checkout
85+
uses: actions/checkout@v7
86+
with:
87+
submodules: true
88+
fetch-depth: 0
89+
- name: Download a wheel accordingly to matrix
90+
uses: actions/download-artifact@v8
91+
with:
92+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
93+
path: wheelhouse/
94+
- name: Create Venv for test
95+
run: |
96+
test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
97+
python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
98+
- name: Package installation
99+
run: |
100+
source ${{ github.workspace }}/opencv_test/bin/activate
101+
python${{ matrix.python-version }} -m pip install --upgrade pip
102+
python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
103+
cd ${{ github.workspace }}/tests
104+
python${{ matrix.python-version }} get_build_info.py
105+
- name: Run tests
106+
run: |
107+
source ${{ github.workspace }}/opencv_test/bin/activate
108+
cd ${{ github.workspace }}/opencv
109+
python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
110+
- name: Pylint test
111+
run: |
112+
source ${{ github.workspace }}/opencv_test/bin/activate
113+
python${{ matrix.python-version }} -m pip install pylint==2.15.9
114+
cd ${{ github.workspace }}/tests
115+
python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE

0 commit comments

Comments
 (0)