|
| 1 | +name: macOS x86_64 |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - 4.x |
| 7 | + - 5.x |
| 8 | + paths-ignore: |
| 9 | + - '.github/workflows/build_wheels_manylinux*' |
| 10 | + - '.github/workflows/build_wheels_windows*' |
| 11 | + - '.github/workflows/build_wheels_macos_m1.yml' |
| 12 | + workflow_call: |
| 13 | + inputs: |
| 14 | + enable-rolling: |
| 15 | + type: boolean |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | + |
| 19 | +jobs: |
| 20 | + Build: |
| 21 | + runs-on: python-macos-intel |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + python-version: ['3.9'] |
| 26 | + platform: [x64] |
| 27 | + with_contrib: [0, 1] |
| 28 | + without_gui: [0, 1] |
| 29 | + build_sdist: [0] |
| 30 | + env: |
| 31 | + CI_BUILD: 1 |
| 32 | + ACTIONS_ALLOW_UNSECURE_COMMANDS: true |
| 33 | + REPO_DIR: . |
| 34 | + PROJECT_SPEC: opencv-python |
| 35 | + MB_PYTHON_VERSION: ${{ matrix.python-version }} |
| 36 | + TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} |
| 37 | + MB_ML_VER: 2014 |
| 38 | + TRAVIS_BUILD_DIR: ${{ github.workspace }} |
| 39 | + TRAVIS_OS_NAME: osx |
| 40 | + CONFIG_PATH: travis_config.sh |
| 41 | + USE_CCACHE: 1 |
| 42 | + UNICODE_WIDTH: 32 |
| 43 | + PLAT: x86_64 |
| 44 | + SDIST: ${{ matrix.build_sdist || 0 }} |
| 45 | + ENABLE_HEADLESS: ${{ matrix.without_gui }} |
| 46 | + ENABLE_CONTRIB: ${{ matrix.with_contrib }} |
| 47 | + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple |
| 48 | + steps: |
| 49 | + - name: Cleanup |
| 50 | + run: find . -mindepth 1 -delete |
| 51 | + working-directory: ${{ github.workspace }} |
| 52 | + - name: Setup environment |
| 53 | + run: | |
| 54 | + if [[ "${{ case(inputs.enable-rolling, '1', '') }}" ]] ; then |
| 55 | + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV |
| 56 | + fi |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v7 |
| 59 | + with: |
| 60 | + submodules: false |
| 61 | + fetch-depth: 0 |
| 62 | + - name: Build a package |
| 63 | + run: | |
| 64 | + git submodule update --init multibuild |
| 65 | + echo $ENABLE_CONTRIB > contrib.enabled |
| 66 | + echo $ENABLE_HEADLESS > headless.enabled |
| 67 | + export MACOSX_DEPLOYMENT_TARGET=14.0 |
| 68 | + python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin |
| 69 | + python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v |
| 70 | + delocate-wheel ${{ github.workspace }}/wheelhouse/opencv* |
| 71 | + - name: Saving a wheel accordingly to matrix |
| 72 | + uses: actions/upload-artifact@v7 |
| 73 | + with: |
| 74 | + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} |
| 75 | + path: wheelhouse/opencv*.whl |
| 76 | + |
| 77 | + Test: |
| 78 | + needs: [Build] |
| 79 | + runs-on: python-macos-intel |
| 80 | + strategy: |
| 81 | + fail-fast: false |
| 82 | + matrix: |
| 83 | + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] |
| 84 | + platform: [x64] |
| 85 | + with_contrib: [0, 1] |
| 86 | + without_gui: [0, 1] |
| 87 | + build_sdist: [0] |
| 88 | + env: |
| 89 | + ACTIONS_ALLOW_UNSECURE_COMMANDS: true |
| 90 | + MB_PYTHON_VERSION: ${{ matrix.python-version }} |
| 91 | + NP_TEST_DEP: numpy==1.19.4 |
| 92 | + NP_TEST_DEP_LATEST: numpy==2.2.6 |
| 93 | + CONFIG_PATH: travis_config.sh |
| 94 | + PLAT: x86_64 |
| 95 | + OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata |
| 96 | + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py |
| 97 | + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple |
| 98 | + steps: |
| 99 | + - name: Cleanup |
| 100 | + run: find . -mindepth 1 -delete |
| 101 | + working-directory: ${{ github.workspace }} |
| 102 | + - name: Checkout |
| 103 | + uses: actions/checkout@v7 |
| 104 | + with: |
| 105 | + submodules: true |
| 106 | + fetch-depth: 0 |
| 107 | + - name: Download a wheel accordingly to matrix |
| 108 | + uses: actions/download-artifact@v8 |
| 109 | + with: |
| 110 | + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} |
| 111 | + path: wheelhouse/ |
| 112 | + - name: Create Venv for test |
| 113 | + run: | |
| 114 | + test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test" |
| 115 | + python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test |
| 116 | + - name: Package installation |
| 117 | + run: | |
| 118 | + source ${{ github.workspace }}/opencv_test/bin/activate |
| 119 | + python${{ matrix.python-version }} -m pip install --upgrade pip |
| 120 | + python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl |
| 121 | + cd ${{ github.workspace }}/tests |
| 122 | + python${{ matrix.python-version }} get_build_info.py |
| 123 | + - name: Run tests |
| 124 | + run: | |
| 125 | + source ${{ github.workspace }}/opencv_test/bin/activate |
| 126 | + cd ${{ github.workspace }}/opencv |
| 127 | + python${{ matrix.python-version }} modules/python/test/test.py -v --repo . |
| 128 | + - name: Pylint test |
| 129 | + run: | |
| 130 | + source ${{ github.workspace }}/opencv_test/bin/activate |
| 131 | + python${{ matrix.python-version }} -m pip install pylint==2.15.9 |
| 132 | + cd ${{ github.workspace }}/tests |
| 133 | + python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE |
0 commit comments