From 3d0b585fc1b83761a2d2d3d83f1ad55c1266831c Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Wed, 3 Aug 2022 15:12:49 +0300 Subject: [PATCH 1/2] Scheduled rolling workflows (#699) * Scheduled rolling workflows * Fixed a bug in commit/date for package version * Changed the name of Windows pipelines --- .github/workflows/build_wheels_linux.yml | 96 ++++++++++++++------ .github/workflows/build_wheels_linux_arm.yml | 80 ++++++++++++---- .github/workflows/build_wheels_macos.yml | 78 +++++++++++----- .github/workflows/build_wheels_macos_m1.yml | 81 +++++++++++++---- .github/workflows/build_wheels_windows.yml | 76 ++++++++++++---- find_version.py | 13 ++- scripts/build.sh | 1 + scripts/install.sh | 1 + setup.py | 39 +++++--- 9 files changed, 345 insertions(+), 120 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 76a6d649..a0933da5 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -1,4 +1,4 @@ -name: Build PYPI wheels for opencv-python on Linux x86_64 +name: Linux x86_64 on: pull_request: @@ -13,10 +13,13 @@ on: - '.github/workflows/build_wheels_macos*' release: types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: jobs: - build: + Build: runs-on: ubuntu-20.04 defaults: run: @@ -32,7 +35,7 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . - BUILD_COMMIT: master + BUILD_COMMIT: ${{ github.ref }} PROJECT_SPEC: opencv-python MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} @@ -50,29 +53,33 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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 + uses: actions/upload-artifact@v3 with: name: wheels path: wheelhouse/opencv*.whl - name: Saving a wheel accordingly to matrix - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/opencv*.whl - test: - needs: [build] + Test: + needs: [Build] runs-on: ubuntu-20.04 defaults: run: @@ -97,21 +104,21 @@ jobs: run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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 + uses: actions/download-artifact@v3 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: + Build_sdist: runs-on: ubuntu-20.04 defaults: run: @@ -127,7 +134,7 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . - BUILD_COMMIT: master + BUILD_COMMIT: ${{ github.ref }} PROJECT_SPEC: opencv-python PLAT: x86_64 MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -142,20 +149,25 @@ jobs: SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }} ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }} + ENABLE_ROLLING: 1 steps: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} @@ -172,21 +184,51 @@ jobs: set -x echo "skipping tests because of sdist" - name: saving artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheels path: dist/opencv*.tar.gz - test_release_opencv_python: + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Build_sdist, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* wheelhouse/opencv-python-rolling-[^h]* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* wheelhouse/opencv-contrib-python-rolling-[^h]* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* wheelhouse/opencv-python-headless-rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* wheelhouse/opencv-contrib-python-headless-rolling-* + + Pre-release: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build, build_sdist, test] + needs: [Build, Build_sdist, Test] runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ @@ -195,16 +237,16 @@ jobs: python -m pip install twine python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* wheelhouse/opencv-* - release_opencv_python: + Release: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build, build_sdist, test] + needs: [Build, Build_sdist, Test] runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index 0a4dadbc..d2c5ea35 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -1,4 +1,4 @@ -name: Build PYPI wheels for opencv-python on Linux ARM +name: Linux ARM64 on: pull_request: @@ -13,10 +13,13 @@ on: - '.github/workflows/build_wheels_macos*' release: types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: jobs: - build_arm: + Build: runs-on: opencv-cn-lin-arm64 defaults: run: @@ -32,7 +35,7 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . - BUILD_COMMIT: master + BUILD_COMMIT: ${{ github.ref }} PROJECT_SPEC: opencv-python MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} @@ -47,31 +50,36 @@ jobs: ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} steps: - - name: UID - run: id -u - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: false fetch-depth: 0 - name: Build a package run: source scripts/build.sh - name: Saving all wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheels path: wheelhouse/opencv*.whl - name: Saving a wheel accordingly to matrix - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/opencv*.whl - test: - needs: [build_arm] + Test: + needs: [Build] runs-on: opencv-cn-lin-arm64 defaults: run: @@ -88,6 +96,7 @@ jobs: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} PLAT: aarch64 + BUILD_COMMIT: ${{ github.ref }} NP_TEST_DEP: numpy==1.19.4 NP_TEST_DEP_LATEST: numpy==1.21.4 CONFIG_PATH: travis_config.sh @@ -97,31 +106,66 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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 + uses: actions/download-artifact@v3 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: + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build_arm, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ @@ -130,16 +174,16 @@ jobs: python -m pip install twine python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* - release_opencv_python: + Release: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build_arm, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index 438373bb..5b110fb7 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -1,4 +1,4 @@ -name: Build PYPI wheels for opencv-python on Macos +name: macOS x86_64 on: pull_request: @@ -13,10 +13,13 @@ on: - '.github/workflows/build_wheels_macos_m1.yml' release: types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: jobs: - build: + Build: runs-on: ${{ matrix.os }} defaults: run: @@ -44,7 +47,7 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . - BUILD_COMMIT: master + BUILD_COMMIT: ${{ github.ref }} PROJECT_SPEC: opencv-python MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} @@ -52,7 +55,6 @@ jobs: TRAVIS_BUILD_DIR: ${{ github.workspace }} TRAVIS_OS_NAME: osx CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 PLAT: x86_64 @@ -64,14 +66,18 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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 @@ -90,18 +96,18 @@ jobs: set -x build_wheel $REPO_DIR $PLAT - name: Saving all wheels - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheels path: wheelhouse/opencv*.whl - name: Saving a wheel accordingly to matrix - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/opencv*.whl - test: - needs: [build] + Test: + needs: [Build] runs-on: ${{ matrix.os }} defaults: run: @@ -140,19 +146,19 @@ jobs: run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 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 + uses: actions/download-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ @@ -171,16 +177,46 @@ jobs: cd ${{ github.workspace }}/tests python -m pylint $PYLINT_TEST_FILE - test_release_opencv_python: + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ @@ -189,16 +225,16 @@ jobs: python -m pip install twine python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* - release_opencv_python: + Release: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 134d5450..91d70ff3 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -1,4 +1,4 @@ -name: Build PYPI wheels for opencv-python on Macos M1 +name: macOS ARM64 on: pull_request: @@ -13,10 +13,13 @@ on: - '.github/workflows/build_wheels_macos.yml' release: types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: jobs: - build: + Build: runs-on: opencv-cn-mac-arm64 strategy: fail-fast: false @@ -27,6 +30,7 @@ jobs: without_gui: [0, 1] build_sdist: [0] env: + BUILD_COMMIT: ${{ github.ref }} CI_BUILD: 1 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} @@ -35,14 +39,18 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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,18 +61,18 @@ jobs: 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 + uses: actions/upload-artifact@v3 with: name: wheels path: wheelhouse/opencv*.whl - name: Saving a wheel accordingly to matrix - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/opencv*.whl - test: - needs: [build] + Test: + needs: [Build] runs-on: opencv-cn-mac-arm64-tests strategy: fail-fast: false @@ -75,19 +83,25 @@ jobs: without_gui: [0, 1] build_sdist: [0] env: + BUILD_COMMIT: ${{ github.ref }} 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: Setup environment + run: | + if [[ "${{ github.event.pull_request }}" == "true" ]]; then + echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Download a wheel accordingly to matrix - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ @@ -106,35 +120,64 @@ jobs: cd ${{ github.workspace }}/tests arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE - test_release_opencv_python: + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* - release_opencv_python: + Release: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index f7d2c408..f8970768 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -1,4 +1,4 @@ -name: Build PYPI wheels for opencv-python on Windows +name: Windows x86_64 on: pull_request: @@ -12,10 +12,13 @@ on: - '.github/workflows/build_wheels_macos*' release: types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: jobs: - build-windows-x86_64: + Build: runs-on: windows-2019 strategy: fail-fast: false @@ -38,16 +41,19 @@ jobs: rm -rf ./* || true rm -rf ./.??* || true working-directory: ${{ github.workspace }} + - name: Setup environment + shell: bash + run: | + if [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 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 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} @@ -62,18 +68,18 @@ jobs: 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 + uses: actions/upload-artifact@v3 with: name: wheels path: wheelhouse/opencv*.whl - name: Saving a wheel accordingly to matrix - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} path: wheelhouse/opencv* - test: - needs: [build-windows-x86_64] + Test: + needs: [Build] runs-on: windows-2019 defaults: run: @@ -98,17 +104,17 @@ jobs: rm -rf ./.??* || true working-directory: ${{ github.workspace }} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - name: Download a wheel accordingly to matrix - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} path: wheelhouse/ @@ -129,16 +135,46 @@ jobs: cd ${{ github.workspace }}\tests python -m pylint $PYLINT_TEST_FILE - test_release_opencv_python: + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build-windows-x86_64, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ @@ -147,16 +183,16 @@ jobs: python -m pip install twine python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* - release_opencv_python: + Release: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build-windows-x86_64, test] + needs: [Build, Test] runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: shell: bash steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wheels path: wheelhouse/ diff --git a/find_version.py b/find_version.py index 6c676b23..274c93e6 100644 --- a/find_version.py +++ b/find_version.py @@ -1,11 +1,12 @@ import sys -import os import subprocess +from datetime import date if __name__ == "__main__": contrib = sys.argv[1] headless = sys.argv[2] - ci_build = sys.argv[3] + rolling = sys.argv[3] + ci_build = sys.argv[4] opencv_version = "" # dig out the version from OpenCV sources @@ -56,13 +57,19 @@ # tag identifies the build and should be a sequential revision number version = tag[0] opencv_version += ".{}".format(version) + # rolling has converted into string using get_and_set_info() function in setup.py + elif rolling == "True": + # rolling version identifier, will be published in a dedicated rolling PyPI repository + version = date.today().strftime('%Y%m%d') + opencv_version += ".{}".format(version) else: # local version identifier, not to be published on PyPI version = git_hash - opencv_version += "+{}".format(version) + opencv_version += ".{}".format(version) with open("cv2/version.py", "w") as f: f.write('opencv_version = "{}"\n'.format(opencv_version)) f.write("contrib = {}\n".format(contrib)) f.write("headless = {}\n".format(headless)) + f.write("rolling = {}\n".format(rolling)) f.write("ci_build = {}".format(ci_build)) diff --git a/scripts/build.sh b/scripts/build.sh index f48ca066..e5c83d83 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -13,5 +13,6 @@ source multibuild/travis_steps.sh # source travis_multibuild_customize.sh echo $ENABLE_CONTRIB > contrib.enabled echo $ENABLE_HEADLESS > headless.enabled +echo $ENABLE_ROLLING > rolling.enabled set -x build_wheel $REPO_DIR $PLAT diff --git a/scripts/install.sh b/scripts/install.sh index 6e019d1c..f20080ae 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -13,6 +13,7 @@ source multibuild/travis_steps.sh # source travis_multibuild_customize.sh echo $ENABLE_CONTRIB > contrib.enabled echo $ENABLE_HEADLESS > headless.enabled +echo $ENABLE_ROLLING > rolling.enabled set -x install_run $PLAT set +x diff --git a/setup.py b/setup.py index 3a1a7cfd..9b937e59 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ def main(): build_contrib = get_build_env_var_by_name("contrib") build_headless = get_build_env_var_by_name("headless") build_java = "ON" if get_build_env_var_by_name("java") else "OFF" + build_rolling = get_build_env_var_by_name("rolling") install_requires = [ 'numpy>=1.13.3; python_version<"3.7"', @@ -46,17 +47,28 @@ def main(): g = git.Git() # NOTE: pip API's are internal, this has to be refactored g.run_command(["submodule", "sync"]) - g.run_command( - ["submodule", "update", "--init", "--recursive", cmake_source_dir] - ) - if build_contrib: + if build_rolling: + g.run_command( + ["submodule", "update", "--init", "--recursive", "--remote", cmake_source_dir] + ) + + if build_contrib: + g.run_command( + ["submodule", "update", "--init", "--recursive", "--remote", "opencv_contrib"] + ) + else: g.run_command( - ["submodule", "update", "--init", "--recursive", "opencv_contrib"] + ["submodule", "update", "--init", "--recursive", cmake_source_dir] ) - package_version, build_contrib, build_headless = get_and_set_info( - build_contrib, build_headless, is_CI_build + if build_contrib: + g.run_command( + ["submodule", "update", "--init", "--recursive", "opencv_contrib"] + ) + + package_version, build_contrib, build_headless, build_rolling = get_and_set_info( + build_contrib, build_headless, build_rolling, is_CI_build ) # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode @@ -73,6 +85,9 @@ def main(): if build_headless and not build_contrib: package_name = "opencv-python-headless" + if build_rolling: + package_name += "-rolling" + long_description = io.open("README.md", encoding="utf-8").read() packages = ["cv2", "cv2.data"] @@ -245,14 +260,14 @@ def main(): skbuild.setup( name=package_name, version=package_version, - url="https://github.com/skvark/opencv-python", + url="https://github.com/opencv/opencv-python", license="MIT", description="Wrapper package for OpenCV python bindings.", long_description=long_description, long_description_content_type="text/markdown", packages=packages, package_data=package_data, - maintainer="Olli-Pekka Heinisuo", + maintainer="OpenCV Team", ext_modules=EmptyListWithLength(), install_requires=install_requires, python_requires=">=3.6", @@ -446,7 +461,7 @@ def _classify_installed_files_override( ) -def get_and_set_info(contrib, headless, ci_build): +def get_and_set_info(contrib, headless, rolling, ci_build): # cv2/version.py should be generated by running find_version.py version = {} here = os.path.abspath(os.path.dirname(__file__)) @@ -456,14 +471,14 @@ def get_and_set_info(contrib, headless, ci_build): # (in sdists the version.py file already exists) if os.path.exists(".git"): old_args = sys.argv.copy() - sys.argv = ["", str(contrib), str(headless), str(ci_build)] + sys.argv = ["", str(contrib), str(headless), str(rolling), str(ci_build)] runpy.run_path("find_version.py", run_name="__main__") sys.argv = old_args with open(version_file) as fp: exec(fp.read(), version) - return version["opencv_version"], version["contrib"], version["headless"] + return version["opencv_version"], version["contrib"], version["headless"], version["rolling"] def get_build_env_var_by_name(flag_name): From f9c40212eb060f5b56a7545b2dbaea2fa62a94b3 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Fri, 5 Aug 2022 18:43:33 +0300 Subject: [PATCH 2/2] macOS x86_64 runner change to macos-11 (#701) --- .github/workflows/build_wheels_macos.yml | 29 +++--------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index 5b110fb7..adc3724d 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -20,30 +20,18 @@ on: jobs: Build: - runs-on: ${{ matrix.os }} + runs-on: macos-11 defaults: run: shell: bash strategy: fail-fast: false matrix: - os: [macos-10.15, macos-11] python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - exclude: - - os: macos-10.15 - python-version: '3.10' - - os: macos-11 - python-version: '3.6' - - os: macos-11 - python-version: '3.7' - - os: macos-11 - python-version: '3.8' - - os: macos-11 - python-version: '3.9' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -62,6 +50,7 @@ jobs: SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} + MACOSX_DEPLOYMENT_TARGET: 10.15 steps: - name: Cleanup run: find . -mindepth 1 -delete @@ -108,30 +97,18 @@ jobs: Test: needs: [Build] - runs-on: ${{ matrix.os }} + runs-on: macos-11 defaults: run: shell: bash strategy: fail-fast: false matrix: - os: [macos-10.15, macos-11] 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] - exclude: - - os: macos-10.15 - python-version: '3.10' - - os: macos-11 - python-version: '3.6' - - os: macos-11 - python-version: '3.7' - - os: macos-11 - python-version: '3.8' - - os: macos-11 - python-version: '3.9' env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }}
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: