diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml new file mode 100644 index 00000000..cbed8b6c --- /dev/null +++ b/.github/workflows/build_wheels.yml @@ -0,0 +1,279 @@ +name: Build PYPI wheels for opencv-python + +on: + pull_request: + branches: + - master + release: + types: [published, edited] + + +jobs: + build-windows-x86_64: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: powershell + + strategy: + fail-fast: false + matrix: + os: [windows-latest] + python-version: [3.6, 3.7, 3.8, 3.9] + 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 }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Update submodules + 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: warrenbuckley/Setup-MSBuild@v1 + + - name: build script + run: | + python --version + python -m pip install --upgrade pip + python -m pip install --upgrade setuptools + set "CI_BUILD=1" && python -m pip wheel --wheel-dir=%cd%\wheelhouse . --verbose + shell: cmd + + - name: before test + run: | + cd ${{ github.workspace }}/tests + &python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl") + if ($LastExitCode -ne 0) {throw $LastExitCode} + shell: powershell + + - name: run test + run: | + cd ${{ github.workspace }}/tests + python -m unittest test + shell: cmd + + - name: saving artifacts + uses: actions/upload-artifact@v2 + with: + name: wheels + path: wheelhouse/opencv*.whl + + build: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + python-version: [3.6, 3.7, 3.8, 3.9] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + REPO_DIR: . + BUILD_COMMIT: master + PROJECT_SPEC: opencv-python + MB_PYTHON_VERSION: ${{ matrix.python-version }} + TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} + MB_ML_VER: 2014 + NP_TEST_DEP: numpy + TRAVIS_BUILD_DIR: ${{ github.workspace }} + CONFIG_PATH: travis_config.sh + DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT} + USE_CCACHE: 1 + UNICODE_WIDTH: 32 + SDIST: ${{ matrix.build_sdist || 0}} + ENABLE_HEADLESS: ${{ matrix.without_gui }} + ENABLE_CONTRIB: ${{ matrix.with_contrib }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Update submodules + run: | + git submodule update --remote + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + if: ${{ 'macos-latest' == matrix.os }} + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + + - name: Setup Environment variables + run: | + if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi + if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi + if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi + if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi + if [ "x86" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; fi + echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; + echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; + + - name: before install + run: | + set -e + # Check out and prepare the source + # Multibuild doesn't have releases, so --depth would break eventually (see + # https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised) + git submodule update --init multibuild + source multibuild/common_utils.sh + # https://github.com/matthew-brett/multibuild/issues/116 + if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi + source multibuild/travis_steps.sh + # This sets -x + # source travis_multibuild_customize.sh + echo $ENABLE_CONTRIB > contrib.enabled + echo $ENABLE_HEADLESS > headless.enabled + set -x + build_wheel $REPO_DIR $PLAT + install_run $PLAT + set +x + - name: saving artifacts + uses: actions/upload-artifact@v2 + with: + name: wheels + path: wheelhouse/opencv*.whl + + + build_sdist: + runs-on: ${{ matrix.os }} + 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: . + BUILD_COMMIT: master + PROJECT_SPEC: opencv-python + PLAT: x86_64 + MB_PYTHON_VERSION: ${{ matrix.python-version }} + TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} + MB_ML_VER: 2014 + NP_TEST_DEP: numpy + TRAVIS_BUILD_DIR: ${{ github.workspace }} + CONFIG_PATH: travis_config.sh + DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT} + 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: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Update submodules + 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 Environment variables + run: | + if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi + if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi + if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi + echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; + echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; + + - name: before install + run: | + set -e + # Build and package + set -x + python -m pip install --upgrade pip + python -m pip install scikit-build + python setup.py sdist + set +x + # Install and run tests + set -x + echo "skipping tests because of sdist" + - name: saving artifacts + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist/opencv*.tar.gz + + release_opencv_python: + if: startsWith(github.ref, 'refs/tags/v') + needs: [build, build-windows-x86_64, build_sdist] + runs-on: ubuntu-latest + environment: opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v2 + 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 + 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-* diff --git a/.travis.yml b/.travis.yml index 3c2efde8..6ba06d4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,6 @@ cache: # Add more cache stages (s2 etc) and corresponding OSX jobs like s1 # if brew builds start to take longer than one Travis time limit stages: - - s1 - final jobs: @@ -32,227 +31,7 @@ jobs: exclude: - language: ruby include: - # source distributions - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - python: "3.8" - language: python - dist: xenial - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - python: "3.8" - language: python - dist: xenial - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - python: "3.8" - language: python - dist: xenial - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - python: "3.8" - language: python - dist: xenial - - # default builds for MacOS - #further jobs in the list will use the same stage until the next assignment - - stage: final - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - - - # headless builds for MacOS - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - - - # Contrib builds for MacOS - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - - - # headless contrib builds for MacOS - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - - # default builds for Linux - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -268,30 +47,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -307,30 +62,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -346,30 +77,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -387,30 +94,6 @@ jobs: directories: $HOME/.ccache # headless builds for Linux - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -426,30 +109,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -465,30 +124,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -504,30 +139,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -545,30 +156,6 @@ jobs: directories: $HOME/.ccache # contrib builds for Linux - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -584,30 +171,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -623,30 +186,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -662,30 +201,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -704,30 +219,6 @@ jobs: # headless contrib builds for Linux - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -743,30 +234,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -782,30 +249,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -821,30 +264,6 @@ jobs: - USE_CCACHE=0 cache: directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - os: linux arch: arm64 language: generic @@ -969,23 +388,23 @@ after_success: | fi - # Save to Azure storage always + # # Save to Azure storage always - if [[ $TRAVIS_CPU_ARCH != "arm64" ]]; then - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash - else - brew install azure-cli - fi + # if [[ $TRAVIS_CPU_ARCH != "arm64" ]]; then + # if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + # curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + # else + # brew install azure-cli + # fi - az storage container create -n ${TRAVIS_COMMIT} --public-access blob + # az storage container create -n ${TRAVIS_COMMIT} --public-access blob - if [[ $SDIST == 1 ]]; then - az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz - else - az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern opencv*.whl - fi - fi + # if [[ $SDIST == 1 ]]; then + # az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz + # else + # az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern opencv*.whl + # fi + # fi set +x diff --git a/opencv b/opencv index 1363496c..b19f8603 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit 1363496c1106606684d40447f5d1149b2c66a9f8 +Subproject commit b19f8603843ac63274379c9e36331db6d4917001 diff --git a/travis_config.sh b/travis_config.sh index 9ba0bb11..aac66317 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -95,28 +95,31 @@ function pre_build { if [ -n "$IS_OSX" ]; then echo "Running for OSX" - local CACHE_STAGE; (echo "$TRAVIS_BUILD_STAGE_NAME" | grep -qiF "final") || CACHE_STAGE=1 + local CACHE_STAGE;# (echo "$TRAVIS_BUILD_STAGE_NAME" | grep -qiF "final") || CACHE_STAGE=1 + CACHE_STAGE= export HOMEBREW_NO_AUTO_UPDATE=1 #after the cache stage, all bottles and Homebrew metadata should be already cached locally - if [ -n "$CACHE_STAGE" ]; then - brew update - generate_ffmpeg_formula - brew_add_local_bottles - fi + # if [ -n "$CACHE_STAGE" ]; then + # brew update + # generate_ffmpeg_formula + # brew_add_local_bottles + # fi echo 'Installing FFmpeg' - if [ -n "$CACHE_STAGE" ]; then - brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; } - else - brew unlink python@2 + # if [ -n "$CACHE_STAGE" ]; then + # brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; } + # else + brew update generate_ffmpeg_formula - brew install ffmpeg_opencv - fi + brew_add_local_bottles + # brew unlink python@2 + brew install --build-bottle ffmpeg_opencv + # fi # echo 'Installing qt5' - + # if [ -n "$CACHE_STAGE" ]; then # echo "Qt5 has bottle, no caching needed" # else diff --git a/travis_osx_brew_cache.sh b/travis_osx_brew_cache.sh index e3a69cc3..401265f2 100644 --- a/travis_osx_brew_cache.sh +++ b/travis_osx_brew_cache.sh @@ -4,6 +4,9 @@ #Should be in Travis' cache BREW_LOCAL_BOTTLE_METADATA="$HOME/local_bottle_metadata" +#FIXME: temporary fix to enable the build, should be replaced with the proper path to the cache dir +mkdir -p $BREW_LOCAL_BOTTLE_METADATA + # Starting reference point for elapsed build time; seconds since the epoch. #TRAVIS_TIMER_START_TIME is set at the start of a log fold, in nanoseconds since the epoch BREW_TIME_START=$(($TRAVIS_TIMER_START_TIME/10**9)) @@ -48,33 +51,33 @@ function brew_add_local_bottles { # so that `brew` commands can find them. # If the package was updated, removes the corresponding files # and the bottle's entry in the formula, if any. - - # Bottle entry in formula: + + # Bottle entry in formula: # bottle do # <...> # sha256 "" => : # <...> - # end - + # end + echo "Cached bottles:" ls "$(brew --cache)/downloads" || true #may not exist initially since it's "$(brew --cache)" that is in Travis cache echo "Saved .json's and links:" ls "$BREW_LOCAL_BOTTLE_METADATA" - + for JSON in "$BREW_LOCAL_BOTTLE_METADATA"/*.json; do [ -e "$JSON" ] || break # OSX 10.11 bash has no nullglob local PACKAGE JSON_VERSION JSON_REBUILD OS_CODENAME BOTTLE_HASH - + _brew_parse_bottle_json "$JSON" PACKAGE JSON_VERSION JSON_REBUILD OS_CODENAME BOTTLE_HASH echo "Adding local bottle: $PACKAGE ${JSON_VERSION}_${JSON_REBUILD}" - + local FORMULA_VERSION FORMULA_REBUILD FORMULA_BOTTLE_HASH - + _brew_parse_package_info "$PACKAGE" "$OS_CODENAME" FORMULA_VERSION FORMULA_REBUILD FORMULA_BOTTLE_HASH local FORMULA_HAS_BOTTLE; [ -n "$FORMULA_BOTTLE_HASH" ] && FORMULA_HAS_BOTTLE=1 || true - + local BOTTLE_LINK BOTTLE=""; BOTTLE_LINK="${JSON}.bottle.lnk"; local BOTTLE_EXISTS= BOTTLE_MISMATCH= VERSION_MISMATCH= @@ -88,10 +91,10 @@ function brew_add_local_bottles { if [ -f "$BOTTLE_LINK" ]; then BOTTLE=$(cat "$BOTTLE_LINK"); BOTTLE=$(cd "$(dirname "$BOTTLE")"; pwd)/$(basename "$BOTTLE") - + if [ -e "$BOTTLE" ]; then BOTTLE_EXISTS=1; - + # The hash in `brew --cache $PACKAGE` entry is generated from download URL, # which itself is generated from base URL and version # (see Homebrew/Library/Homebrew/download_strategy.rb:cached_location). @@ -110,7 +113,7 @@ function brew_add_local_bottles { else echo "Link file is missing or of invalid type!" >&2 fi - + # Delete cached bottle and all metadata if invalid if [[ -z "$BOTTLE_EXISTS" || -n "$VERSION_MISMATCH" || -n "$BOTTLE_MISMATCH" ]]; then echo "Deleting the cached bottle and all metadata" @@ -133,11 +136,11 @@ function brew_add_local_bottles { git commit -m "Removed obsolete local bottle ${JSON_VERSION}_${JSON_REBUILD} :${OS_CODENAME}" "$FORMULA" ) fi - + if [ -n "$BOTTLE" -a -n "$BOTTLE_EXISTS" ]; then rm "$BOTTLE"; fi rm -f "$BOTTLE_LINK" rm "$JSON" - + #(Re)add metadata to the formula otherwise else if [ "$FORMULA_BOTTLE_HASH" == "$BOTTLE_HASH" ]; then @@ -156,7 +159,7 @@ function brew_cache_cleanup { #Lefovers from some failure probably rm -f "$BREW_LOCAL_BOTTLE_METADATA"/*.tar.gz - + #`brew cleanup` may delete locally-built bottles that weren't needed this time # so we're saving and restoring them local BOTTLE_LINK BOTTLE @@ -187,16 +190,16 @@ function brew_go_bootstrap_mode { local EXIT_CODE=${1:-1} echo "Going into cache bootstrap mode" - + BREW_BOOTSTRAP_MODE=1 - + #Can't just `exit` because that would terminate the build without saving the cache #Have to replace further actions with no-ops - + local MESSAGE=""; if [ "$EXIT_CODE" -ne 0 ]; then MESSAGE='Building dependencies took too long. Restart the build in Travis UI to continue from cache.'; fi - + eval ' function '"$cmd"' { return 0; } function repair_wheelhouse { return 0; } @@ -205,11 +208,11 @@ function brew_go_bootstrap_mode { echo \ ' echo -e "\n'"$MESSAGE"'\n"' fi)"\ - ' + ' # Travis runs user scripts via `eval` i.e. in the same shell process. # So have to unset errexit in order to get to cache save stage set +e; return '"$EXIT_CODE"' - }' + }' } @@ -228,15 +231,15 @@ function _brew_install_and_cache_within_time_limit { if grep -qxFf <(cat <<<"$_BREW_ALREADY_INSTALLED") <<<"$PACKAGE"; then MARKED_INSTALLED=1 fi - + if [ -n "$MARKED_INSTALLED" ] || (brew list --versions "$PACKAGE" >/dev/null && ! (brew outdated | grep -qxF "$PACKAGE")); then echo "Already installed and the latest version: $PACKAGE" if [ -z "$MARKED_INSTALLED" ]; then _brew_mark_installed "$PACKAGE"; fi return 0 fi - + local BUILD_FROM_SOURCE INCLUDE_BUILD KEG_ONLY - + _brew_is_bottle_available "$PACKAGE" KEG_ONLY || BUILD_FROM_SOURCE=1 [ -n "$BUILD_FROM_SOURCE" ] && INCLUDE_BUILD="--include-build" || true @@ -254,7 +257,7 @@ function _brew_install_and_cache_within_time_limit { _brew_install_and_cache "$PACKAGE" "$([[ -z "$BUILD_FROM_SOURCE" ]] && echo 1 || echo 0)" "$KEG_ONLY" || return 2 _brew_check_elapsed_build_time "$TIME_START" "$TIME_LIMIT" || return $? } - + function _brew_parse_bottle_json { # Parse JSON file resulting from `brew bottle --json` @@ -271,9 +274,9 @@ function _brew_parse_bottle_json { print tag_name print tag_dict["sha256"] ' "$JSON") - + unset JSON - + { local i v; for i in {1..5}; do read -r v eval "${1:?}=\"$v\"" @@ -284,7 +287,7 @@ function _brew_parse_bottle_json { function _brew_parse_package_info { # Get and parse `brew info --json` about a package # and save data into specified variables - + local PACKAGE OS_CODENAME PACKAGE="${1:?}"; shift OS_CODENAME="${1:?}"; shift @@ -300,9 +303,9 @@ function _brew_parse_package_info { print bottle_data["files"].get(sys.argv[2],{"sha256":"!?"})["sha256"] #prevent losing trailing blank line to command substitution ' \ "$PACKAGE" "$OS_CODENAME"); JSON_DATA="${JSON_DATA%\!\?}" #!? can't occur in a hash - + unset PACKAGE OS_CODENAME - + { local i v; for i in {1..3}; do read -r v eval "${1:?}=\"$v\"" @@ -346,13 +349,13 @@ function _brew_install_and_cache { # Install bottle or make and cache bottle. # assumes that deps were already installed # and not already the latest version - + local PACKAGE USE_BOTTLE KEG_ONLY PACKAGE="${1:?}" USE_BOTTLE="${2:?}" KEG_ONLY="${3:?}" local VERB - + if brew list --versions "$PACKAGE"; then # Install alongside the old version to avoid to have to update "runtime dependents" # https://discourse.brew.sh/t/can-i-install-a-new-version-without-having-to-upgrade-runtime-dependents/4443 @@ -363,7 +366,7 @@ function _brew_install_and_cache { else VERB=install fi - + if [[ "$USE_BOTTLE" -gt 0 ]]; then echo "Installing bottle for: $PACKAGE" brew $VERB "$PACKAGE" @@ -380,12 +383,12 @@ function _brew_install_and_cache { #proper procedure as per https://discourse.brew.sh/t/how-are-bottle-and-postinstall-related-is-it-safe-to-run-bottle-after-postinstall/3410/4 brew uninstall --ignore-dependencies "$PACKAGE" brew $VERB "$BOTTLE" - + local JSON; JSON=$(sed -E 's/bottle(.[[:digit:]]+)?\.tar\.gz$/bottle.json/' <<<"$BOTTLE") - + #`brew bottle --merge` doesn't return nonzero on nonexisting json file test -f "$JSON" -a -f "$BOTTLE" - + brew bottle --merge --write "$JSON" local CACHED_BOTTLE; CACHED_BOTTLE="$(brew --cache "$PACKAGE")" mv "$BOTTLE" "$CACHED_BOTTLE"; @@ -394,9 +397,9 @@ function _brew_install_and_cache { #Symlinks aren't cached by Travis. Will just save paths in files then. local BOTTLE_LINK; BOTTLE_LINK="${CACHED_JSON}.bottle.lnk" echo "$CACHED_BOTTLE" >"$BOTTLE_LINK" - + fi - + _brew_mark_installed "$PACKAGE" } @@ -411,11 +414,11 @@ function _brew_check_elapsed_build_time { local TIME_START TIME_LIMIT ELAPSED_TIME TIME_START="${1:?}" TIME_LIMIT="${2:?}" - + ELAPSED_TIME=$(($(date +%s) - $TIME_START)) echo "Elapsed time: "$(($ELAPSED_TIME/60))"m (${ELAPSED_TIME}s)" - - if [[ "$ELAPSED_TIME" -gt $TIME_LIMIT ]]; then + + if [[ "$ELAPSED_TIME" -gt $TIME_LIMIT ]]; then brew_go_bootstrap_mode return 1 fi @@ -426,19 +429,19 @@ function _brew_check_slow_building_ahead { #If the package's projected build completion is higher than hard limit, # skip it and arrange for further build to be skipped and return 1 - + local PACKAGE TIME_START TIME_HARD_LIMIT PACKAGE="${1:?}" TIME_START="${2:?}" TIME_HARD_LIMIT="${3:?}" - - local PROJECTED_BUILD_TIME + + local PROJECTED_BUILD_TIME PROJECTED_BUILD_TIME=$(echo "$BREW_SLOW_BUILIDING_PACKAGES" | awk '$1=="'"$PACKAGE"'"{print $2}') [ -z "$PROJECTED_BUILD_TIME" ] && return 0 || true - + local PROJECTED_BUILD_END_ELAPSED_TIME PROJECTED_BUILD_END_ELAPSED_TIME=$(( $(date +%s) - TIME_START + PROJECTED_BUILD_TIME * 60)) - + if [[ "$PROJECTED_BUILD_END_ELAPSED_TIME" -ge "$TIME_HARD_LIMIT" ]]; then echo -e "\nProjected build end elapsed time for $PACKAGE: $((PROJECTED_BUILD_END_ELAPSED_TIME/60))m ($PROJECTED_BUILD_END_ELAPSED_TIMEs)" brew_go_bootstrap_mode