From 32e08585017cc8b2d74bbb60318996b709502b4d Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Fri, 17 Sep 2021 10:06:23 +0800 Subject: [PATCH] Fix travis. (#7237) --- .travis.yml | 1 - tests/travis/run_test.sh | 2 +- tests/travis/setup.sh | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 206d1d489030..e087d911892b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ addons: update: false apt: packages: - - snapd - unzip before_install: diff --git a/tests/travis/run_test.sh b/tests/travis/run_test.sh index 2a2f5a95ae15..4baf983e586a 100755 --- a/tests/travis/run_test.sh +++ b/tests/travis/run_test.sh @@ -92,6 +92,7 @@ fi if [ ${TASK} == "s390x_test" ]; then set -e + python3 -m pip install --user pytest hypothesis cmake # Build and run C++ tests rm -rf build @@ -102,6 +103,5 @@ if [ ${TASK} == "s390x_test" ]; then # Run model compatibility tests cd .. - python3 -m pip install --user pytest hypothesis PYTHONPATH=./python-package python3 -m pytest --fulltrace -v -rxXs tests/python/test_basic.py fi diff --git a/tests/travis/setup.sh b/tests/travis/setup.sh index 442f536c251b..d3771f646dd3 100755 --- a/tests/travis/setup.sh +++ b/tests/travis/setup.sh @@ -1,11 +1,14 @@ #!/bin/bash -# https://travis-ci.community/t/macos-build-fails-because-of-homebrew-bundle-unknown-command/7296/27 -# Use libomp 11.1.0: https://github.com/dmlc/xgboost/issues/7039 -brew update # Force update, so that update doesn't overwrite our version of libomp.rb -wget https://raw.githubusercontent.com/Homebrew/homebrew-core/679923b4eb48a8dc7ecc1f05d06063cd79b3fc00/Formula/libomp.rb -O $(find $(brew --repository) -name libomp.rb) -brew install cmake libomp -brew pin libomp +if [ ${TRAVIS_OS_NAME} == "osx" ]; then + # https://travis-ci.community/t/macos-build-fails-because-of-homebrew-bundle-unknown-command/7296/27 + # Use libomp 11.1.0: https://github.com/dmlc/xgboost/issues/7039 + brew update # Force update, so that update doesn't overwrite our version of libomp.rb + wget https://raw.githubusercontent.com/Homebrew/homebrew-core/679923b4eb48a8dc7ecc1f05d06063cd79b3fc00/Formula/libomp.rb -O $(find $(brew --repository) -name libomp.rb) + brew install cmake libomp + brew pin libomp +fi + if [ ${TASK} == "python_test" ] || [ ${TASK} == "python_sdist_test" ]; then @@ -29,10 +32,7 @@ if [ ${TASK} == "python_test" ] || [ ${TASK} == "python_sdist_test" ]; then fi if [ ${TASK} == "s390x_test" ] && [ ${TRAVIS_CPU_ARCH} == "s390x" ]; then - sudo snap install cmake --channel=3.17/beta --classic - export PATH=/snap/bin:${PATH} - cmake --version sudo apt-get update sudo apt-get install -y --no-install-recommends tar unzip wget git build-essential ninja-build \ - time python3 python3-pip python3-numpy python3-scipy python3-sklearn r-base + time python3 python3-pip python3-numpy python3-scipy python3-sklearn r-base fi