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+ env :
64+ - SDIST=1
65+ - ENABLE_CONTRIB=0
66+ - ENABLE_HEADLESS=0
67+ python : " 3.8"
68+ language : python
69+ dist : xenial
70+ - os : linux
71+ env :
72+ - SDIST=1
73+ - ENABLE_CONTRIB=0
74+ - ENABLE_HEADLESS=1
75+ python : " 3.8"
76+ language : python
77+ dist : xenial
78+ - os : linux
79+ env :
80+ - SDIST=1
81+ - ENABLE_CONTRIB=1
82+ - ENABLE_HEADLESS=0
83+ python : " 3.8"
84+ language : python
85+ dist : xenial
86+ - os : linux
87+ env :
88+ - SDIST=1
89+ - ENABLE_CONTRIB=1
90+ - ENABLE_HEADLESS=1
91+ python : " 3.8"
92+ language : python
93+ dist : xenial
94+
6095 # default builds for MacOS
6196 # further jobs in the list will use the same stage until the next assignment
6297 - stage : final
@@ -606,56 +641,74 @@ jobs:
606641
607642# The first line is printed in the folding header in Travis output
608643before_install : |
609- # Check out and prepare the source
610644 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
625645
626- if [ -n "$IS_OSX" ]; then
627- echo "homebrew"
628- TAPS="$(brew --repository)/Library/Taps"
629- if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then
630- rm -rf "$TAPS/caskroom/homebrew-cask"
631- fi
632- find "$TAPS" -type d -name .git -exec \
633- bash -xec '
634- cd $(dirname '\''{}'\'') || echo "status: $?"
635- git clean -fxd || echo "status: $?"
636- sleep 1 || echo "status: $?"
637- git status || echo "status: $?"' \; || echo "status: $?"
646+ if [ -z "$SDIST" ]; then
647+ echo "sdist build"
648+ else
649+ # Check out and prepare the source
650+ # Multibuild doesn't have releases, so --depth would break eventually (see
651+ # https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
652+ git submodule update --init multibuild
638653
639- brew_cache_cleanup
654+ source multibuild/common_utils.sh
655+
656+ # https://github.com/matthew-brett/multibuild/issues/116
657+ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
658+
659+ source multibuild/travis_steps.sh
660+ # This sets -x
661+
662+ source travis_multibuild_customize.sh
663+ echo $ENABLE_CONTRIB > contrib.enabled
664+ echo $ENABLE_HEADLESS > headless.enabled
665+
666+ if [ -n "$IS_OSX" ]; then
667+ echo "homebrew"
668+ TAPS="$(brew --repository)/Library/Taps"
669+ if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then
670+ rm -rf "$TAPS/caskroom/homebrew-cask"
671+ fi
672+ find "$TAPS" -type d -name .git -exec \
673+ bash -xec '
674+ cd $(dirname '\''{}'\'') || echo "status: $?"
675+ git clean -fxd || echo "status: $?"
676+ sleep 1 || echo "status: $?"
677+ git status || echo "status: $?"' \; || echo "status: $?"
678+ brew_cache_cleanup
679+ fi
680+ echo "end"
681+ # Not interested in travis internal scripts' output
640682 fi
641- echo "end"
642- # Not interested in travis internal scripts' output
683+
643684 set +x
644685
645686install : |
646687 # Build and package
647688 set -x
648- build_wheel $REPO_DIR $PLAT
689+
690+ if [ -z "$SDIST" ]; then
691+ python setup.py sdist
692+ else
693+ build_wheel $REPO_DIR $PLAT
694+ fi
695+
649696 set +x
650697
651698script : |
652699 # Install and run tests
653700 set -x
654- install_run $PLAT && rc=$? || rc=$?
701+
702+ if [ -z "$SDIST" ]; then
703+ echo "sdist"
704+ else
705+ install_run $PLAT && rc=$? || rc=$?
706+ fi
707+
655708 set +x
656709
657- #otherwise, Travis logic terminates prematurely
658- #https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
710+ # otherwise, Travis logic terminates prematurely
711+ # https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
659712 trap ERR
660713
661714 test "$rc" -eq 0
@@ -676,19 +729,11 @@ before_cache: |
676729 set +x; set +e
677730
678731after_success : |
679- # Upload wheels to pypi if tag is set, otherwise save to Azure Storage
680- if [ -n "$TRAVIS_TAG" ]; then
681- set -x
732+ # Upload wheels to pypi if tag is set
682733
683- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
684- pip install --user twine
685- pip install --user --upgrade six
686- fi
734+ set -x
687735
688- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
689- pip install twine
690- pip install --upgrade pyOpenSSL
691- fi
736+ if [ -n "$TRAVIS_TAG" ]; then
692737
693738 if [[ $ENABLE_CONTRIB == 0 ]]; then
694739 if [[ $ENABLE_HEADLESS == 0 ]]; then
@@ -704,19 +749,50 @@ after_success: |
704749 fi
705750 fi
706751
707- twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
708- set +x
709- else
710- set -x
711-
712752 if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
713- curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
714- else
715- brew install azure-cli
753+ pip install --user twine
754+ pip install --user --upgrade six
755+
756+ if [ -z "$SDIST" ]; then
757+ twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist
758+ else
759+ twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
760+ fi
761+
716762 fi
717763
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
764+ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
765+ # macpython 3.5 doesn't support recent TLS protocols which causes twine
766+ # upload to fail, so we use the system Python to run twine
767+ /usr/bin/python -m ensurepip --user
768+ /usr/bin/python -m pip install --user -U pip
769+ /usr/bin/python -m pip install --user -U -I twine
770+
771+ if [ -z "$SDIST" ]; then
772+ /usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist
773+ else
774+ /usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
775+ fi
776+
777+ fi
720778
721- set -x
722779 fi
780+
781+ # Save to Azure storage always
782+
783+ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
784+ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
785+ else
786+ brew install azure-cli
787+ fi
788+
789+ az storage container create -n ${TRAVIS_COMMIT} --public-access blob
790+
791+ if [ -z "$SDIST" ]; then
792+ az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz
793+ else
794+ az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern *.whl
795+ fi
796+
797+ set +x
798+
0 commit comments