未验证 提交 615f3dff 编写于 作者: A Andrey Senyaev 提交者: GitHub

Scheduled rolling workflows (#699)

* Scheduled rolling workflows

* Fixed a bug in commit/date for package version

* Changed the name of Windows pipelines
上级 2585d6f6
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/
......
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/
......
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/
......
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/
......
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/
......
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 @@ if __name__ == "__main__":
# 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))
......@@ -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
......@@ -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
......@@ -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 @@ class RearrangeCMakeOutput(object):
)
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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册