Skip to content

Commit c34cbfa

Browse files
author
Andrey Senyaev
committed
Added arm build
1 parent 88c1735 commit c34cbfa

File tree

4 files changed

+123
-6
lines changed

4 files changed

+123
-6
lines changed

.github/workflows/build_wheels.yml

+108-2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ jobs:
159159
build_wheel $REPO_DIR $PLAT
160160
install_run $PLAT
161161
set +x
162+
162163
- name: saving artifacts
163164
uses: actions/upload-artifact@v2
164165
with:
@@ -238,15 +239,120 @@ jobs:
238239
# Install and run tests
239240
set -x
240241
echo "skipping tests because of sdist"
242+
241243
- name: saving artifacts
242244
uses: actions/upload-artifact@v2
243245
with:
244246
name: wheels
245247
path: dist/opencv*.tar.gz
246248

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: [jetson]
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 [ "jetson" == "${{ 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+
247353
test_release_opencv_python:
248354
if: github.event_name == 'release' && github.event.release.prerelease
249-
needs: [build, build-windows-x86_64, build_sdist]
355+
needs: [build, build-windows-x86_64, build_sdist, build_arm]
250356
runs-on: ubuntu-latest
251357
environment: test-opencv-python-release
252358
defaults:
@@ -265,7 +371,7 @@ jobs:
265371
266372
release_opencv_python:
267373
if: github.event_name == 'release' && !github.event.release.prerelease
268-
needs: [build, build-windows-x86_64, build_sdist]
374+
needs: [build, build-windows-x86_64, build_sdist, build_arm]
269375
runs-on: ubuntu-latest
270376
environment: opencv-python-release
271377
defaults:

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "multibuild"]
88
path = multibuild
99
url = https://github.com/matthew-brett/multibuild.git
10+
[submodule "opencv_extra"]
11+
path = opencv_extra
12+
url = https://github.com/opencv/opencv_extra.git

opencv_extra

Submodule opencv_extra added at 3b033d0

travis_config.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,31 @@ function run_tests {
146146
echo "Run tests..."
147147
echo $PWD
148148

149+
PYTHON=python$PYTHON_VERSION
150+
149151
if [ -n "$IS_OSX" ]; then
150152
echo "Running for OS X"
151-
cd ../tests/
153+
cd ../opencv/
154+
export OPENCV_TEST_DATA_PATH=../opencv_extra/testdata
152155
else
153156
echo "Running for linux"
154-
cd /io/tests/
157+
158+
if [ $PYTHON == "python3.6" ]; then
159+
$PYTHON -m pip install -U numpy==1.19.4
160+
fi
161+
cd /io/opencv
162+
export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata
155163
fi
156164

157165
test_wheels
158166
}
159167

160168
function test_wheels {
161-
PYTHON=python$PYTHON_VERSION
162169

163170
echo "Starting tests..."
164171

165172
#Test package
166-
$PYTHON -m unittest test
173+
$PYTHON modules/python/test/test.py -v --repo .
167174
}
168175

169176
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'

0 commit comments

Comments
 (0)