44 # pip dependencies to _test_ your project
55 - TEST_DEPENDS="numpy==1.11.1"
66 # params to bdist_wheel. used to set osx build target.
7- - BDIST_PARAMS=""
87 - CONFIG_PATH="travis_config.sh"
98 - USE_CCACHE=1
109 - UNICODE_WIDTH=32
10+ - SDIST=0
1111
1212# Save some time, we and setup check them out on demand instead
1313# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
@@ -28,6 +28,7 @@ stages:
2828
2929jobs :
3030 fast_finish : true
31+ # Travis exclude is buggy, this seems to be the only way to disable default build
3132 exclude :
3233 - language : ruby
3334 include :
5758 # used in OSX custom build script dealing with local bottle caching
5859 - $HOME/local_bottle_metadata
5960
61+ # source distributions
62+ - os : linux
63+ stage : s1
64+ script : skip
65+ env :
66+ - SDIST=1
67+ - ENABLE_CONTRIB=0
68+ - ENABLE_HEADLESS=0
69+ python : " 3.8"
70+ language : python
71+ dist : xenial
72+ - os : linux
73+ stage : s1
74+ script : skip
75+ env :
76+ - SDIST=1
77+ - ENABLE_CONTRIB=0
78+ - ENABLE_HEADLESS=1
79+ python : " 3.8"
80+ language : python
81+ dist : xenial
82+ - os : linux
83+ stage : s1
84+ script : skip
85+ env :
86+ - SDIST=1
87+ - ENABLE_CONTRIB=1
88+ - ENABLE_HEADLESS=0
89+ python : " 3.8"
90+ language : python
91+ dist : xenial
92+ - os : linux
93+ stage : s1
94+ script : skip
95+ env :
96+ - SDIST=1
97+ - ENABLE_CONTRIB=1
98+ - ENABLE_HEADLESS=1
99+ python : " 3.8"
100+ language : python
101+ dist : xenial
102+
60103 # default builds for MacOS
61104 # further jobs in the list will use the same stage until the next assignment
62105 - stage : final
@@ -606,25 +649,28 @@ jobs:
606649
607650# The first line is printed in the folding header in Travis output
608651before_install : |
609- # Check out and prepare the source
610652 set -e
611- # Multibuild doesn't have releases, so --depth would break eventually (see
612- # https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
613- git submodule update --init multibuild
614- echo "Source multibuild/common_utils.sh"
615- source multibuild/common_utils.sh
616- # https://github.com/matthew-brett/multibuild/issues/116
617- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
618- echo "Source multibuild/travis_steps.sh"
619- source multibuild/travis_steps.sh
620- # This sets -x
621- echo "Source travis_multibuild_customize.sh"
622- source travis_multibuild_customize.sh
623- echo $ENABLE_CONTRIB > contrib.enabled
624- echo $ENABLE_HEADLESS > headless.enabled
625653
626- if [ -n "$IS_OSX" ]; then
627- echo "homebrew"
654+ if [[ $SDIST == 0 ]]; then
655+ # Check out and prepare the source
656+ # Multibuild doesn't have releases, so --depth would break eventually (see
657+ # https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
658+ git submodule update --init multibuild
659+
660+ source multibuild/common_utils.sh
661+
662+ # https://github.com/matthew-brett/multibuild/issues/116
663+ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
664+
665+ source multibuild/travis_steps.sh
666+ # This sets -x
667+
668+ source travis_multibuild_customize.sh
669+ echo $ENABLE_CONTRIB > contrib.enabled
670+ echo $ENABLE_HEADLESS > headless.enabled
671+
672+ if [ -n "$IS_OSX" ]; then
673+ export PATH="/usr/local/sbin:$PATH"
628674 TAPS="$(brew --repository)/Library/Taps"
629675 if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then
630676 rm -rf "$TAPS/caskroom/homebrew-cask"
@@ -635,88 +681,124 @@ before_install: |
635681 git clean -fxd || echo "status: $?"
636682 sleep 1 || echo "status: $?"
637683 git status || echo "status: $?"' \; || echo "status: $?"
638-
639684 brew_cache_cleanup
685+ fi
686+ echo "end"
687+ # Not interested in travis internal scripts' output
640688 fi
641- echo "end"
642- # Not interested in travis internal scripts' output
689+
643690 set +x
644691
645692install : |
646693 # Build and package
647694 set -x
648- build_wheel $REPO_DIR $PLAT
695+
696+ if [[ $SDIST == 1 ]]; then
697+ python -m pip install --upgrade pip
698+ python -m pip install scikit-build
699+ python setup.py sdist
700+ else
701+ build_wheel $REPO_DIR $PLAT
702+ fi
703+
649704 set +x
650705
651706script : |
652707 # Install and run tests
653708 set -x
654- install_run $PLAT && rc=$? || rc=$?
709+ if [[ $SDIST == 1 ]]; then
710+ echo "skipping tests because of sdist"
711+ else
712+ install_run $PLAT && rc=$? || rc=$?
713+ fi
714+
655715 set +x
656716
657717 #otherwise, Travis logic terminates prematurely
658718 #https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
659719 trap ERR
660-
661720 test "$rc" -eq 0
662721
663722before_cache : |
664723 # Cleanup dirs to be cached
665724 set -e; set -x
666725 if [ -n "$IS_OSX" ]; then
667726
668- # When Taps is cached, this dir causes "Error: file exists" on `brew update`
669- if [ -e "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/homebrew-cask" ]; then
670- rm -rf "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/homebrew-cask"
671- fi
727+ # When Taps is cached, this dir causes "Error: file exists" on `brew update`
728+ if [ -e "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/homebrew-cask" ]; then
729+ rm -rf "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/homebrew-cask"
730+ fi
672731
673- brew_cache_cleanup
732+ brew_cache_cleanup
674733
675734 fi
676735 set +x; set +e
677736
678737after_success : |
679- # Upload wheels to pypi if tag is set, otherwise save to Azure Storage
738+ # Upload wheels to pypi if tag is set
739+
740+ set -x
741+
680742 if [ -n "$TRAVIS_TAG" ]; then
681- set -x
682743
683- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
684- pip install --user twine
685- pip install --user --upgrade six
744+ if [[ $ENABLE_CONTRIB == 0 ]]; then
745+ if [[ $ENABLE_HEADLESS == 0 ]]; then
746+ echo "This is default build. Deployment will be done to to PyPI entry opencv-python."
747+ else
748+ echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-python-headless."
686749 fi
687-
688- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
689- pip install twine
690- pip install --upgrade pyOpenSSL
750+ else
751+ if [[ $ENABLE_HEADLESS == 0 ]]; then
752+ echo "This is contrib build. Deployment will be done to to PyPI entry opencv-contrib-python."
753+ else
754+ echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-contrib-python-headless."
691755 fi
756+ fi
757+
758+ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
759+ pip install --user twine
760+ pip install --user --upgrade six
692761
693- if [[ $ENABLE_CONTRIB == 0 ]]; then
694- if [[ $ENABLE_HEADLESS == 0 ]]; then
695- echo "This is default build. Deployment will be done to to PyPI entry opencv-python."
696- else
697- echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-python-headless."
698- fi
762+ if [[ $SDIST == 1 ]]; then
763+ twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist
699764 else
700- if [[ $ENABLE_HEADLESS == 0 ]]; then
701- echo "This is contrib build. Deployment will be done to to PyPI entry opencv-contrib-python."
702- else
703- echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-contrib-python-headless."
704- fi
765+ twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
705766 fi
706767
707- twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
708- set +x
709- else
710- set -x
768+ fi
769+
770+ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
771+ # macpython 3.5 doesn't support recent TLS protocols which causes twine
772+ # upload to fail, so we use the system Python to run twine
773+ /usr/bin/python -m ensurepip --user
774+ /usr/bin/python -m pip install --user -U pip
775+ /usr/bin/python -m pip install --user -U -I twine
711776
712- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
713- curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
777+ if [[ $SDIST == 1 ]]; then
778+ /usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist
714779 else
715- brew install azure-cli
780+ /usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
716781 fi
717782
718- az storage container create -n ${TRAVIS_COMMIT} --public-access blob
719- az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern *.whl
783+ fi
720784
721- set -x
722785 fi
786+
787+ # Save to Azure storage always
788+
789+ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
790+ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
791+ else
792+ brew install azure-cli
793+ fi
794+
795+ az storage container create -n ${TRAVIS_COMMIT} --public-access blob
796+
797+ if [[ $SDIST == 1 ]]; then
798+ az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz
799+ else
800+ az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern opencv*.whl
801+ fi
802+
803+ set +x
804+
0 commit comments