Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d509950

Browse files
authoredMay 12, 2025
Update build_wheels_windows.yml
1 parent 800c408 commit d509950

File tree

1 file changed

+120
-105
lines changed

1 file changed

+120
-105
lines changed
 

‎.github/workflows/build_wheels_windows.yml

Lines changed: 120 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- cron: '0 3 * * 6'
1717
workflow_dispatch:
1818

19+
1920
jobs:
2021
Build:
2122
runs-on: windows-2019
@@ -34,53 +35,52 @@ jobs:
3435
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
3536
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
3637
steps:
37-
- name: Cleanup
38-
shell: bash
39-
run: |
40-
rm -rf ./* || true
41-
rm -rf ./.??* || true
42-
working-directory: ${{ github.workspace }}
43-
44-
- name: Setup environment
45-
shell: bash
46-
run: |
47-
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
48-
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
49-
fi
50-
51-
- name: Checkout
52-
uses: actions/checkout@v3
53-
with:
54-
submodules: false
55-
fetch-depth: 0
56-
57-
- name: Set up Python ${{ matrix.python-version }}
58-
uses: actions/setup-python@v4
59-
with:
60-
python-version: ${{ matrix.python-version }}
61-
architecture: ${{ matrix.platform }}
62-
63-
- name: Setup MSBuild.exe
64-
uses: microsoft/setup-msbuild@v1.1
65-
66-
- name: Setup NASM
67-
uses: ilammy/setup-nasm@v1
68-
69-
- name: Build a package
70-
run: |
71-
python --version
72-
python -m pip install --upgrade pip
73-
python -m pip install --upgrade setuptools
74-
python -m pip install cmake==3.24.2
75-
python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
76-
set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
77-
shell: cmd
78-
79-
- name: Upload built wheel
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-${{ github.run_id }}-${{ github.job }}
83-
path: wheelhouse/opencv*.whl
38+
- name: Cleanup
39+
shell: bash
40+
run: |
41+
rm -rf ./* || true
42+
rm -rf ./.??* || true
43+
working-directory: ${{ github.workspace }}
44+
- name: Setup environment
45+
shell: bash
46+
run: |
47+
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
48+
echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
49+
fi
50+
- name: Checkout
51+
uses: actions/checkout@v3
52+
with:
53+
submodules: false
54+
fetch-depth: 0
55+
- name: Set up Python ${{ matrix.python-version }}
56+
uses: actions/setup-python@v4
57+
with:
58+
python-version: ${{ matrix.python-version }}
59+
architecture: ${{ matrix.platform }}
60+
- name: Setup MSBuild.exe
61+
uses: microsoft/setup-msbuild@v1.1
62+
- name: Setup NASM
63+
uses: ilammy/setup-nasm@v1
64+
- name: Build a package
65+
# CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version
66+
run: |
67+
python --version
68+
python -m pip install --upgrade pip
69+
python -m pip install --upgrade setuptools
70+
python -m pip install cmake==3.24.2
71+
python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
72+
set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
73+
shell: cmd
74+
- name: Saving all wheels
75+
uses: actions/upload-artifact@v3
76+
with:
77+
name: wheels
78+
path: wheelhouse/opencv*.whl
79+
- name: Saving a wheel accordingly to matrix
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
83+
path: wheelhouse/opencv*
8484

8585
Test:
8686
needs: [Build]
@@ -101,49 +101,43 @@ jobs:
101101
OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
102102
PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py
103103
steps:
104-
- name: Cleanup
105-
shell: bash
106-
run: |
107-
rm -rf ./* || true
108-
rm -rf ./.??* || true
109-
working-directory: ${{ github.workspace }}
110-
111-
- name: Checkout
112-
uses: actions/checkout@v3
113-
with:
114-
submodules: true
115-
fetch-depth: 0
116-
117-
- name: Set up Python ${{ matrix.python-version }}
118-
uses: actions/setup-python@v4
119-
with:
120-
python-version: ${{ matrix.python-version }}
121-
architecture: ${{ matrix.platform }}
122-
123-
- name: Download all artifacts
124-
uses: actions/download-artifact@v3
125-
with:
126-
path: wheelhouse/
127-
128-
- name: Find and install matching wheel
129-
shell: powershell
130-
run: |
131-
$pattern = "wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-*"
132-
$file = Get-ChildItem -Recurse wheelhouse | Where-Object { $_.Name -like "$pattern*.whl" } | Select-Object -First 1
133-
if (-not $file) { throw "No matching wheel found" }
134-
& python -m pip install --user --no-warn-script-location $file.FullName
135-
python get_build_info.py
136-
137-
- name: Run tests
138-
run: |
139-
cd ${{ github.workspace }}/opencv
140-
python modules\python\test\test.py -v --repo .
141-
142-
- name: Pylint test
143-
run: |
144-
python -m pip install pylint==2.15.9
145-
cd ${{ github.workspace }}\tests
146-
python -m pylint $PYLINT_TEST_FILE
104+
- name: Cleanup
105+
shell: bash
106+
run: |
107+
rm -rf ./* || true
108+
rm -rf ./.??* || true
109+
working-directory: ${{ github.workspace }}
110+
- name: Checkout
111+
uses: actions/checkout@v3
112+
with:
113+
submodules: true
114+
fetch-depth: 0
115+
- name: Set up Python ${{ matrix.python-version }}
116+
uses: actions/setup-python@v4
117+
with:
118+
python-version: ${{ matrix.python-version }}
119+
architecture: ${{ matrix.platform }}
120+
- name: Download a wheel accordingly to matrix
121+
uses: actions/download-artifact@v3
122+
with:
123+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
124+
path: wheelhouse/
125+
- name: Package installation
126+
run: |
127+
cd ${{ github.workspace }}/tests
128+
&python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl")
129+
if ($LastExitCode -ne 0) {throw $LastExitCode}
130+
python get_build_info.py
131+
shell: powershell
132+
- name: Run tests
133+
run: |
134+
cd ${{ github.workspace }}/opencv
135+
python modules\python\test\test.py -v --repo .
136+
- name: Pylint test
137+
run: |
138+
python -m pip install pylint==2.15.9
139+
cd ${{ github.workspace }}\tests
140+
python -m pylint $PYLINT_TEST_FILE
147141
148142
Release_rolling:
149143
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -154,15 +148,26 @@ jobs:
154148
run:
155149
shell: bash
156150
steps:
157-
- name: Download all wheels
158-
uses: actions/download-artifact@v3
151+
- uses: actions/download-artifact@v3
159152
with:
153+
name: wheels
160154
path: wheelhouse/
161-
162-
- name: Upload wheels
155+
- name: Upload wheels for opencv_python_rolling
163156
run: |
164157
python -m pip install twine
165-
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/**/*.whl
158+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
159+
- name: Upload wheels for opencv_contrib_python_rolling
160+
run: |
161+
python -m pip install twine
162+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
163+
- name: Upload wheels for opencv_python_headless_rolling
164+
run: |
165+
python -m pip install twine
166+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
167+
- name: Upload wheels for opencv_contrib_python_headless_rolling
168+
run: |
169+
python -m pip install twine
170+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
166171
167172
Pre-release:
168173
if: github.event_name == 'release' && github.event.release.prerelease
@@ -173,15 +178,14 @@ jobs:
173178
run:
174179
shell: bash
175180
steps:
176-
- name: Download all wheels
177-
uses: actions/download-artifact@v3
181+
- uses: actions/download-artifact@v3
178182
with:
183+
name: wheels
179184
path: wheelhouse/
180-
181-
- name: Upload all wheels to Test PyPI
185+
- name: Upload all wheels
182186
run: |
183187
python -m pip install twine
184-
python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/**/*.whl
188+
python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
185189
186190
Release:
187191
if: github.event_name == 'release' && !github.event.release.prerelease
@@ -192,12 +196,23 @@ jobs:
192196
run:
193197
shell: bash
194198
steps:
195-
- name: Download all wheels
196-
uses: actions/download-artifact@v3
199+
- uses: actions/download-artifact@v3
197200
with:
201+
name: wheels
198202
path: wheelhouse/
199-
200-
- name: Upload all wheels to PyPI
203+
- name: Upload wheels for opencv_python
204+
run: |
205+
python -m pip install twine
206+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-*
207+
- name: Upload wheels for opencv_contrib_python
208+
run: |
209+
python -m pip install twine
210+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-*
211+
- name: Upload wheels for opencv_python_headless
212+
run: |
213+
python -m pip install twine
214+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-*
215+
- name: Upload wheels for opencv_contrib_python_headless
201216
run: |
202217
python -m pip install twine
203-
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/**/*.whl
218+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-*

0 commit comments

Comments
 (0)
Please sign in to comment.