4
4
# pip dependencies to _test_ your project
5
5
- TEST_DEPENDS="numpy==1.11.1"
6
6
# params to bdist_wheel. used to set osx build target.
7
- - BDIST_PARAMS=""
8
7
- CONFIG_PATH="travis_config.sh"
9
8
- USE_CCACHE=1
10
9
- UNICODE_WIDTH=32
10
+ - SDIST=0
11
11
12
12
# Save some time, we and setup check them out on demand instead
13
13
# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
@@ -28,6 +28,7 @@ stages:
28
28
29
29
jobs :
30
30
fast_finish : true
31
+ # Travis exclude is buggy, this seems to be the only way to disable default build
31
32
exclude :
32
33
- language : ruby
33
34
include :
57
58
# used in OSX custom build script dealing with local bottle caching
58
59
- $HOME/local_bottle_metadata
59
60
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
+
60
103
# default builds for MacOS
61
104
# further jobs in the list will use the same stage until the next assignment
62
105
- stage : final
@@ -606,25 +649,28 @@ jobs:
606
649
607
650
# The first line is printed in the folding header in Travis output
608
651
before_install : |
609
- # Check out and prepare the source
610
652
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
625
653
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"
628
674
TAPS="$(brew --repository)/Library/Taps"
629
675
if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then
630
676
rm -rf "$TAPS/caskroom/homebrew-cask"
@@ -635,88 +681,124 @@ before_install: |
635
681
git clean -fxd || echo "status: $?"
636
682
sleep 1 || echo "status: $?"
637
683
git status || echo "status: $?"' \; || echo "status: $?"
638
-
639
684
brew_cache_cleanup
685
+ fi
686
+ echo "end"
687
+ # Not interested in travis internal scripts' output
640
688
fi
641
- echo "end"
642
- # Not interested in travis internal scripts' output
689
+
643
690
set +x
644
691
645
692
install : |
646
693
# Build and package
647
694
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
+
649
704
set +x
650
705
651
706
script : |
652
707
# Install and run tests
653
708
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
+
655
715
set +x
656
716
657
717
#otherwise, Travis logic terminates prematurely
658
718
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
659
719
trap ERR
660
-
661
720
test "$rc" -eq 0
662
721
663
722
before_cache : |
664
723
# Cleanup dirs to be cached
665
724
set -e; set -x
666
725
if [ -n "$IS_OSX" ]; then
667
726
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
672
731
673
- brew_cache_cleanup
732
+ brew_cache_cleanup
674
733
675
734
fi
676
735
set +x; set +e
677
736
678
737
after_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
+
680
742
if [ -n "$TRAVIS_TAG" ]; then
681
- set -x
682
743
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."
686
749
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."
691
755
fi
756
+ fi
757
+
758
+ if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
759
+ pip install --user twine
760
+ pip install --user --upgrade six
692
761
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
699
764
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*
705
766
fi
706
767
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
711
776
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
714
779
else
715
- brew install azure-cli
780
+ /usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
716
781
fi
717
782
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
720
784
721
- set -x
722
785
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