You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2019/10/16 22:37:47 UTC

[qpid-dispatch] 03/04: DISPATCH-1282 - Add macOS to .travis.yml matrix

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit 83b4c836e94cb71156f3f9c405b66f2f65d2dbb3
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Fri Jun 14 14:13:38 2019 +0200

    DISPATCH-1282 - Add macOS to .travis.yml matrix
    
    # Observations
    
    - DYLD_FALLBACK_LIBRARY_PATH doesn't work on travis, see `csrutil status`
    - Cyrus SASL is not in Brew, it is in MacPorts, though
    - MacPorts require setting export COLUMNS=80`
    - The macOS build matrix row is set to never fail the build
---
 .travis.yml | 40 ++++++++++++++++++++-------
 macports.sh | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index aa62cde..a50402a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,14 +17,32 @@
 # under the License
 #
 
-os: linux
 sudo: true
 language: c
 cache: ccache
-env:
-  - PROTON_VERSION=master BUILD_TYPE=Debug
-  - PROTON_VERSION=0.29.0 BUILD_TYPE=Coverage
-  - PROTON_VERSION=0.29.0 BUILD_TYPE=RelWithDebInfo
+matrix:
+  fast_finish: true
+  allow_failures:
+    - os: osx
+  include:
+  - os: linux
+    env:
+    - PROTON_VERSION=master BUILD_TYPE=Debug
+  - os: linux
+    env:
+    - PROTON_VERSION=0.29.0 BUILD_TYPE=Coverage
+  - os: linux
+    env:
+    - PROTON_VERSION=0.29.0 BUILD_TYPE=RelWithDebInfo
+  - os: osx
+    osx_image: xcode10.1
+    env:
+    - PATH="/opt/local/bin:/opt/local/sbin:/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH" PROTON_VERSION=master
+    before_install:
+    - sudo /usr/bin/python -m easy_install unittest2
+    - bash ./macports.sh
+    - export COLUMNS=80
+    - yes | sudo port install swig swig-python libuv jsoncpp cyrus-sasl2 pkgconfig
 
 addons:
   apt:
@@ -49,29 +67,31 @@ addons:
     - lcov
 
 install:
+- NPROC=2
 - PREFIX=$PWD/install
 - git clone --depth=10 --branch=$PROTON_VERSION https://github.com/apache/qpid-proton.git
 
-# Build and install latest proton from source.
+# Build and install proton from source.
 - mkdir qpid-proton/build
 - pushd qpid-proton/build
 - export PATH="/usr/bin:$PATH" # Avoid mismatched python interpreters in /opt
-- cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_PYTHON=YES -DBUILD_JAVASCRIPT=NO -DBUILD_CPP=NO -DBUILD_GO=NO -DBUILD_RUBY=NO -DBUILD_PHP=NO -DBUILD_PERL=NO 
-- cmake --build . --target install
+- cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_PYTHON=YES -DBUILD_JAVASCRIPT=NO -DBUILD_CPP=NO -DBUILD_GO=NO -DBUILD_RUBY=NO -DBUILD_PHP=NO -DBUILD_PERL=NO
+- cmake --build . --target install -- -j $NPROC
 - popd
 
 before_script:
-- PREFIX=$PWD/install
 - source qpid-proton/build/config.sh
 - mkdir build
 - pushd build
 - cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DUSE_VALGRIND=NO -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDISPATCH_TEST_TIMEOUT=600
-- cmake --build . --target install
+- cmake --build . --target install -- -j $NPROC
 
 script:
 - pushd ../qpid-proton
 - echo $(echo "Current proton commit:") $(git rev-parse HEAD) "(${PROTON_VERSION})"
 - popd
+# Workaround on macOS for PROTON-808 Binaries have their library locations stripped
+- if [[ "$OSTYPE" == "darwin"* ]]; then install_name_tool -add_rpath $PREFIX/lib/. $PREFIX/lib/proton/bindings/python/_cproton.so; fi
 - ctest -V && if [ "$BUILD_TYPE" = "Coverage" ]; then cmake --build . --target coverage; fi
 - popd
 - mvn apache-rat:check
diff --git a/macports.sh b/macports.sh
new file mode 100644
index 0000000..4c4ed4c
--- /dev/null
+++ b/macports.sh
@@ -0,0 +1,90 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Based on https://github.com/GiovanniBussi/macports-ci
+
+set -Exeuo pipefail
+
+export COLUMNS=80
+
+MACPORTS_VERSION=2.5.4
+MACPORTS_PREFIX=/opt/local
+MACPORTS_SYNC=tarball
+
+pushd "$(mktemp -d)"
+
+OSX_VERSION="$(sw_vers -productVersion | sed 's/\.[^\.]*$//')"
+
+if test "$OSX_VERSION" == 10.10 ; then
+  OSX_NAME=Yosemite
+elif test "$OSX_VERSION" == 10.11 ; then
+  OSX_NAME=ElCapitan
+elif test "$OSX_VERSION" == 10.12 ; then
+  OSX_NAME=Sierra
+elif test "$OSX_VERSION" == 10.13 ; then
+  OSX_NAME=HighSierra
+elif test "$OSX_VERSION" == 10.14 ; then
+  OSX_NAME=Mojave
+else
+  echo "macports-ci: Unknown OSX version $OSX_VERSION"
+  exit 1
+fi
+
+echo "macports-ci: OSX version $OSX_VERSION $OSX_NAME"
+
+MACPORTS_PKG=MacPorts-${MACPORTS_VERSION}-${OSX_VERSION}-${OSX_NAME}.pkg
+
+URL="https://distfiles.macports.org/MacPorts"
+URL="https://github.com/macports/macports-base/releases/download/v$MACPORTS_VERSION/"
+
+echo "macports-ci: Base URL is $URL"
+
+# download installer:
+curl -LO $URL/$MACPORTS_PKG
+# install:
+sudo installer -verbose -pkg $MACPORTS_PKG -target /
+
+# update:
+export PATH="$MACPORTS_PREFIX/bin:$PATH"
+
+i=1
+# run through a while to retry upon failure
+while true
+do
+  echo "macports-ci: Trying to selfupdate (iteration $i)"
+# here I test for the presence of a known portfile
+# this check confirms that ports were installed
+# notice that port -N selfupdate && break is not sufficient as a test
+# (sometime it returns a success even though ports have not been installed)
+# for some misterious reasons, running without "-d" does not work in some case
+  sudo port -d -N selfupdate 2>&1 | grep -v DEBUG | awk '{if($1!="x")print}'
+  port info xdrfile > /dev/null && break || true
+  sleep 5
+  i=$((i+1))
+  if ((i>20)) ; then
+    echo "macports-ci: Failed after $i iterations"
+    exit 1
+  fi
+done
+
+echo "macports-ci: Selfupdate successful after $i iterations"
+
+dir="$PWD"
+popd
+sudo rm -rf $dir


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org