From 080da76b1534607cb648b07a6dd5df30beb61f8d Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Fri, 29 Dec 2023 14:03:50 +0300 Subject: [PATCH 1/2] Run Python test on Mac M1 in virtual environment to prevent "error: externally-managed-environment". --- .github/workflows/build_wheels_macos_m1.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 85f42fb9..4f1f214c 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -98,17 +98,24 @@ jobs: with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ + - name: Create Venv for test + run: | + test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test" + python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test - name: Package installation run: | - python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl + source ${{ github.workspace }}/opencv_test/bin/activate + python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests python${{ matrix.python-version }} get_build_info.py - name: Run tests run: | + source ${{ github.workspace }}/opencv_test/bin/activate cd ${{ github.workspace }}/opencv python${{ matrix.python-version }} modules/python/test/test.py -v --repo . - name: Pylint test run: | + source ${{ github.workspace }}/opencv_test/bin/activate python${{ matrix.python-version }} -m pip install pylint==2.15.9 cd ${{ github.workspace }}/tests python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE From 949b65ea40f5141bdf46f738f7751a16d6309e04 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Sat, 30 Dec 2023 13:13:41 +0300 Subject: [PATCH 2/2] Upgrade pip on Mac M1 before package installation. --- .github/workflows/build_wheels_macos_m1.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 4f1f214c..f0e41d3a 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -105,6 +105,7 @@ jobs: - name: Package installation run: | source ${{ github.workspace }}/opencv_test/bin/activate + python${{ matrix.python-version }} -m pip install --upgrade pip python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests python${{ matrix.python-version }} get_build_info.py