8000 Split builds and tests for linux, update submodules only when a PR, t… · luojueling/opencv-python@2bab1f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2bab1f5

Browse files
author
Andrey Senyaev
committed
Split builds and tests for linux, update submodules only when a PR, turned off freetype because of issues, added get_build_info script
1 parent 6336ca8 commit 2bab1f5

File tree

7 files changed

+48
-25
lines changed
  • tests
  • 7 files changed

    +48
    -25
    lines changed

    .github/workflows/build_wheels_linux.yml

    Lines changed: 26 additions & 16 deletions
    Original file line numberDiff line numberDiff line change
    @@ -39,27 +39,20 @@ jobs:
    3939
    DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
    4040
    USE_CCACHE: 1
    4141
    UNICODE_WIDTH: 32
    42-
    SDIST: ${{ matrix.build_sdist || 0}}
    42+
    SDIST: ${{ matrix.build_sdist || 0 }}
    4343
    ENABLE_HEADLESS: ${{ matrix.without_gui }}
    4444
    ENABLE_CONTRIB: ${{ matrix.with_contrib }}
    4545

    4646
    steps:
    4747
    - name: Checkout
    4848
    uses: actions/checkout@v2
    4949
    with:
    50-
    submodules: true
    50+
    submodules: false
    5151
    fetch-depth: 0
    5252

    5353
    - name: Update submodules
    54-
    run: |
    55-
    git submodule update --remote
    56-
    57-
    - name: Set up Python ${{ matrix.python-version }}
    58-
    uses: actions/setup-python@v2
    59-
    if: ${{ 'macos-latest' == matrix.os }}
    60-
    with:
    61-
    python-version: ${{ matrix.python-version }}
    62-
    architecture: ${{ matrix.platform }}
    54+
    if: github.event_name == 'pull_request'
    55+
    run: git submodule update --remote
    6356

    6457
    - name: Setup Environment variables
    6558
    run: |
    @@ -71,7 +64,7 @@ jobs:
    7164
    echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
    7265
    echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
    7366
    74-
    - name: before install
    67+
    - name: build
    7568
    run: |
    7669
    set -e
    7770
    # Check out and prepare the source
    @@ -88,6 +81,23 @@ jobs:
    8881
    echo $ENABLE_HEADLESS > headless.enabled
    8982
    set -x
    9083
    build_wheel $REPO_DIR $PLAT
    84+
    85+
    - name: install and test
    86+
    run: |
    87+
    set -e
    88+
    # Check out and prepare the source
    89+
    # Multibuild doesn't have releases, so --depth would break eventually (see
    90+
    # https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
    91+
    git submodule update --init --recursive
    92+
    source multibuild/common_utils.sh
    93+
    # https://github.com/matthew-brett/multibuild/issues/116
    94+
    if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
    95+
    source multibuild/travis_steps.sh
    96+
    # This sets -x
    97+
    # source travis_multibuild_customize.sh
    98+
    echo $ENABLE_CONTRIB > contrib.enabled
    99+
    echo $ENABLE_HEADLESS > headless.enabled
    100+
    set -x
    91101
    install_run $PLAT
    92102
    set +x
    93103
    @@ -129,9 +139,9 @@ jobs:
    129139
    DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
    130140
    USE_CCACHE: 1
    131141
    UNICODE_WIDTH: 32
    132-
    SDIST: ${{ matrix.build_sdist || 0}}
    142+
    SDIST: ${{ matrix.build_sdist || 0 }}
    133143
    ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }}
    134-
    ENABLE_CONTRIB: ${{ matrix.with_contrib || 0}}
    144+
    ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }}
    135145

    136146
    steps:
    137147
    - name: Checkout
    @@ -141,8 +151,8 @@ jobs:
    141151
    fetch-depth: 0
    142152

    143153
    - name: Update submodules
    144-
    run: |
    145-
    git submodule update --remote
    154+
    if: github.event_name == 'pull_request'
    155+
    run: git submodule update --remote
    146156

    147157
    - name: Set up Python ${{ matrix.python-version }}
    148158
    uses: actions/setup-python@v2

    .github/workflows/build_wheels_linux_arm.yml

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -41,7 +41,7 @@ jobs:
    4141
    DOCKER_TEST_IMAGE: multibuild/xenial_arm64v8
    4242
    USE_CCACHE: 0
    4343
    UNICODE_WIDTH: 32
    44-
    SDIST: ${{ matrix.build_sdist || 0}}
    44+
    SDIST: ${{ matrix.build_sdist || 0 }}
    4545
    ENABLE_HEADLESS: ${{ matrix.without_gui }}
    4646
    ENABLE_CONTRIB: ${{ matrix.with_contrib }}
    4747

    .github/workflows/build_wheels_macos.yml

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -39,7 +39,7 @@ jobs:
    3939
    DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
    4040
    USE_CCACHE: 1
    4141
    UNICODE_WIDTH: 32
    42-
    SDIST: ${{ matrix.build_sdist || 0}}
    42+
    SDIST: ${{ matrix.build_sdist || 0 }}
    4343
    ENABLE_HEADLESS: ${{ matrix.without_gui }}
    4444
    ENABLE_CONTRIB: ${{ matrix.with_contrib }}
    4545

    @@ -51,8 +51,8 @@ jobs:
    5151
    fetch-depth: 0
    5252

    5353
    - name: Update submodules
    54-
    run: |
    55-
    git submodule update --remote
    54+
    if: github.event_name == 'pull_request'
    55+
    run: git submodule update --remote
    5656

    5757
    - name: Set up Python ${{ matrix.python-version }}
    5858
    uses: actions/setup-python@v2

    .github/workflows/build_wheels_windows.yml

    Lines changed: 7 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -27,9 +27,10 @@ jobs:
    2727

    2828
    env:
    2929
    ACTIONS_ALLOW_UNSECURE_COMMANDS: true
    30-
    SDIST: ${{ matrix.build_sdist || 0}}
    30+
    SDIST: ${{ matrix.build_sdist || 0 }}
    3131
    ENABLE_HEADLESS: ${{ matrix.without_gui }}
    3232
    ENABLE_CONTRIB: ${{ matrix.with_contrib }}
    33+
    OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
    3334

    3435
    steps:
    3536
    - name: Checkout
    @@ -39,8 +40,8 @@ jobs:
    3940
    fetch-depth: 0
    4041

    4142
    - name: Update submodules
    42-
    run: |
    43-
    git submodule update --remote
    43+
    if: github.event_name == 'pull_request'
    44+
    run: git submodule update --remote
    4445

    4546
    - name: Set up Python ${{ matrix.python-version }}
    4647
    uses: actions/setup-python@v2
    @@ -64,12 +65,13 @@ jobs:
    6465
    cd ${{ github.workspace }}/tests
    6566
    &python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl")
    6667
    if ($LastExitCode -ne 0) {throw $LastExitCode}
    68+
    python get_build_info.py
    6769
    shell: powershell
    6870

    6971
    - name: run test
    7072
    run: |
    71-
    cd ${{ github.workspace }}/tests
    72-
    python -m unittest test
    73+
    cd ${{ github.workspace }}/opencv
    74+
    python modules\python\test\test.py -v --repo .
    7375
    shell: cmd
    7476

    7577
    - name: saving artifacts

    setup.py

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -145,6 +145,7 @@ def main():
    145145
    "-DINSTALL_CREATE_DISTRIB=ON",
    146146
    # See opencv/CMakeLists.txt for options and defaults
    147147
    "-DBUILD_opencv_apps=OFF",
    148+
    "-DBUILD_opencv_freetype=OFF",
    148149
    "-DBUILD_SHARED_LIBS=OFF",
    149150
    "-DBUILD_TESTS=OFF",
    150151
    "-DBUILD_PERF_TESTS=OFF",

    tests/get_build_info.py

    Lines changed: 3 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,3 @@
    1+
    import cv2 as cv
    2+
    3+
    print(cv.getBuildInformation())

    travis_config.sh

    Lines changed: 7 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -150,6 +150,10 @@ function run_tests {
    150150

    151151
    if [ -n "$IS_OSX" ]; then
    152152
    echo "Running for OS X"
    153+
    154+
    cd ../tests
    155+
    $PYTHON get_build_info.py
    156+
    153157
    cd ../opencv/
    154158
    export OPENCV_TEST_DATA_PATH=../opencv_extra/testdata
    155159
    else
    @@ -158,6 +162,9 @@ function run_tests {
    158162
    if [ $PYTHON == "python3.6" ]; then
    159163
    $PYTHON -m pip install -U numpy==1.19.4
    160164
    fi
    165+
    cd /io/tests
    166+
    $PYTHON get_build_info.py
    167+
    161168
    cd /io/opencv
    162169
    export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata
    163170
    fi

    0 commit comments

    Comments
     (0)
    0