Skip to content

Commit 7a751f7

Browse files
authored
Merge pull request #483 from asenyaev/asen/arm_build
Add arm build to GitHub Actions
2 parents ffd6b4b + 83deed8 commit 7a751f7

11 files changed

+498
-117
lines changed

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

+22-113
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]
@@ -102,63 +33,41 @@ jobs:
10233
MB_PYTHON_VERSION: ${{ matrix.python-version }}
10334
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
10435
MB_ML_VER: 2014
105-
NP_TEST_DEP: numpy
36+
NP_TEST_DEP: numpy==1.19.4
10637
TRAVIS_BUILD_DIR: ${{ github.workspace }}
10738
CONFIG_PATH: travis_config.sh
10839
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
10940
USE_CCACHE: 1
11041
UNICODE_WIDTH: 32
111-
SDIST: ${{ matrix.build_sdist || 0}}
42+
SDIST: ${{ matrix.build_sdist || 0 }}
11243
ENABLE_HEADLESS: ${{ matrix.without_gui }}
11344
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
11445

11546
steps:
11647
- name: Checkout
11748
uses: actions/checkout@v2
11849
with:
119-
submodules: true
50+
submodules: false
12051
fetch-depth: 0
12152

12253
- name: Update submodules
123-
run: |
124-
git submodule update --remote
125-
126-
- name: Set up Python ${{ matrix.python-version }}
127-
uses: actions/setup-python@v2
128-
if: ${{ 'macos-latest' == matrix.os }}
129-
with:
130-
python-version: ${{ matrix.python-version }}
131-
architecture: ${{ matrix.platform }}
54+
if: github.event_name == 'pull_request'
55+
run: git submodule update --remote
13256

13357
- name: Setup Environment variables
13458
run: |
135-
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
13659
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
13760
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
13861
if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi
139-
if [ "x86" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; fi
14062
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
14163
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
14264
143-
- name: before install
144-
run: |
145-
set -e
146-
# Check out and prepare the source
147-
# Multibuild doesn't have releases, so --depth would break eventually (see
148-
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
149-
git submodule update --init multibuild
150-
source multibuild/common_utils.sh
151-
# https://github.com/matthew-brett/multibuild/issues/116
152-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
153-
source multibuild/travis_steps.sh
154-
# This sets -x
155-
# source travis_multibuild_customize.sh
156-
echo $ENABLE_CONTRIB > contrib.enabled
157-
echo $ENABLE_HEADLESS > headless.enabled
158-
set -x
159-
build_wheel $REPO_DIR $PLAT
160-
install_run $PLAT
161-
set +x
65+
- name: build
66+
run: source scripts/build.sh
67+
68+
- name: install and test
69+
run: source scripts/install.sh
70+
16271
- name: saving artifacts
16372
uses: actions/upload-artifact@v2
16473
with:
@@ -191,26 +100,26 @@ jobs:
191100
MB_PYTHON_VERSION: ${{ matrix.python-version }}
192101
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
193102
MB_ML_VER: 2014
194-
NP_TEST_DEP: numpy
103+
NP_TEST_DEP: numpy==1.19.4
195104
TRAVIS_BUILD_DIR: ${{ github.workspace }}
196105
CONFIG_PATH: travis_config.sh
197106
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
198107
USE_CCACHE: 1
199108
UNICODE_WIDTH: 32
200-
SDIST: ${{ matrix.build_sdist || 0}}
109+
SDIST: ${{ matrix.build_sdist || 0 }}
201110
ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }}
202-
ENABLE_CONTRIB: ${{ matrix.with_contrib || 0}}
111+
ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }}
203112

204113
steps:
205114
- name: Checkout
206115
uses: actions/checkout@v2
207116
with:
208-
submodules: true
117+
submodules: false
209118
fetch-depth: 0
210119

211120
- name: Update submodules
212-
run: |
213-
git submodule update --remote
121+
if: github.event_name == 'pull_request'
122+
run: git submodule update --remote
214123

215124
- name: Set up Python ${{ matrix.python-version }}
216125
uses: actions/setup-python@v2
@@ -220,7 +129,6 @@ jobs:
220129

221130
- name: Setup Environment variables
222131
run: |
223-
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
224132
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
225133
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
226134
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
@@ -238,6 +146,7 @@ jobs:
238146
# Install and run tests
239147
set -x
240148
echo "skipping tests because of sdist"
149+
241150
- name: saving artifacts
242151
uses: actions/upload-artifact@v2
243152
with:
@@ -246,7 +155,7 @@ jobs:
246155

247156
test_release_opencv_python:
248157
if: github.event_name == 'release' && github.event.release.prerelease
249-
needs: [build, build-windows-x86_64, build_sdist]
158+
needs: [build, build_sdist]
250159
runs-on: ubuntu-latest
251160
environment: test-opencv-python-release
252161
defaults:
@@ -265,7 +174,7 @@ jobs:
265174
266175
release_opencv_python:
267176
if: github.event_name == 'release' && !github.event.release.prerelease
268-
needs: [build, build-windows-x86_64, build_sdist]
177+
needs: [build, build_sdist]
269178
runs-on: ubuntu-latest
270179
environment: opencv-python-release
271180
defaults:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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==1.19.4
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: false
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: build
66+
run: source scripts/build.sh
67+
68+
- name: install and test
69+
run: source scripts/install.sh
70+
71+
- name: saving artifacts
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: wheels
75+
path: wheelhouse/opencv*.whl
76+
77+
test_release_opencv_python:
78+
if: github.event_name == 'release' && github.event.release.prerelease
79+
needs: [build_arm]
80+
runs-on: ubuntu-latest
81+
environment: test-opencv-python-release
82+
defaults:
83+
run:
84+
shell: bash
85+
steps:
86+
- uses: actions/download-artifact@v2
87+
with:
88+
name: wheels
89+
path: wheelhouse/
90+
91+
- name: Upload all wheels
92+
run: |
93+
python -m pip install twine
94+
python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
95+
96+
release_opencv_python:
97+
if: github.event_name == 'release' && !github.event.release.prerelease
98+
needs: [build_arm]
99+
runs-on: ubuntu-latest
100+
environment: opencv-python-release
101+
defaults:
102+
run:
103+
shell: bash
104+
steps:
105+
- uses: actions/download-artifact@v2
106+
with:
107+
name: wheels
108+
path: wheelhouse/
109+
110+
- name: Upload wheels for opencv_python
111+
run: |
112+
python -m pip install twine
113+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-*
114+
115+
- name: Upload wheels for opencv_contrib_python
116+
run: |
117+
python -m pip install twine
118+
python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-*
119+
120+
- name: Upload wheels for opencv_python_headless
121+
run: |
122+
python -m pip install twine
123+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-*
124+
125+
- name: Upload wheels for opencv_contrib_python_headless
126+
run: |
127+
python -m pip install twine
128+
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)