Skip to content

Commit 6336ca8

Browse files
author
Andrey Senyaev
committed
Split workflows according to platforms
1 parent 5d27451 commit 6336ca8

File tree

4 files changed

+454
-177
lines changed

4 files changed

+454
-177
lines changed

.github/workflows/build_wheels.yml renamed to .github/workflows/build_wheels_linux.yml

+4-177
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build PYPI wheels for opencv-python
1+
name: Build PYPI wheels for opencv-python on Linux x86_64
22

33
on:
44
pull_request:
@@ -9,75 +9,6 @@ on:
99

1010

1111
jobs:
12-
build-windows-x86_64:
13-
runs-on: ${{ matrix.os }}
14-
defaults:
15-
run:
16-
shell: powershell
17-
18-
strategy:
19-
fail-fast: false
20-
matrix:
21-
os: [windows-latest]
22-
python-version: [3.6, 3.7, 3.8, 3.9]
23-
platform: [x86, x64]
24-
with_contrib: [0, 1]
25-
without_gui: [0, 1]
26-
build_sdist: [0]
27-
28-
env:
29-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
30-
SDIST: ${{ matrix.build_sdist || 0}}
31-
ENABLE_HEADLESS: ${{ matrix.without_gui }}
32-
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
33-
34-
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v2
37-
with:
38-
submodules: true
39-
fetch-depth: 0
40-
41-
- name: Update submodules
42-
run: |
43-
git submodule update --remote
44-
45-
- name: Set up Python ${{ matrix.python-version }}
46-
uses: actions/setup-python@v2
47-
with:
48-
python-version: ${{ matrix.python-version }}
49-
architecture: ${{ matrix.platform }}
50-
51-
- name: Setup MSBuild.exe
52-
uses: warrenbuckley/Setup-MSBuild@v1
53-
54-
- name: build script
55-
run: |
56-
python --version
57-
python -m pip install --upgrade pip
58-
python -m pip install --upgrade setuptools
59-
set "CI_BUILD=1" && python -m pip wheel --wheel-dir=%cd%\wheelhouse . --verbose
60-
shell: cmd
61-
62-
- name: before test
63-
run: |
64-
cd ${{ github.workspace }}/tests
65-
&python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl")
66-
if ($LastExitCode -ne 0) {throw $LastExitCode}
67-
shell: powershell
68-
69-
- name: run test
70-
run: |
71-
cd ${{ github.workspace }}/tests
72-
python -m unittest test
73-
shell: cmd
74-
75-
- name: saving artifacts
76-
uses: actions/upload-artifact@v2
77-
with:
78-
name: wheels
79-
path: wheelhouse/opencv*.whl
80-
8112
build:
8213
runs-on: ${{ matrix.os }}
8314
defaults:
@@ -87,7 +18,7 @@ jobs:
8718
strategy:
8819
fail-fast: false
8920
matrix:
90-
os: [ubuntu-latest, macos-latest]
21+
os: [ubuntu-latest]
9122
python-version: [3.6, 3.7, 3.8, 3.9]
9223
platform: [x64]
9324
with_contrib: [0, 1]
@@ -246,113 +177,9 @@ jobs:
246177
name: wheels
247178
path: dist/opencv*.tar.gz
248179

249-
build_arm:
250-
runs-on: ${{ matrix.os }}
251-
defaults:
252-
run:
253-
shell: bash
254-
255-
strategy:
256-
fail-fast: false
257-
matrix:
258-
os: [ARM64]
259-
python-version: [3.6, 3.7, 3.8, 3.9]
260-
platform: [x64]
261-
with_contrib: [0, 1]
262-
without_gui: [0, 1]
263-
build_sdist: [0]
264-
265-
env:
266-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
267-
REPO_DIR: .
268-
BUILD_COMMIT: master
269-
PROJECT_SPEC: opencv-python
270-
MB_PYTHON_VERSION: ${{ matrix.python-version }}
271-
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
272-
PLAT: aarch64
273-
MB_ML_VER: 2014
274-
NP_TEST_DEP: numpy
275-
TRAVIS_BUILD_DIR: ${{ github.workspace }}
276-
CONFIG_PATH: travis_config.sh
277-
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
278-
DOCKER_TEST_IMAGE: multibuild/xenial_arm64v8
279-
USE_CCACHE: 0
280-
UNICODE_WIDTH: 32
281-
SDIST: ${{ matrix.build_sdist || 0}}
282-
ENABLE_HEADLESS: ${{ matrix.without_gui }}
283-
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
284-
285-
steps:
286-
- name: Cleanup
287-
if: always()
288-
uses: AutoModality/action-clean@v1
289-
290-
- name: Checkout
291-
uses: actions/checkout@v2
292-
with:
293-
submodules: true
294-
fetch-depth: 0
295-
296-
- name: Setup Environment variables
297-
run: |
298-
if [ "ARM64" == "${{ matrix.os }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; fi
299-
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
300-
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
301-
302-
- name: before install
303-
run: |
304-
set -e
305-
if [[ $SDIST == 0 ]]; then
306-
# Check out and prepare the source
307-
# Multibuild doesn't have releases, so --depth would break eventually (see
308-
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
309-
git submodule update --init multibuild
310-
source multibuild/common_utils.sh
311-
# https://github.com/matthew-brett/multibuild/issues/116
312-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
313-
source multibuild/travis_steps.sh
314-
# This sets -x
315-
# source travis_multibuild_customize.sh
316-
echo $ENABLE_CONTRIB > contrib.enabled
317-
echo $ENABLE_HEADLESS > headless.enabled
318-
echo "end"
319-
# Not interested in travis internal scripts' output
320-
fi
321-
set +x
322-
# Build and package
323-
set -x
324-
ls
325-
if [[ $SDIST == 1 ]]; then
326-
python -m pip install --upgrade pip
327-
python -m pip install scikit-build
328-
python setup.py sdist
329-
else
330-
build_wheel $REPO_DIR $PLAT
331-
fi
332-
set +x
333-
# Install and run tests
334-
set -x
335-
if [[ $SDIST == 1 ]]; then
336-
echo "skipping tests because of sdist"
337-
rc=0
338-
else
339-
install_run $PLAT && rc=$? || rc=$?
340-
fi
341-
set +x
342-
#otherwise, Travis logic terminates prematurely
343-
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
344-
trap ERR
345-
test "$rc" -eq 0
346-
347-
- name: saving artifacts
348-
uses: actions/upload-artifact@v2
349-
with:
350-
name: wheels
351-
path: wheelhouse/opencv*.whl
352-
353180
test_release_opencv_python:
354181
if: github.event_name == 'release' && github.event.release.prerelease
355-
needs: [build, build-windows-x86_64, build_sdist, build_arm]
182+
needs: [build, build_sdist]
356183
runs-on: ubuntu-latest
357184
environment: test-opencv-python-release
358185
defaults:
@@ -371,7 +198,7 @@ jobs:
371198
372199
release_opencv_python:
373200
if: github.event_name == 'release' && !github.event.release.prerelease
374-
needs: [build, build-windows-x86_64, build_sdist, build_arm]
201+
needs: [build, build_sdist]
375202
runs-on: ubuntu-latest
376203
environment: opencv-python-release
377204
defaults:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: Build PYPI wheels for opencv-python on Linux ARM
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
release:
8+
types: [published, edited]
9+
10+
11+
jobs:
12+
build_arm:
13+
runs-on: ${{ matrix.os }}
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ARM64]
22+
python-version: [3.6, 3.7, 3.8, 3.9]
23+
platform: [x64]
24+
with_contrib: [0, 1]
25+
without_gui: [0, 1]
26+
build_sdist: [0]
27+
28+
env:
29+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
30+
REPO_DIR: .
31+
BUILD_COMMIT: master
32+
PROJECT_SPEC: opencv-python
33+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
34+
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
35+
PLAT: aarch64
36+
MB_ML_VER: 2014
37+
NP_TEST_DEP: numpy
38+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
39+
CONFIG_PATH: travis_config.sh
40+
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
41+
DOCKER_TEST_IMAGE: multibuild/xenial_arm64v8
42+
USE_CCACHE: 0
43+
UNICODE_WIDTH: 32
44+
SDIST: ${{ matrix.build_sdist || 0}}
45+
ENABLE_HEADLESS: ${{ matrix.without_gui }}
46+
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
47+
48+
steps:
49+
- name: Cleanup
50+
if: always()
51+
uses: AutoModality/action-clean@v1
52+
53+
- name: Checkout
54+
uses: actions/checkout@v2
55+
with:
56+
submodules: true
57+
fetch-depth: 0
58+
59+
- name: Setup Environment variables
60+
run: |
61+
if [ "ARM64" == "${{ matrix.os }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; fi
62+
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
63+
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
64+
65+
- name: before install
66+
run: |
67+
set -e
68+
if [[ $SDIST == 0 ]]; then
69+
# Check out and prepare the source
70+
# Multibuild doesn't have releases, so --depth would break eventually (see
71+
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
72+
git submodule update --init multibuild
73+
source multibuild/common_utils.sh
74+
# https://github.com/matthew-brett/multibuild/issues/116
75+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
76+
source multibuild/travis_steps.sh
77+
# This sets -x
78+
# source travis_multibuild_customize.sh
79+
echo $ENABLE_CONTRIB > contrib.enabled
80+
echo $ENABLE_HEADLESS > headless.enabled
81+
echo "end"
82+
# Not interested in travis internal scripts' output
83+
fi
84+
set +x
85+
# Build and package
86+
set -x
87+
ls
88+
if [[ $SDIST == 1 ]]; then
89+
python -m pip install --upgrade pip
90+
python -m pip install scikit-build
91+
python setup.py sdist
92+
else
93+
build_wheel $REPO_DIR $PLAT
94+
fi
95+
set +x
96+
# Install and run tests
97+
set -x
98+
if [[ $SDIST == 1 ]]; then
99+
echo "skipping tests because of sdist"
100+
rc=0
101+
else
102+
install_run $PLAT && rc=$? || rc=$?
103+
fi
104+
set +x
105+
#otherwise, Travis logic terminates prematurely
106+
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
107+
trap ERR
108+
test "$rc" -eq 0
109+
110+
- name: saving artifacts
111+
uses: actions/upload-artifact@v2
112+
with:
113+
name: wheels
114+
path: wheelhouse/opencv*.whl
115+
116+
test_release_opencv_python:
117+
if: github.event_name == 'release' && github.event.release.prerelease
118+
needs: [build_arm]
119+
runs-on: ubuntu-latest
120+
environment: test-opencv-python-release
121+
defaults:
122+
run:
123+
shell: bash
124+
steps:
125+
- uses: actions/download-artifact@v2
126+
with:
127+
name: wheels
128+
path: wheelhouse/
129+
130+
- name: Upload all wheels
131+
run: |
132+
python -m pip install twine
133+
python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
134+
135+
release_opencv_python:
136+
if: github.event_name == 'release' && !github.event.release.prerelease
137+
needs: [build_arm]
138+
runs-on: ubuntu-latest
139+
environment: opencv-python-release
140+
defaults:
141+
run:
142+
shell: bash
143+
steps:
144+
- uses: actions/download-artifact@v2
145+
with:
146+
name: wheels
147+
path: wheelhouse/
148+
149+
- name: Upload wheels for opencv_python
150+
run: |
151+
python -m pip install twine
152+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-*
153+
154+
- name: Upload wheels for opencv_contrib_python
155+
run: |
156+
python -m pip install twine
157+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-*
158+
159+
- name: Upload wheels for opencv_python_headless
160+
run: |
161+
python -m pip install twine
162+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-*
163+
164+
- name: Upload wheels for opencv_contrib_python_headless
165+
run: |
166+
python -m pip install twine
167+
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)