8000 Split linux and OSX builds to exclude x86 OSX builds from build matrix · ArtificialZeng/opencv-python@176a99b · GitHub
[go: up one dir, main page]

Skip to content

Commit 176a99b

Browse files
committed
Split linux and OSX builds to exclude x86 OSX builds from build matrix
1 parent d512b45 commit 176a99b

File tree

1 file changed

+115
-3
lines changed

1 file changed

+115
-3
lines changed

.github/workflows/build_wheels.yml

Lines changed: 115 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ jobs:
8282
name: wheels
8383
path: wheelhouse/opencv*.whl
8484

85-
build:
85+
86+
build_linux:
8687
runs-on: ${{ matrix.os }}
8788
defaults:
8889
run:
@@ -91,7 +92,7 @@ jobs:
9192
strategy:
9293
fail-fast: false
9394
matrix:
94-
os: [ubuntu-latest, macos-latest]
95+
os: [ubuntu-latest]
9596
python-version: [3.6, 3.7, 3.8, 3.9]
9697
platform: [x86, x64]
9798
with_contrib: [0, 1]
@@ -193,6 +194,117 @@ jobs:
193194
name: wheels
194195
path: wheelhouse/opencv*.whl
195196

197+
build_macos:
198+
runs-on: ${{ matrix.os }}
199+
defaults:
200+
run:
201+
shell: bash
202+
203+
strategy:
204+
fail-fast: false
205+
matrix:
206+
os: [macos-latest]
207+
python-version: [3.6, 3.7, 3.8, 3.9]
208+
platform: [x64]
209+
with_contrib: [0, 1]
210+
without_gui: [0, 1]
211+
build_sdist: [0]
212+
213+
env:
214+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
215+
REPO_DIR: .
216+
BUILD_COMMIT: master
217+
PROJECT_SPEC: opencv-python
218+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
219+
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
220+
MB_ML_VER: 2014
221+
NP_TEST_DEP: numpy
222+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
223+
CONFIG_PATH: travis_config.sh
224+
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
225+
USE_CCACHE: 1
226+
UNICODE_WIDTH: 32
227+
SDIST: ${{ matrix.build_sdist || 0}}
228+
ENABLE_HEADLESS: ${{ matrix.without_gui }}
229+
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
230+
231+
steps:
232+
- name: Checkout
233+
uses: actions/checkout@v2
234+
with:
235+
submodules: true
236+
fetch-depth: 0
237+
238+
- name: Update submodules
239+
run: |
240+
git submodule update --remote
241+
242+
- name: Set up Python ${{ matrix.python-version }}
243+
uses: actions/setup-python@v2
244+
with:
245+
python-version: ${{ matrix.python-version }}
246+
architecture: ${{ matrix.platform }}
247+
248+
- name: Setup Environment variables
249+
run: |
250+
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
251+
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
252+
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
253+
if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi
254+
if [ "x86" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; fi
255+
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
256+
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
257+
258+
- name: before install
259+
run: |
260+
set -e
261+
if [[ $SDIST == 0 ]]; then
262+
# Check out and prepare the source
263+
# Multibuild doesn't have releases, so --depth would break eventually (see
264+
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
265+
git submodule update --init multibuild
266+
source multibuild/common_utils.sh
267+
# https://github.com/matthew-brett/multibuild/issues/116
268+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
269+
source multibuild/travis_steps.sh
270+
# This sets -x
271+
# source travis_multibuild_customize.sh
272+
echo $ENABLE_CONTRIB > contrib.enabled
273+
echo $ENABLE_HEADLESS > headless.enabled
274+
echo "end"
275+
# Not interested in travis internal scripts' output
276+
fi
277+
set +x
278+
# Build and package
279+
set -x
280+
ls
281+
if [[ $SDIST == 1 ]]; then
282+
python -m pip install --upgrade pip
283+
python -m pip install scikit-build
284+
python setup.py sdist
285+
else
286+
build_wheel $REPO_DIR $PLAT
287+
fi
288+
set +x
289+
# Install and run tests
290+
set -x
291+
if [[ $SDIST == 1 ]]; then
292+
echo "skipping tests because of sdist"
293+
rc=0
294+
else
295+
install_run $PLAT && rc=$? || rc=$?
296+
fi
297+
set +x
298+
#otherwise, Travis logic terminates prematurely
299+
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
300+
trap ERR
301+
test "$rc" -eq 0
302+
- name: saving artifacts
303+
uses: actions/upload-artifact@v2
304+
with:
305+
name: wheels
306+
path: wheelhouse/opencv*.whl
307+
196308

197309
build_sdist:
198310
runs-on: ${{ matrix.os }}
@@ -275,7 +387,7 @@ jobs:
275387

276388
release:
277389
if: startsWith(github.ref, 'refs/tags/v')
278-
needs: [build, build-windows-x86_64, build_sdist]
390+
needs: [build_linux, build_macos, build-windows-x86_64, build_sdist]
279391
runs-on: ubuntu-latest
280392
defaults:
281393
run:

0 commit comments

Comments
 (0)
0