diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index ab377325..6981c060 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -13,9 +13,12 @@ on: - '.github/workflows/build_wheels_macos*' release: types: [published, edited] - schedule: - - cron: '0 3 * * 6' workflow_dispatch: + workflow_call: + inputs: + MATRIX_BRANCH: + required: true + type: string jobs: @@ -57,11 +60,20 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "ENABLE_ROLLING=1" >> $GITHUB_ENV fi - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: false - fetch-depth: 0 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Build a package run: source scripts/build.sh - name: Saving all wheels @@ -100,13 +112,25 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} - - name: Checkout - 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 + 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 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: | + cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git submodule update --init --recursive - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v3 with: @@ -154,11 +178,20 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "ENABLE_ROLLING=1" >> $GITHUB_ENV fi - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: false - fetch-depth: 0 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index 079efbe1..a66b488a 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -13,9 +13,12 @@ on: - '.github/workflows/build_wheels_macos*' release: types: [published, edited] - schedule: - - cron: '0 3 * * 6' workflow_dispatch: + workflow_call: + inputs: + MATRIX_BRANCH: + required: true + type: string jobs: @@ -57,11 +60,20 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "ENABLE_ROLLING=1" >> $GITHUB_ENV fi - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: false - fetch-depth: 0 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Build a package run: source scripts/build.sh - name: Saving all wheels @@ -102,13 +114,25 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} - - name: Checkout - 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 + 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 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: | + cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git submodule update --init --recursive - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index 584520b2..385560e2 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -13,9 +13,12 @@ on: - '.github/workflows/build_wheels_macos_m1.yml' release: types: [published, edited] - schedule: - - cron: '0 3 * * 6' workflow_dispatch: + workflow_call: + inputs: + MATRIX_BRANCH: + required: true + type: string jobs: @@ -59,11 +62,20 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "ENABLE_ROLLING=1" >> $GITHUB_ENV fi - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: false - fetch-depth: 0 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Build a package run: | set -e @@ -119,11 +131,24 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 + - name: Setup Environment variables + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: | + cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git submodule update --init --recursive - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index b51801ab..f05195f1 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -13,9 +13,12 @@ on: - '.github/workflows/build_wheels_macos.yml' release: types: [published, edited] - schedule: - - cron: '0 3 * * 6' workflow_dispatch: + workflow_call: + inputs: + MATRIX_BRANCH: + required: true + type: string jobs: @@ -43,11 +46,20 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "ENABLE_ROLLING=1" >> $GITHUB_ENV fi - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: false - fetch-depth: 0 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Build a package run: | git submodule update --init multibuild @@ -86,11 +98,24 @@ jobs: - name: Cleanup run: find . -mindepth 1 -delete working-directory: ${{ github.workspace }} - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 + - name: Setup Environment variables + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: | + cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git submodule update --init --recursive - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index e6874ffe..c61abb7a 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -12,9 +12,12 @@ on: - '.github/workflows/build_wheels_macos*' release: types: [published, edited] - schedule: - - cron: '0 3 * * 6' workflow_dispatch: + workflow_call: + inputs: + MATRIX_BRANCH: + required: true + type: string jobs: @@ -47,11 +50,20 @@ jobs: if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "ENABLE_ROLLING=1" >> $GITHUB_ENV fi - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: false - fetch-depth: 0 + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -103,11 +115,25 @@ jobs: rm -rf ./* || true rm -rf ./.??* || true working-directory: ${{ github.workspace }} - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 + - name: Setup Environment variables + shell: bash + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "CLONE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV + echo "SOURCE_BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + echo "PR_AUTHOR_FORK=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV + elif [[ "${{ github.event_name }}" == "schedule" ]]; then + echo "CLONE_BRANCH=${{ inputs.MATRIX_BRANCH }}" >> $GITHUB_ENV + else + echo "CLONE_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + fi + - name: Clone + run: git clone --branch ${{ env.CLONE_BRANCH }} https://github.com/opencv/opencv-python.git ${{ github.workspace }} + - name: Merge with a test branch + if: ${{ github.event_name == 'pull_request' }} + run: | + cd ${{ github.workspace }} && git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}" + git submodule update --init --recursive - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: