From 3ac27ad2f3648e4c750a4c3230171713cd2d1edf Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 01:23:49 +0300 Subject: [PATCH 1/9] Updated dependecies for the next release --- .github/workflows/build_wheels_linux.yml | 4 +- .github/workflows/build_wheels_linux_arm.yml | 2 +- docker/manylinux2014/Dockerfile_aarch64 | 77 +++++++++++++++---- docker/manylinux2014/Dockerfile_x86_64 | 79 ++++++++++++++++---- setup.py | 1 - travis_config.sh | 5 -- 6 files changed, 127 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index a368661d..fac5ebad 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -39,7 +39,7 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 PLAT: x86_64 @@ -145,7 +145,7 @@ jobs: NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index a97bbc29..c58e0631 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -40,7 +40,7 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index b380d3ba..fedf1e98 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -2,29 +2,60 @@ FROM quay.io/pypa/manylinux2014_aarch64:latest ARG CCACHE_VERSION=3.7.9 ARG FFMPEG_VERSION=4.4.1 +ARG FREETYPE_VERSION=2.12.1 +ARG LIBPNG_VERSION=1.6.37 ARG NASM_VERSION=2.15.04 -ARG OPENSSL_VERSION=1_1_1m +ARG OPENSSL_VERSION=1_1_1o ARG QT_VERSION=5.15.0 ARG YASM_VERSION=1.3.0 -RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel freetype-devel -y +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH + +# epel-release need for aarch64 to get openblas packages +RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ + yum install openblas-devel -y && \ + cp /usr/include/lapacke/lapacke*.h /usr/include/ && \ + curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \ + # libpng will be built from source + yum remove libpng -y + +RUN mkdir ~/libpng_sources && \ + cd ~/libpng_sources && \ + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ + cd libpng-${LIBPNG_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/libpng_sources + +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ + cd freetype-${FREETYPE_VERSION} && \ + ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/freetype_sources RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \ tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \ - cd qt-everywhere* && \ + cd qt-everywhere-src-${QT_VERSION} && \ export MAKEFLAGS=-j$(nproc) && \ ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ make && \ make install && \ cd .. && \ - rm -rf qt-everywhere-src-${QT_VERSION} && \ - rm qt-everywhere-src-${QT_VERSION}.tar.xz + rm -rf qt-everywhere* ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" -RUN mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ +RUN mkdir ~/openssl_sources && \ + cd ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ @@ -32,31 +63,40 @@ RUN mkdir ~/ffmpeg_sources && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ - rm -rf ~/openssl_build + cd .. && \ + rm -rf ~/openssl_build ~/openssl_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/nasm_sources && \ + cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/yasm_sources && \ + cd ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/yasm_sources -RUN cd ~/ffmpeg_sources && \ - git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ +RUN mkdir ~/libvpx_sources && \ + cd ~/libvpx_sources && \ + git clone --depth 1 https://github.com/webmproject/libvpx.git && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ @@ -66,7 +106,8 @@ RUN cd ~/ffmpeg_sources && \ make install && \ echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ - rm -rf ~/ffmpeg_sources + rm -rf ~/ffmpeg_sources && \ + yum remove bzip2-devel -y RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \ tar -xf ccache-${CCACHE_VERSION}.tar.gz && \ @@ -75,6 +116,10 @@ RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERS make -j$(getconf _NPROCESSORS_ONLN) && \ make install +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN mkdir /io && \ + git config --global --add safe.directory /io + ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig ENV LDFLAGS -L/root/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH" diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64 index fb367c0a..13325756 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,29 +1,60 @@ FROM quay.io/pypa/manylinux2014_x86_64:latest ARG FFMPEG_VERSION=4.4.1 +ARG FREETYPE_VERSION=2.12.1 +ARG LIBPNG_VERSION=1.6.37 ARG NASM_VERSION=2.15.04 -ARG OPENSSL_VERSION=1_1_1m +ARG OPENSSL_VERSION=1_1_1o ARG QT_VERSION=5.15.0 ARG YASM_VERSION=1.3.0 -RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel freetype-devel -y +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH + +# epel-release need for aarch64 to get openblas packages +RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ + yum install openblas-devel -y && \ + cp /usr/include/lapacke/lapacke*.h /usr/include/ && \ + curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \ + # libpng will be built from source + yum remove libpng -y + +RUN mkdir ~/libpng_sources && \ + cd ~/libpng_sources && \ + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ + cd libpng-${LIBPNG_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/libpng_sources + +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ + cd freetype-${FREETYPE_VERSION} && \ + ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/freetype_sources RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \ tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \ - cd qt-everywhere* && \ + cd qt-everywhere-src-${QT_VERSION} && \ export MAKEFLAGS=-j$(nproc) && \ ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ make && \ make install && \ cd .. && \ - rm -rf qt-everywhere-src-${QT_VERSION} && \ - rm qt-everywhere-src-${QT_VERSION}.tar.xz + rm -rf qt-everywhere* ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" -RUN mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ +RUN mkdir ~/openssl_sources && \ + cd ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ @@ -31,31 +62,42 @@ RUN mkdir ~/ffmpeg_sources && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ - rm -rf ~/openssl_build + cd .. && \ + rm -rf ~/openssl_build ~/openssl_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/nasm_sources && \ + cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/yasm_sources && \ + cd ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/yasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/libvpx_sources && \ + cd ~/libvpx_sources && \ git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/libvpx_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ @@ -65,7 +107,12 @@ RUN cd ~/ffmpeg_sources && \ make install && \ echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ - rm -rf ~/ffmpeg_sources + rm -rf ~/ffmpeg_sources && \ + yum remove bzip2-devel -y + +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN mkdir /io && \ + git config --global --add safe.directory /io ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig ENV LDFLAGS -L/root/ffmpeg_build/lib diff --git a/setup.py b/setup.py index 02d991b9..e9255907 100644 --- a/setup.py +++ b/setup.py @@ -161,7 +161,6 @@ def main(): "-DBUILD_DOCS=OFF", "-DPYTHON3_LIMITED_API=ON", "-DBUILD_OPENEXR=ON", - "-DBUILD_PNG=ON", ] + ( # If it is not defined 'linker flags: /machine:X86' on Windows x64 diff --git a/travis_config.sh b/travis_config.sh index 4560f726..366d35ad 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -98,11 +98,6 @@ function pre_build { if [ -n "$IS_OSX" ]; then brew install lapack - else - # epel-release need for aarch64 to get openblas packages - yum install -y lapack-devel epel-release && yum install -y openblas-devel - cp /usr/include/lapacke/lapacke*.h /usr/include/ - curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h fi if [ -n "$IS_OSX" ]; then From 4f8289d4627a42621303d9fce6f46b630950186e Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 10:48:58 +0300 Subject: [PATCH 2/9] Updated dependecies for the next release --- docker/manylinux2014/Dockerfile_aarch64 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index fedf1e98..03889a51 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -93,7 +93,9 @@ RUN mkdir ~/libvpx_sources && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/libvpx_sources RUN mkdir ~/ffmpeg_sources && \ cd ~/ffmpeg_sources && \ @@ -114,7 +116,9 @@ RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERS cd ccache-${CCACHE_VERSION} && \ linux32 ./configure && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz # Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced RUN mkdir /io && \ From 9ec924e1818c9ee755458cb8ac71fd2475d0153d Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 13:31:34 +0300 Subject: [PATCH 3/9] Updated submodules to the latest commits --- opencv | 2 +- opencv_contrib | 2 +- opencv_extra | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opencv b/opencv index dad26339..d6151eae 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit dad26339a975b49cfb6c7dbe4bd5276c9dcb36e2 +Subproject commit d6151eae23aebdb3fce524a86026c2753daed685 diff --git a/opencv_contrib b/opencv_contrib index 49e8f123..84f8ea8e 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit 49e8f123ca08e76891856a1ecce491b62d08ba20 +Subproject commit 84f8ea8e99f98d8ab7868dbd29cccb6bdd26fb94 diff --git a/opencv_extra b/opencv_extra index 37294e3c..c2cf721e 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit 37294e3c876a72c992d4718b9bbfc8346b9e779a +Subproject commit c2cf721e3b8ce535900bc0f97a5cd17efb35361e From df365e5d8ca5cc0b4b29e26fdcc1837a38e8318e Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 13:33:43 +0300 Subject: [PATCH 4/9] Check changes on 3.4 branch in PRs --- .github/workflows/build_wheels_linux.yml | 1 + .github/workflows/build_wheels_linux_arm.yml | 1 + .github/workflows/build_wheels_macos.yml | 1 + .github/workflows/build_wheels_macos_m1.yml | 1 + .github/workflows/build_wheels_windows.yml | 1 + 5 files changed, 5 insertions(+) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index fac5ebad..362001fb 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux_arm.yml' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index c58e0631..a892040b 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux.yml' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index bccec01f..c453ab85 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 9f7b0f37..1ac065f1 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 337c77b2..0dad17b5 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_macos*' From 5633cf319efadb628e8369b48834d74491c10b1a Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 14:09:35 +0300 Subject: [PATCH 5/9] Removed unused lines --- setup.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/setup.py b/setup.py index 37366d9a..11014d6b 100644 --- a/setup.py +++ b/setup.py @@ -374,21 +374,6 @@ def _classify_installed_files_override( print("Copying files from CMake output") - # lines for a proper work using pylint and an autocomplete in IDE - with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init: - opencv_init_lines = opencv_init.readlines() - extra_imports = ('\nfrom .cv2 import *\nfrom .cv2 import _registerMatType\nfrom . import mat_wrapper\nfrom . import gapi' - '\nfrom . import misc\nfrom . import utils\nfrom . import data\nfrom . import version\n') - free_line_after_imports = 6 - opencv_init_lines.insert(free_line_after_imports, extra_imports) - opencv_init_data = "" - for line in opencv_init_lines: - opencv_init_replacement = line.replace('importlib.import_module("cv2")', 'importlib.import_module("cv2.cv2")') - opencv_init_data = opencv_init_data + opencv_init_replacement - - with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'w') as opencv_final_init: - opencv_final_init.write(opencv_init_data) - # add lines from the old __init__.py file to the config file with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', '__init__.py'), 'r') as custom_init: custom_init_data = custom_init.read() From 04b1a52ac69811a33db2fb2110a03b2971c110e5 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Mon, 6 Jun 2022 00:48:04 +0300 Subject: [PATCH 6/9] Updated submodules to 4.6.0 release --- opencv | 2 +- opencv_contrib | 2 +- opencv_extra | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opencv b/opencv index d6151eae..b0dc4741 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit d6151eae23aebdb3fce524a86026c2753daed685 +Subproject commit b0dc474160e389b9c9045da5db49d03ae17c6a6b diff --git a/opencv_contrib b/opencv_contrib index 84f8ea8e..db16caf6 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit 84f8ea8e99f98d8ab7868dbd29cccb6bdd26fb94 +Subproject commit db16caf6ceee76b43b94c846be276e92a43e9700 diff --git a/opencv_extra b/opencv_extra index c2cf721e..936854e2 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit c2cf721e3b8ce535900bc0f97a5cd17efb35361e +Subproject commit 936854e2b666853d6d0732a8eabc2d699f4fa3d8 From 8d045058df0245039a8a8754d140a820548dedb8 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Wed, 8 Jun 2022 13:36:57 +0300 Subject: [PATCH 7/9] Changed format of an archive for source packages --- .github/workflows/build_wheels_linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 362001fb..5315e161 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -177,7 +177,7 @@ jobs: set -x python -m pip install --upgrade pip python -m pip install scikit-build - python setup.py sdist --formats=xztar + python setup.py sdist --formats=gztar set +x # Install and run tests set -x @@ -187,7 +187,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: wheels - path: dist/opencv*.tar.xz + path: dist/opencv*.tar.gz test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease From 54473f17f7c138d4632b003a5e6f736e80481572 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 24 Jun 2022 22:09:56 +1000 Subject: [PATCH 8/9] Updated multibuild to upgrade default 64-bit test image to focal --- .gitmodules | 2 +- multibuild | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 655467e8..7193d3b9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/opencv/opencv_contrib.git [submodule "multibuild"] path = multibuild - url = https://github.com/matthew-brett/multibuild.git + url = https://github.com/multi-build/multibuild.git [submodule "opencv_extra"] path = opencv_extra url = https://github.com/opencv/opencv_extra.git diff --git a/multibuild b/multibuild index b89bb903..bce1637e 160000 --- a/multibuild +++ b/multibuild @@ -1 +1 @@ -Subproject commit b89bb903e94308be79abefa4f436bf123ebb1313 +Subproject commit bce1637e202cb52b0e7ea42baa1cccc894b82806 From 4638ce51fa4ce1b8a8752acdb2320a8b328d275f Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Mon, 4 Jul 2022 16:08:39 +0300 Subject: [PATCH 9/9] Changed labeles for macOS ARM64 and Linux ARM64 builds (#681) * Changed labeles for macOS ARM64 and Linux ARM64 builds * Changed labeles for macOS ARM64 and Linux ARM64 builds * Added proper cleanup step for all workflows, removed unused lines, changed ubuntu-latest to ubuntu-20.04 * Updated docker images to work under non-root user, unified cleanup step --- .github/workflows/build_wheels_linux.yml | 53 +++++++------------- .github/workflows/build_wheels_linux_arm.yml | 41 ++++----------- .github/workflows/build_wheels_macos.yml | 31 +++--------- .github/workflows/build_wheels_macos_m1.yml | 31 ++++-------- .github/workflows/build_wheels_windows.yml | 51 +++++++------------ docker/manylinux2014/Dockerfile_aarch64 | 35 +++++++++---- docker/manylinux2014/Dockerfile_x86_64 | 45 +++++++++++++---- 7 files changed, 121 insertions(+), 166 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 5315e161..98ad3dc8 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -15,21 +15,18 @@ on: jobs: build: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -40,34 +37,32 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} - USE_CCACHE: 1 + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628 + USE_CCACHE: 0 UNICODE_WIDTH: 32 PLAT: x86_64 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Build a package run: source scripts/build.sh - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -76,21 +71,18 @@ jobs: test: needs: [build] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -98,42 +90,38 @@ jobs: NP_TEST_DEP_LATEST: numpy==1.21.2 CONFIG_PATH: travis_config.sh PLAT: x86_64 - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Setup Environment variables run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation and run tests run: source scripts/install.sh build_sdist: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: [3.8] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [1] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -146,30 +134,29 @@ jobs: NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628 USE_CCACHE: 1 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }} ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Build a package run: | set -e @@ -182,7 +169,6 @@ jobs: # Install and run tests set -x echo "skipping tests because of sdist" - - name: saving artifacts uses: actions/upload-artifact@v2 with: @@ -192,7 +178,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, build_sdist, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -202,7 +188,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -211,7 +196,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, build_sdist, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -221,22 +206,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* wheelhouse/opencv-python-[^h]* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* wheelhouse/opencv-contrib-python-[^h]* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* wheelhouse/opencv-python-headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index a892040b..4d0c3daf 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -15,21 +15,18 @@ on: jobs: build_arm: - runs-on: ${{ matrix.os }} + runs-on: opencv-cn-lin-arm64 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ARM64] python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -41,33 +38,30 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20220628 USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: UID + run: id -u - name: Cleanup - if: always() - uses: AutoModality/action-clean@v1 - + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Build a package run: source scripts/build.sh - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -76,21 +70,18 @@ jobs: test: needs: [build_arm] - runs-on: ${{ matrix.os }} + runs-on: opencv-cn-lin-arm64 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ARM64] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -100,34 +91,29 @@ jobs: CONFIG_PATH: travis_config.sh DOCKER_TEST_IMAGE: multibuild/focal_arm64v8 UNICODE_WIDTH: 32 - steps: - name: Cleanup - if: always() - uses: AutoModality/action-clean@v1 - + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Setup Environment variables run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation and run tests run: source scripts/install.sh test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build_arm, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -137,7 +123,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -146,7 +131,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build_arm, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -156,22 +141,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index c453ab85..af892101 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -19,7 +19,6 @@ jobs: defaults: run: shell: bash - strategy: fail-fast: false matrix: @@ -40,7 +39,6 @@ jobs: python-version: '3.8' - os: macos-11 python-version: '3.9' - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -60,18 +58,18 @@ jobs: SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Build a package run: | set -e @@ -89,13 +87,11 @@ jobs: echo $ENABLE_HEADLESS > headless.enabled set -x build_wheel $REPO_DIR $PLAT - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -108,7 +104,6 @@ jobs: defaults: run: shell: bash - strategy: fail-fast: false matrix: @@ -129,7 +124,6 @@ jobs: python-version: '3.8' - os: macos-11 python-version: '3.9' - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -139,40 +133,36 @@ jobs: PLAT: x86_64 OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Setup Environment variables run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation run: | python -m pip install wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests python get_build_info.py - - name: Run tests run: | cd ${{ github.workspace }}/opencv python modules/python/test/test.py -v --repo . - - name: Pylint test run: | python -m pip install pylint==2.12.2 @@ -182,7 +172,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -192,7 +182,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -201,7 +190,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -211,22 +200,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 1ac065f1..a1d7c924 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -15,35 +15,32 @@ on: jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: opencv-cn-mac-arm64 strategy: fail-fast: false matrix: - os: [macOS-M1] python-version: ['3.7'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: CI_BUILD: 1 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Build a package run: | git submodule update --init multibuild @@ -53,13 +50,11 @@ jobs: arch -arm64 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 arch -arm64 python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v delocate-wheel ${{ github.workspace }}/wheelhouse/opencv* - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -68,46 +63,41 @@ jobs: test: needs: [build] - runs-on: ${{ matrix.os }} - + runs-on: opencv-cn-mac-arm64-tests strategy: fail-fast: false matrix: - os: [macOS-M1] python-version: ['3.7', '3.8', '3.9', '3.10'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation run: | arch -arm64 python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests arch -arm64 python${{ matrix.python-version }} get_build_info.py - - name: Run tests run: | cd ${{ github.workspace }}/opencv arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo . - - name: Pylint test run: | arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2 @@ -117,7 +107,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -136,7 +126,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -146,7 +136,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 0dad17b5..087efc04 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -14,48 +14,43 @@ on: jobs: build-windows-x86_64: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: powershell - + runs-on: windows-2019 strategy: fail-fast: false matrix: - os: [windows-2019] python-version: ['3.6'] platform: [x86, x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata - steps: + - name: Cleanup + shell: bash + run: | + rm -rf ./* || true + rm -rf ./.??* || true + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Setup MSBuild.exe uses: microsoft/setup-msbuild@v1.1 - - name: Build a package run: | python --version @@ -64,13 +59,11 @@ jobs: 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 set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp36 --dist-dir=%cd%\wheelhouse -v shell: cmd - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -79,45 +72,44 @@ jobs: test: needs: [build-windows-x86_64] - runs-on: ${{ matrix.os }} + runs-on: windows-2019 defaults: run: - shell: powershell - + shell: cmd strategy: fail-fast: false matrix: - os: [windows-2019] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x86, x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py - steps: + - name: Cleanup + shell: bash + run: | + rm -rf ./* || true + rm -rf ./.??* || true + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} path: wheelhouse/ - - name: Package installation run: | cd ${{ github.workspace }}/tests @@ -125,24 +117,20 @@ jobs: if ($LastExitCode -ne 0) {throw $LastExitCode} python get_build_info.py shell: powershell - - name: Run tests run: | cd ${{ github.workspace }}/opencv python modules\python\test\test.py -v --repo . - shell: cmd - - name: Pylint test run: | python -m pip install pylint==2.12.2 cd ${{ github.workspace }}\tests python -m pylint $PYLINT_TEST_FILE - shell: cmd test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build-windows-x86_64, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -152,7 +140,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -161,7 +148,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build-windows-x86_64, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -171,22 +158,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index 03889a51..2679cbbf 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -1,3 +1,6 @@ +# Version: 20220628 +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64 + FROM quay.io/pypa/manylinux2014_aarch64:latest ARG CCACHE_VERSION=3.7.9 @@ -35,7 +38,7 @@ RUN mkdir ~/freetype_sources && \ curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ cd freetype-${FREETYPE_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \ make && \ make install && \ cd .. && \ @@ -59,7 +62,7 @@ RUN mkdir ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ - ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ @@ -70,7 +73,7 @@ RUN mkdir ~/nasm_sources && \ cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -81,7 +84,7 @@ RUN mkdir ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -91,7 +94,7 @@ RUN mkdir ~/libvpx_sources && \ cd ~/libvpx_sources && \ git clone --depth 1 https://github.com/webmproject/libvpx.git && \ cd libvpx && \ - ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ + ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -103,10 +106,10 @@ RUN mkdir ~/ffmpeg_sources && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ - PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ rm -rf ~/ffmpeg_sources && \ yum remove bzip2-devel -y @@ -120,10 +123,20 @@ RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERS cd .. && \ rm -rf ccache-${CCACHE_VERSION}.tar.gz +# Self-hosted runner UID is 1004 +RUN useradd ci -m -s /bin/bash -G users --uid=1004 && \ + mkdir /io && \ + chown -R ci:ci /io && \ + # This needs to find ffmpeg packages from ci user + chown -R ci:ci /ffmpeg_build && \ + # This calls in mutlibuild scripts and cannot be run without permissions + chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel + +USER ci + # Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced -RUN mkdir /io && \ - git config --global --add safe.directory /io +RUN git config --global --add safe.directory /io -ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig -ENV LDFLAGS -L/root/ffmpeg_build/lib +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH" diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64 index 13325756..8bb77341 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,5 +1,9 @@ +# Version: 20220628 +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64 + FROM quay.io/pypa/manylinux2014_x86_64:latest +ARG CCACHE_VERSION=3.7.9 ARG FFMPEG_VERSION=4.4.1 ARG FREETYPE_VERSION=2.12.1 ARG LIBPNG_VERSION=1.6.37 @@ -34,7 +38,7 @@ RUN mkdir ~/freetype_sources && \ curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ cd freetype-${FREETYPE_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \ make && \ make install && \ cd .. && \ @@ -58,7 +62,7 @@ RUN mkdir ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ - ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ @@ -69,7 +73,7 @@ RUN mkdir ~/nasm_sources && \ cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -80,7 +84,7 @@ RUN mkdir ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -90,7 +94,7 @@ RUN mkdir ~/libvpx_sources && \ cd ~/libvpx_sources && \ git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ cd libvpx && \ - ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ + ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -102,18 +106,37 @@ RUN mkdir ~/ffmpeg_sources && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ - PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ rm -rf ~/ffmpeg_sources && \ yum remove bzip2-devel -y +RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \ + tar -xf ccache-${CCACHE_VERSION}.tar.gz && \ + cd ccache-${CCACHE_VERSION} && \ + ./configure && \ + make -j$(getconf _NPROCESSORS_ONLN) && \ + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz + +# GitHub Actions user`s UID is 1001 +RUN useradd ci -m -s /bin/bash -G users --uid=1001 && \ + mkdir /io && \ + chown -R ci:ci /io && \ + # This needs to find ffmpeg packages from ci user + chown -R ci:ci /ffmpeg_build && \ + # This calls in mutlibuild scripts and cannot be run without permissions + chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel + +USER ci + # Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced -RUN mkdir /io && \ - git config --global --add safe.directory /io +RUN git config --global --add safe.directory /io -ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig -ENV LDFLAGS -L/root/ffmpeg_build/lib +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH"