An official mirror (for now...) of the FreeCAD project. Currently maintained in sync manually by Yorik. Please check https://www.freecadweb.org for issues and pull requests https://www.freecadweb.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.travis.yml 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. ####
  2. # Travis-CI configuration file for FreeCAD.
  3. #
  4. # This build configuration will build and test FreeCAD on both Linux
  5. # and Mac OS X. For Mac OS X, this configuration will also package
  6. # and deploy the build to GitHub provided the following prerequisites
  7. # are satisfied:
  8. #
  9. # GH_TOKEN is defined as a secure environment variable and contains a
  10. # a valid GitHub OAUTH token with repo_deployment scope.
  11. # NOTE: Define this env using the Travis-CI Repo Settings UI
  12. #
  13. # FREECAD_RELEASE: A GitHub Release with this identifier exists in the
  14. # repo. The Travis job will deploy the OS X build to this
  15. # GitHub release name as a release asset.
  16. #
  17. # DEPLOY: Repo setting to deploy (defaults to no deploy to reduce
  18. # Travis build times. Set DEPLOY=1 to enable in repo settings.
  19. ##
  20. env:
  21. global:
  22. - FREECAD_RELEASE="0.18"
  23. - DEPLOY_RELEASE=${DEPLOY_RELEASE:-$FREECAD_RELEASE}
  24. - CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}
  25. - OSX_PORTS_CACHE=${OSX_PORTS_CACHE:-FreeCAD/FreeCAD-ports-cache}
  26. - DEPLOY=${DEPLOY:-0}
  27. - GENERATOR="Unix Makefiles"
  28. matrix:
  29. # chunk.io key (if needed, obtain it with Yorik, PrzemoF, Kunda1)
  30. secure: MJu0ZU/9Yqut6bUkHoSrXTV/c/WhCLR0KnHKCsnEU081PYoukzH6ngzgKk7/trAH2In080d/ra4B2OmTNl/LAgV6DXKFY9dO1aG8QwcrHgaMPf0pHYUy/OfwQSFYFByQDV2OEMAHcIWc/dtNkzK2QUi44Kn7d0GtSEiN4s816lriWtjg0vmEGAU8MjvcAGss4gKyn05Xm1NUCYPKgpgIHsywLbpE76lv0eOYoosEuKv5Q9Pb4FMQts02+JUlqE8eY4ZZ3nV8iQbgIDdseOSA7Ixn05zWjU/ZRZ74TrYxMnzfUAwQcJe9OcqoESq+pPWQt5HYG66VmeVxQim1gmsiDASH51U/nswKt0Q4bISj3tVk0YZMFV8Ax+SzPvLEmFZJQGfgO1mg7HdNcz9N9G5JHPawrV19DwYIEFbAw8MCSAoIXFOcPQZUWXCbtjm7NO9vCjMrqyVJMDD9L8omvQajHoajuHbOT8KB250gFokeLj3z8yu++Tz+IrZX5inUMrXsARVt/ALXpi8rJPXmoFMpMUjyWmDPqPWlnqUhLtTtEtKpuOWP8ZnWVwkg4QYOUhCy95C1okJSGkG+ylHWncWfY4mS+UBT525laoh+GOhH+sRW+p2xkI21xGFRqg1oHjjgY1yIYF6nnSHPzxMBRYmZwagyXsjkFG5FPMWR2oYk0Yg
  31. cache:
  32. ccache: true
  33. directories:
  34. - $HOME/.ccache
  35. language: cpp
  36. python:
  37. - 2.7
  38. - 3.6
  39. # Inject osx build into matrix - needed to specify image/dist
  40. matrix:
  41. allow_failures:
  42. - python: 3.7
  43. - os: osx
  44. fast_finish: true # https://blog.travis-ci.com/2013-11-27-fast-finishing-builds
  45. include:
  46. - os: linux
  47. dist: bionic
  48. compiler: clang
  49. env:
  50. - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON -DBUILD_QT5=ON"
  51. - PYTHON_MAJOR_VERSION=3
  52. - os: linux
  53. dist: bionic
  54. compiler: gcc
  55. env:
  56. - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON -DBUILD_QT5=ON"
  57. - PYTHON_MAJOR_VERSION=3
  58. - os: linux
  59. dist: bionic
  60. compiler: gcc
  61. env:
  62. - PYTHON_MAJOR_VERSION=2
  63. - os: windows
  64. language: cpp
  65. filter_secrets: false
  66. env:
  67. - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON -DFREECAD_RELEASE_PDB=OFF"
  68. - GENERATOR="Visual Studio 15 2017 Win64"
  69. - PYTHON_MAJOR_VERSION=3
  70. - MSBUILD_PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
  71. - TEST_PATH="C:\Users\travis\build\FreeCAD\FreeCAD\build\bin"
  72. - CLCACHE_PATH="C:\Users\travis\build\FreeCAD\FreeCAD\"
  73. - VS15=true
  74. - CCACHE_TEMPDIR=/tmp/.ccache-temp
  75. - CCACHE_COMPRESS=1
  76. - CCACHE_DIR=$HOME/.ccache
  77. # enable this if clcache extended log is needed
  78. #- CLCACHE_LOG=1
  79. cache:
  80. directories:
  81. - $HOME/clcache
  82. - language: python
  83. python: 3.7
  84. dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
  85. before_install: true
  86. install: python3 -m pip install flake8
  87. # fail the build if there are Python syntax errors or undefined names
  88. script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
  89. # macOS build is failing. See: https://forum.freecadweb.org/viewtopic.php?f=10&t=32272
  90. - os: osx
  91. compiler: clang
  92. env:
  93. - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON" QT=Qt5
  94. - PYTHON_MAJOR_VERSION=2
  95. git:
  96. depth: 5000
  97. notifications:
  98. email: false
  99. webhooks:
  100. urls:
  101. - https://webhooks.gitter.im/e/479456663cdf5c84e4d8
  102. on_success: always
  103. on_failure: always
  104. on_start: change
  105. before_install:
  106. - eval "$(curl -fsSL "https://raw.githubusercontent.com/${OSX_PORTS_CACHE}/v${FREECAD_RELEASE}/travis-helpers.sh")"
  107. - |
  108. case "${TRAVIS_OS_NAME}" in
  109. "linux")
  110. # Daily PPA for OCCT, Pivy, Netgen, PySide ... packages
  111. sudo apt-add-repository -y ppa:freecad-maintainers/freecad-daily
  112. sudo apt-get update -qq
  113. # Build deps
  114. sudo apt-get install -y --no-install-recommends \
  115. python-dev \
  116. python-pyside \
  117. python-matplotlib \
  118. python3-dev \
  119. python3-pyside \
  120. python3-matplotlib \
  121. libboost1.65-dev \
  122. libboost-filesystem1.65-dev \
  123. libboost-program-options1.65-dev \
  124. libboost-python1.65-dev \
  125. libboost-regex1.65-dev \
  126. libboost-signals1.65-dev \
  127. libboost-system1.65-dev \
  128. libboost-thread1.65-dev \
  129. libxerces-c-dev \
  130. libocct-data-exchange-dev \
  131. libocct-ocaf-dev \
  132. libocct-visualization-dev \
  133. libvtk7-dev \
  134. libmedc-dev \
  135. swig \
  136. qt4-qmake \
  137. libqt4-opengl-dev \
  138. libqtwebkit-dev \
  139. qtbase5-dev \
  140. libqt5xmlpatterns5-dev \
  141. libqt5svg5-dev \
  142. libqt5opengl5-dev \
  143. qttools5-dev \
  144. qtwebengine5-dev \
  145. libcoin80-dev \
  146. libpyside-dev \
  147. libpyside2-dev \
  148. libshiboken-dev \
  149. libshiboken2-dev \
  150. pyside-tools \
  151. pyside2-tools \
  152. doxygen \
  153. graphviz \
  154. netgen \
  155. netgen-headers \
  156. libmetis-dev \
  157. libspnav-dev
  158. export DISPLAY=:99.0
  159. sh -e /etc/init.d/xvfb start
  160. export CCACHE_CPP2=YES
  161. if [[ ${PYTHON_MAJOR_VERSION} == 2 ]]
  162. then
  163. export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python"
  164. else
  165. export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python3"
  166. fi
  167. export INSTALLED_APP_PATH="/usr/local/bin/FreeCAD"
  168. ;;
  169. "osx")
  170. xcodebuild -version -sdk
  171. brew --config
  172. if [ "${OSX_PORTS_CACHE}X" != "X" ]; then
  173. brew install jq
  174. cacheContext=$(create_helper_context repo=${OSX_PORTS_CACHE} auth_token=${GH_TOKEN} release=${FREECAD_RELEASE})
  175. travis_wait prime_local_ports_cache $cacheContext
  176. fi
  177. brew update >/dev/null
  178. brew --config
  179. brew tap FreeCAD/freecad
  180. brew install --verbose --only-dependencies freecad --with-packaging-utils
  181. pip install six
  182. # Qt5: Set Qt5 build flag and CMAKE_PREFIX
  183. QT5_CMAKE_PREFIX=$(ls -d $(brew --cellar)/qt/*/lib/cmake)
  184. QT5_WEBKIT_CMAKE_PREFIX=$(ls -d $(brew --cellar)/qtwebkit/*/lib/cmake)
  185. CMAKE_OPTS="${CMAKE_OPTS} -DBUILD_QT5=ON -DCMAKE_PREFIX_PATH=${QT5_CMAKE_PREFIX};${QT5_WEBKIT_CMAKE_PREFIX}"
  186. #Install the 3DConnexion frameworks
  187. if [ "${DEPLOY}" == "1" ]; then
  188. if [ ! -d /Library/Frameworks/3DconnexionClient.framework ]; then
  189. 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'
  190. hdiutil attach -readonly /tmp/3dFW.dmg
  191. sudo installer -package /Volumes/3Dconnexion\ Software/Install\ 3Dconnexion\ software.pkg -target /
  192. diskutil eject /Volumes/3Dconnexion\ Software
  193. fi
  194. export CMAKE_OPTS="${CMAKE_OPTS} -DFREECAD_CREATE_MAC_APP=ON"
  195. export INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/MacOS/FreeCAD"
  196. else
  197. export INSTALLED_APP_PATH="/usr/local/MacOS/FreeCAD"
  198. fi
  199. export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_USE_EXTERNAL_KDL=ON"
  200. ;;
  201. "windows")
  202. #choco install -y python
  203. #py -m pip install --quiet --upgrade pip
  204. #py -m pip install git+https://github.com/frerich/clcache.git@v4.2.0
  205. curl -L https://github.com/frerich/clcache/releases/download/v4.2.0/clcache-4.2.0.zip --output clcache-4.2.0.zip
  206. 7z x clcache-4.2.0.zip > /dev/null
  207. export PATH=$CLCACHE_PATH:$PATH
  208. export PATH=$TEST_PATH:$PATH
  209. #reset clcache hit stats
  210. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\clcache.exe -z'
  211. # clcache stats before compilation
  212. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\clcache.exe -s'
  213. curl -L https://github.com/apeltauer/FreeCAD/releases/download/LibPack_12.1/FreeCADLibs_12.1.2_x64_VC15.7z --output FreeCADLibs.7z
  214. 7z x FreeCADLibs.7z -oFreeCADLibs > /dev/null
  215. export LIBPACK_DIR="$TRAVIS_BUILD_DIR\FreeCADLibs"
  216. export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_LIBPACK_DIR=$TRAVIS_BUILD_DIR\FreeCADLibs -DPYTHON_EXECUTABLE=$TRAVIS_BUILD_DIR\FreeCADLibs\bin\python.exe \
  217. -DBUILD_QT5=TRUE"
  218. export PATH=$MSBUILD_PATH:$PATH
  219. ;;
  220. *)
  221. echo "Invalid or unsupported operating system ${TRAVIS_OS_NAME}"
  222. exit 1
  223. ;;
  224. esac
  225. install:
  226. ####
  227. # Build FreeCAD with cmake options set above for each platform
  228. ##
  229. - mkdir build && cd build && cmake -G"${GENERATOR}" ${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ../
  230. script:
  231. ####
  232. # Install FreeCAD and run unit tests. Test failures will fail the build
  233. ##
  234. # MSBuild.exe /m FreeCAD.sln
  235. - |
  236. if [ "${TRAVIS_OS_NAME}" == "windows" ]; then
  237. # call msbuild using clcache
  238. #cmd.exe /C '"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64 && MSBuild.exe FreeCAD.sln /p:CLToolExe=clcache.exe /p:TrackFileAccess=false /p:CLToolPath=C:\Users\travis\build\FreeCAD\FreeCAD /m:2 /nologo /verbosity:minimal /p:Configuration=Release /p:Platform=x64'
  239. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\.travis\build.bat'
  240. # ls -lahR
  241. cp -a ../FreeCADLibs/bin/* bin/
  242. # show clcache hit stats
  243. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\clcache.exe -s'
  244. # run the tests
  245. #cmd.exe /C 'cd C:\Users\travis\build\FreeCAD\FreeCAD\build\bin && FreeCADCmd.exe --run-test 0'
  246. # Make build fail if ANY of the following fails
  247. #set -ev
  248. winpty.exe -Xallow-non-tty -Xplain /C/Users/travis/build/FreeCAD/FreeCAD/build/bin/FreeCADCmd.exe --run-test 0 | tee runlog.txt
  249. grep -q FAILED runlog.txt ; [ $? == 1 ] && echo "Build succeeded and tests passed!" || ( echo "Tests failed!" && false )
  250. else
  251. # Stop compiling (GCC) after 2 hrs 15 min (2 hrs 30 min limit).
  252. # Preserves created ccache for the next build job.
  253. if [ "${TRAVIS_OS_NAME}" == "linux" ]; then sudo timeout -k 140m 135m make -j2 install || true; fi
  254. if [ "${TRAVIS_OS_NAME}" == "osx" ]; then sudo make -j2 install; fi
  255. ${INSTALLED_APP_PATH} --console --run-test 0
  256. ${INSTALLED_APP_PATH} --log-file /tmp/FreeCAD_installed.log &
  257. sleep 10 && pkill FreeCAD
  258. cat /tmp/FreeCAD_installed.log
  259. 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 )
  260. fi
  261. after_success:
  262. ####
  263. # Package and deploy the build to GitHub. This will only run for builds on
  264. # master (i.e. pull requests are only built and tested but not deployed).
  265. #
  266. # GH_TOKEN must be set in order to deploy releases to GitHub
  267. ##
  268. - |
  269. if [ "${TRAVIS_OS_NAME}" == "osx" -a "${TRAVIS_PULL_REQUEST}" == "false" -a "${DEPLOY}" == "1" ]; then
  270. brew ls --versions jq || brew install jq
  271. npm install -g appdmg
  272. export VSN=$(python ${TRAVIS_BUILD_DIR}/src/Tools/ArchiveNameFromVersionHeader.py ${TRAVIS_BUILD_DIR}/build/src/Build/Version.h)
  273. export DEPLOYMENT_ARCHIVE=${VSN}-${QT}.dmg
  274. appdmg ${TRAVIS_BUILD_DIR}/src/MacAppBundle/DiskImage/layout.json "${DEPLOYMENT_ARCHIVE}"
  275. deployContext=$(create_helper_context repo=${TRAVIS_REPO_SLUG} auth_token=${GH_TOKEN} release=${DEPLOY_RELEASE})
  276. gitHub_deploy_asset_to_release_named $deployContext ${DEPLOYMENT_ARCHIVE}
  277. gitHub_prune_assets_for_release_named $deployContext "-${QT}" 1
  278. fi