.travis.yml 11.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
####
#  Travis-CI configuration file for FreeCAD.
#
#  This build configuration will build and test FreeCAD on both Linux
#  and Mac OS X.  For Mac OS X, this configuration will also package
#  and deploy the build to GitHub provided the following prerequisites
#  are satisfied:
#
#  GH_TOKEN is defined as a secure environment variable and contains a
#           a valid GitHub OAUTH token with repo_deployment scope.
#           NOTE: Define this env using the Travis-CI Repo Settings UI
#
#  FREECAD_RELEASE: A GitHub Release with this identifier exists in the
#           repo.  The Travis job will deploy the OS X build to this
#           GitHub release name as a release asset.
16 17 18
#
#  DEPLOY: Repo setting to deploy (defaults to no deploy to reduce
#          Travis build times. Set DEPLOY=1 to enable in repo settings.
19 20 21
##
env:
  global:
22
    - FREECAD_RELEASE="0.18"
23 24 25 26
    - DEPLOY_RELEASE=${DEPLOY_RELEASE:-$FREECAD_RELEASE}
    - CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
    - OSX_PORTS_CACHE=${OSX_PORTS_CACHE:-FreeCAD/FreeCAD-ports-cache}
    - DEPLOY=${DEPLOY:-0}
27 28 29
  matrix:
    # chunk.io key (if needed, obtain it with Yorik, PrzemoF, Kunda1)
    secure: MJu0ZU/9Yqut6bUkHoSrXTV/c/WhCLR0KnHKCsnEU081PYoukzH6ngzgKk7/trAH2In080d/ra4B2OmTNl/LAgV6DXKFY9dO1aG8QwcrHgaMPf0pHYUy/OfwQSFYFByQDV2OEMAHcIWc/dtNkzK2QUi44Kn7d0GtSEiN4s816lriWtjg0vmEGAU8MjvcAGss4gKyn05Xm1NUCYPKgpgIHsywLbpE76lv0eOYoosEuKv5Q9Pb4FMQts02+JUlqE8eY4ZZ3nV8iQbgIDdseOSA7Ixn05zWjU/ZRZ74TrYxMnzfUAwQcJe9OcqoESq+pPWQt5HYG66VmeVxQim1gmsiDASH51U/nswKt0Q4bISj3tVk0YZMFV8Ax+SzPvLEmFZJQGfgO1mg7HdNcz9N9G5JHPawrV19DwYIEFbAw8MCSAoIXFOcPQZUWXCbtjm7NO9vCjMrqyVJMDD9L8omvQajHoajuHbOT8KB250gFokeLj3z8yu++Tz+IrZX5inUMrXsARVt/ALXpi8rJPXmoFMpMUjyWmDPqPWlnqUhLtTtEtKpuOWP8ZnWVwkg4QYOUhCy95C1okJSGkG+ylHWncWfY4mS+UBT525laoh+GOhH+sRW+p2xkI21xGFRqg1oHjjgY1yIYF6nnSHPzxMBRYmZwagyXsjkFG5FPMWR2oYk0Yg
30 31 32 33 34 35 36
cache:
    ccache: true

language: cpp
python:
    - 2.7
    - 3.4
37

38 39
# Inject osx build into matrix - needed to specify image/dist
matrix:
40 41 42 43
    allow_failures:
      - python: 3.7
      - os: osx
    fast_finish: true  # https://blog.travis-ci.com/2013-11-27-fast-finishing-builds
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
    include:
      - os: linux
        dist: trusty
        compiler: clang
        env: 
          - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON"
          - PYTHON_MAJOR_VERSION=2

      - os: linux
        dist: trusty
        compiler: gcc
        env:
          - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON"
          - PYTHON_MAJOR_VERSION=2

      - os: linux
        dist: trusty
        compiler: gcc
        env:
          - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON"
          - PYTHON_MAJOR_VERSION=3

66 67 68 69 70 71 72 73 74
      - language: python
        python: 3.7
        dist: xenial  # required for Python >= 3.7 (travis-ci/travis-ci#9069)
        before_install: true
        install: python3 -m pip install flake8
        # fail the build if there are Python syntax errors or undefined names
        script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

      # macOS build is failing. See: https://forum.freecadweb.org/viewtopic.php?f=10&t=32272
75 76 77 78 79
      - os: osx
        compiler: clang
        env:
          - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON" QT=Qt5
          - PYTHON_MAJOR_VERSION=2
80 81

git:
82
  depth: 5000
83

84 85 86 87 88 89 90 91
notifications:
  email: false
  webhooks:
    urls:
      - https://webhooks.gitter.im/e/479456663cdf5c84e4d8
    on_success: always
    on_failure: always
    on_start:   change
92 93 94 95 96 97 98 99

before_install:
- eval "$(curl -fsSL "https://raw.githubusercontent.com/${OSX_PORTS_CACHE}/v${FREECAD_RELEASE}/travis-helpers.sh")"
- |
  case "${TRAVIS_OS_NAME}" in

   "linux")
       sudo apt-get update -qq
100 101
       sudo apt-get install -y --no-install-recommends          \
                               doxygen                          \
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
                               libboost1.55-dev                 \
                               libboost-filesystem1.55-dev      \
                               libboost-program-options1.55-dev \
                               libboost-python1.55-dev          \
                               libboost-regex1.55-dev           \
                               libboost-signals1.55-dev         \
                               libboost-system1.55-dev          \
                               libboost-thread1.55-dev          \
                               libcoin80                        \
                               libcoin80-dev                    \
                               liboce-foundation-dev            \
                               liboce-modeling-dev              \
                               liboce-ocaf-dev                  \
                               liboce-ocaf-lite-dev             \
                               liboce-visualization-dev         \
                               libpyside-dev                    \
                               libqtcore4                       \
                               libshiboken-dev                  \
                               libxerces-c-dev                  \
                               libxmu-dev                       \
                               libxmu-headers                   \
                               libxmu6                          \
                               libxmuu-dev                      \
                               libxmuu1                         \
                               netgen                           \
                               netgen-headers                   \
                               oce-draw                         \
                               pyside-tools                     \
                               python-dev                       \
                               python-pyside                    \
                               python-matplotlib                \
                               python3-dev                      \
                               python3-pyside                   \
                               python3-matplotlib               \
                               qt4-dev-tools                    \
                               qt4-qmake                        \
                               libqt4-opengl-dev                \
                               shiboken                         \
                               swig                             \
                               libvtk6-dev                      \
                               libmed-dev                       \
143
                               libmedc-dev                      \
144 145
                               asciidoc

146 147 148 149 150 151
       # Make sure dpkg is upgraded for Ubuntu 14.04 (required for eigen3)
       sudo apt-get install -y dpkg

       # Use latest Eigen3 package
       curl -L http://security.ubuntu.com/ubuntu/pool/universe/e/eigen3/libeigen3-dev_3.3.4-4_all.deb -o libeigen3.deb \
            && sudo dpkg -i libeigen3.deb
152

153 154 155 156 157
       # Install ccache to reduce successive build times (use newer version to minimize issues)
       # XXX: ccache <=3.4.3 always builds manuals, requiring asciidoc/xsltproc
       # XXX: 3.4.4 might have --disable-man (at least its present in their git)
       sudo apt install -y xsltproc
       curl -L "https://codeload.github.com/ccache/ccache/tar.gz/v3.4.3" | tar xvz && cd ccache-*
158 159
       ./autogen.sh && ./configure CC=gcc && sudo make install
       cd ${TRAVIS_BUILD_DIR}
160 161 162 163

       export DISPLAY=:99.0
       sh -e /etc/init.d/xvfb start

164 165 166 167 168 169 170 171 172
       export CCACHE_CPP2=YES
       if [[ ${PYTHON_MAJOR_VERSION} == 2 ]]
       then
        export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python"
       else
        export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python3.4 -DPYTHON_BASENAME=.cpython-34m \
        -DPYTHON_SUFFIX=.cpython-34m"
       fi
       export INSTALLED_APP_PATH="/usr/local/bin/FreeCAD"
173 174 175
       ;;

   "osx")
176 177
       xcodebuild -version -sdk
       brew --config
178 179 180
       if [ "${OSX_PORTS_CACHE}X" != "X" ]; then
            brew install jq
            cacheContext=$(create_helper_context repo=${OSX_PORTS_CACHE} auth_token=${GH_TOKEN} release=${FREECAD_RELEASE})
181
            travis_wait prime_local_ports_cache $cacheContext
182
       fi
183 184 185 186 187 188 189 190 191 192 193
       brew update >/dev/null
       brew --config

       brew tap FreeCAD/freecad

       brew install --verbose --only-dependencies freecad --with-packaging-utils
       pip install six
       # Qt5:  Set Qt5 build flag and CMAKE_PREFIX
       QT5_CMAKE_PREFIX=$(ls -d $(brew --cellar)/qt/*/lib/cmake)
       QT5_WEBKIT_CMAKE_PREFIX=$(ls -d $(brew --cellar)/qtwebkit/*/lib/cmake)
       CMAKE_OPTS="${CMAKE_OPTS} -DBUILD_QT5=ON -DCMAKE_PREFIX_PATH=${QT5_CMAKE_PREFIX};${QT5_WEBKIT_CMAKE_PREFIX}"
194 195

       #Install the 3DConnexion frameworks
196 197 198 199 200 201 202 203 204 205 206
       if [ "${DEPLOY}" == "1" ]; then
          if [ ! -d /Library/Frameworks/3DconnexionClient.framework ]; then
             curl -o /tmp/3dFW.dmg -L 'http://www.3dconnexion.com/index.php?eID=sdl&ext=tx_iccsoftware&oid=a273bdbc-c289-e10d-816b-567043331c9e&filename=3DxWareMac_v10-4-1_r2428.dmg'
             hdiutil attach -readonly /tmp/3dFW.dmg
             sudo installer -package /Volumes/3Dconnexion\ Software/Install\ 3Dconnexion\ software.pkg -target /
             diskutil eject /Volumes/3Dconnexion\ Software
          fi
          export CMAKE_OPTS="${CMAKE_OPTS} -DFREECAD_CREATE_MAC_APP=ON"
          export INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/MacOS/FreeCAD"
       else
          export INSTALLED_APP_PATH="/usr/local/MacOS/FreeCAD"
207 208
       fi

209
       export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_USE_EXTERNAL_KDL=ON"
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
       ;;

   *)
       echo "Invalid or unsupported operating system ${TRAVIS_OS_NAME}"
       exit 1
       ;;
  esac

install:
####
#  Build FreeCAD with cmake options set above for each platform
##
  - mkdir build && cd build && cmake ${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ../

script:
####
#  Install FreeCAD and run unit tests.  Test failures will fail the build
##
  - sudo make -j2 install
229
  - ${INSTALLED_APP_PATH} --console --run-test 0
230 231 232 233 234 235 236 237 238 239 240 241 242
  - ${INSTALLED_APP_PATH} --log-file /tmp/FreeCAD_installed.log &
  - sleep 10 && pkill FreeCAD
  - cat /tmp/FreeCAD_installed.log
  - grep --file=../.log_errors /tmp/FreeCAD_installed.log ; [ $? == 1 ] && echo "No errors from .log_errors file found in the log after start from /usr/local/bin" || ( echo "Error from .log_errors found!" && false )

after_success:
####
#  Package and deploy the build to GitHub.  This will only run for builds on
#  master (i.e. pull requests are only built and tested but not deployed).
#
#  GH_TOKEN must be set in order to deploy releases to GitHub
##
- |
243 244 245 246 247
  if [ "${TRAVIS_OS_NAME}" == "osx" -a "${TRAVIS_PULL_REQUEST}" == "false" -a "${DEPLOY}" == "1" ]; then
     brew ls --versions jq || brew install jq
     npm install -g appdmg
     export VSN=$(python ${TRAVIS_BUILD_DIR}/src/Tools/ArchiveNameFromVersionHeader.py ${TRAVIS_BUILD_DIR}/build/src/Build/Version.h)
     export DEPLOYMENT_ARCHIVE=${VSN}-${QT}.dmg
248 249 250
     appdmg ${TRAVIS_BUILD_DIR}/src/MacAppBundle/DiskImage/layout.json "${DEPLOYMENT_ARCHIVE}"
     deployContext=$(create_helper_context repo=${TRAVIS_REPO_SLUG} auth_token=${GH_TOKEN} release=${DEPLOY_RELEASE})
     gitHub_deploy_asset_to_release_named $deployContext ${DEPLOYMENT_ARCHIVE}
251
     gitHub_prune_assets_for_release_named $deployContext "-${QT}" 1
252
  fi