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.

336 lines
15KB

  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. fast_finish: true # https://blog.travis-ci.com/2013-11-27-fast-finishing-builds
  44. include:
  45. - os: linux
  46. dist: bionic
  47. compiler: clang
  48. addons:
  49. apt:
  50. sources:
  51. - sourceline: 'ppa:ubuntu-toolchain-r/test'
  52. - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
  53. key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
  54. packages:
  55. - clang-9
  56. env:
  57. - CC=clang-9
  58. - CXX=clang++-9
  59. - CMAKE_OPTS="-DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_FEM_NETGEN=ON -DBUILD_QT5=ON"
  60. - PYTHON_MAJOR_VERSION=3
  61. - CACHE_NAME=JOB1
  62. # - os: linux
  63. # dist: bionic
  64. # compiler: gcc
  65. # addons:
  66. # apt:
  67. # sources:
  68. # - sourceline: 'ppa:ubuntu-toolchain-r/test'
  69. # packages:
  70. # - gcc-9
  71. # - g++-9
  72. # env:
  73. # - CC=gcc-9
  74. # - CXX=g++-9
  75. # - CMAKE_OPTS="-DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_FEM_NETGEN=ON -DBUILD_QT5=ON"
  76. # - PYTHON_MAJOR_VERSION=3
  77. # - CACHE_NAME=JOB2
  78. - os: linux
  79. dist: bionic
  80. compiler: gcc
  81. env:
  82. - CMAKE_OPTS="-DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_FEM_NETGEN=ON -DBUILD_QT5=ON"
  83. - PYTHON_MAJOR_VERSION=3
  84. - CACHE_NAME=JOB3
  85. - os: linux
  86. dist: bionic
  87. compiler: gcc
  88. env:
  89. - PYTHON_MAJOR_VERSION=2
  90. - CACHE_NAME=JOB4
  91. - os: windows
  92. language: cpp
  93. filter_secrets: false
  94. env:
  95. - CMAKE_OPTS="-DBUILD_FEM_NETGEN=ON -DFREECAD_RELEASE_PDB=OFF"
  96. - GENERATOR="Visual Studio 15 2017 Win64"
  97. - PYTHON_MAJOR_VERSION=3
  98. - MSBUILD_PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
  99. - TEST_PATH="C:\Users\travis\build\FreeCAD\FreeCAD\build\bin"
  100. - CLCACHE_PATH="C:\Users\travis\build\FreeCAD\FreeCAD\"
  101. - VS15=true
  102. - CCACHE_TEMPDIR=/tmp/.ccache-temp
  103. - CCACHE_COMPRESS=1
  104. - CCACHE_DIR=$HOME/.ccache
  105. - CACHE_NAME=JOB5
  106. # enable this if clcache extended log is needed
  107. #- CLCACHE_LOG=1
  108. cache:
  109. directories:
  110. - $HOME/clcache
  111. # - language: python
  112. # python: 3.7
  113. # dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
  114. # before_install: true
  115. # install: python3 -m pip install flake8
  116. # # fail the build if there are Python syntax errors or undefined names
  117. # script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
  118. git:
  119. depth: 5000
  120. notifications:
  121. email: false
  122. webhooks:
  123. urls:
  124. - https://webhooks.gitter.im/e/479456663cdf5c84e4d8
  125. on_success: always
  126. on_failure: always
  127. on_start: change
  128. before_install:
  129. - eval "$(curl -fsSL "https://raw.githubusercontent.com/${OSX_PORTS_CACHE}/v${FREECAD_RELEASE}/travis-helpers.sh")"
  130. - |
  131. case "${TRAVIS_OS_NAME}" in
  132. "linux")
  133. # Daily PPA for OCCT, Pivy, Netgen, PySide ... packages
  134. sudo apt-add-repository -y ppa:freecad-maintainers/freecad-daily
  135. sudo apt-get update -qq
  136. # Build deps
  137. sudo apt-get install -y --no-install-recommends \
  138. python-dev \
  139. python-pyside \
  140. python-matplotlib \
  141. python3-dev \
  142. python3-pyside \
  143. python3-matplotlib \
  144. libboost1.65-dev \
  145. libboost-filesystem1.65-dev \
  146. libboost-program-options1.65-dev \
  147. libboost-python1.65-dev \
  148. libboost-regex1.65-dev \
  149. libboost-signals1.65-dev \
  150. libboost-system1.65-dev \
  151. libboost-thread1.65-dev \
  152. libxerces-c-dev \
  153. libocct-data-exchange-dev \
  154. libocct-ocaf-dev \
  155. libocct-visualization-dev \
  156. libvtk7-dev \
  157. libmedc-dev \
  158. pybind11-dev \
  159. swig \
  160. qt4-qmake \
  161. libqt4-opengl-dev \
  162. libqtwebkit-dev \
  163. qtbase5-dev \
  164. libqt5xmlpatterns5-dev \
  165. libqt5svg5-dev \
  166. libqt5opengl5-dev \
  167. qttools5-dev \
  168. qtwebengine5-dev \
  169. libcoin80-dev \
  170. libpyside-dev \
  171. libpyside2-dev \
  172. libshiboken-dev \
  173. libshiboken2-dev \
  174. pyside-tools \
  175. pyside2-tools \
  176. doxygen \
  177. graphviz \
  178. libnglib-dev \
  179. netgen \
  180. netgen-headers \
  181. libmetis-dev \
  182. libspnav-dev
  183. # Runtime deps
  184. sudo apt-get install -y --no-install-recommends freecad-daily-python3
  185. export DISPLAY=:99.0
  186. sh -e /etc/init.d/xvfb start
  187. export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/netgen/:$LD_LIRBARY_PATH
  188. export CCACHE_CPP2=YES
  189. if [[ ${PYTHON_MAJOR_VERSION} == 2 ]]
  190. then
  191. export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python"
  192. else
  193. export CMAKE_ARGS="${CMAKE_OPTS} -DPYTHON_EXECUTABLE=/usr/bin/python3"
  194. fi
  195. export INSTALLED_APP_PATH="/usr/local/bin/FreeCAD"
  196. ;;
  197. "osx")
  198. xcodebuild -version -sdk
  199. brew --config
  200. if [ "${OSX_PORTS_CACHE}X" != "X" ]; then
  201. brew install jq
  202. cacheContext=$(create_helper_context repo=${OSX_PORTS_CACHE} auth_token=${GH_TOKEN} release=${FREECAD_RELEASE})
  203. travis_wait prime_local_ports_cache $cacheContext
  204. fi
  205. brew update >/dev/null
  206. brew --config
  207. brew tap FreeCAD/freecad
  208. brew install --verbose --only-dependencies freecad --with-packaging-utils
  209. pip install six
  210. # Qt5: Set Qt5 build flag and CMAKE_PREFIX
  211. QT5_CMAKE_PREFIX=$(ls -d $(brew --cellar)/qt/*/lib/cmake)
  212. QT5_WEBKIT_CMAKE_PREFIX=$(ls -d $(brew --cellar)/qtwebkit/*/lib/cmake)
  213. CMAKE_OPTS="${CMAKE_OPTS} -DBUILD_QT5=ON -DCMAKE_PREFIX_PATH=${QT5_CMAKE_PREFIX};${QT5_WEBKIT_CMAKE_PREFIX}"
  214. #Install the 3DConnexion frameworks
  215. if [ "${DEPLOY}" == "1" ]; then
  216. if [ ! -d /Library/Frameworks/3DconnexionClient.framework ]; then
  217. 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'
  218. hdiutil attach -readonly /tmp/3dFW.dmg
  219. sudo installer -package /Volumes/3Dconnexion\ Software/Install\ 3Dconnexion\ software.pkg -target /
  220. diskutil eject /Volumes/3Dconnexion\ Software
  221. fi
  222. export CMAKE_OPTS="${CMAKE_OPTS} -DFREECAD_CREATE_MAC_APP=ON"
  223. export INSTALLED_APP_PATH="/usr/local/FreeCAD.app/Contents/MacOS/FreeCAD"
  224. else
  225. export INSTALLED_APP_PATH="/usr/local/MacOS/FreeCAD"
  226. fi
  227. export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_USE_EXTERNAL_KDL=ON"
  228. ;;
  229. "windows")
  230. #choco install -y python
  231. #py -m pip install --quiet --upgrade pip
  232. #py -m pip install git+https://github.com/frerich/clcache.git@v4.2.0
  233. curl -L https://github.com/frerich/clcache/releases/download/v4.2.0/clcache-4.2.0.zip --output clcache-4.2.0.zip
  234. 7z x clcache-4.2.0.zip > /dev/null
  235. export PATH=$CLCACHE_PATH:$PATH
  236. export PATH=$TEST_PATH:$PATH
  237. #reset clcache hit stats
  238. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\clcache.exe -z'
  239. # clcache stats before compilation
  240. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\clcache.exe -s'
  241. curl -L https://github.com/apeltauer/FreeCAD/releases/download/LibPack_12.1/FreeCADLibs_12.1.2_x64_VC15.7z --output FreeCADLibs.7z
  242. 7z x FreeCADLibs.7z -oFreeCADLibs > /dev/null
  243. rm -f FreeCADLibs.7z
  244. export LIBPACK_DIR="$TRAVIS_BUILD_DIR\FreeCADLibs"
  245. export CMAKE_ARGS="${CMAKE_OPTS} -DFREECAD_LIBPACK_DIR=$TRAVIS_BUILD_DIR\FreeCADLibs -DPYTHON_EXECUTABLE=$TRAVIS_BUILD_DIR\FreeCADLibs\bin\python.exe \
  246. -DBUILD_QT5=TRUE"
  247. export PATH=$MSBUILD_PATH:$PATH
  248. ;;
  249. *)
  250. echo "Invalid or unsupported operating system ${TRAVIS_OS_NAME}"
  251. exit 1
  252. ;;
  253. esac
  254. install:
  255. ####
  256. # Build FreeCAD with cmake options set above for each platform
  257. ##
  258. - mkdir build && cd build && cmake -G"${GENERATOR}" ${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ../
  259. script:
  260. ####
  261. # Install FreeCAD and run unit tests. Test failures will fail the build
  262. ##
  263. # MSBuild.exe /m FreeCAD.sln
  264. - |
  265. if [ "${TRAVIS_OS_NAME}" == "windows" ]; then
  266. # call msbuild using clcache
  267. #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'
  268. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\.travis\build.bat'
  269. # ls -lahR
  270. du -hs bin/
  271. mv ../FreeCADLibs/bin/* bin/
  272. du -hs bin/
  273. # show clcache hit stats
  274. cmd.exe /C 'C:\Users\travis\build\FreeCAD\FreeCAD\clcache.exe -s'
  275. # run the tests
  276. #cmd.exe /C 'cd C:\Users\travis\build\FreeCAD\FreeCAD\build\bin && FreeCADCmd.exe --run-test 0'
  277. # Make build fail if ANY of the following fails
  278. #set -ev
  279. winpty.exe -Xallow-non-tty -Xplain /C/Users/travis/build/FreeCAD/FreeCAD/build/bin/FreeCADCmd.exe --run-test 0 | tee runlog.txt
  280. grep -q FAILED runlog.txt ; [ $? == 1 ] && echo "Build succeeded and tests passed!" || ( echo "Tests failed!" && false )
  281. else
  282. # Stop compiling (GCC) after 2 hrs 50 min (3 hrs limit).
  283. # Preserves created ccache for the next build job.
  284. if [ "${TRAVIS_OS_NAME}" == "linux" ]; then sudo timeout -k 175m 170m make -j2 install || true; fi
  285. if [ "${TRAVIS_OS_NAME}" == "osx" ]; then sudo make -j2 install; fi
  286. # sudo make -j2 install
  287. ${INSTALLED_APP_PATH} --console --run-test 0 || travis_terminate 1
  288. ${INSTALLED_APP_PATH} --log-file /tmp/FreeCAD_installed.log &
  289. sleep 10 && pkill FreeCAD
  290. cat /tmp/FreeCAD_installed.log
  291. 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 )
  292. fi
  293. after_success:
  294. ####
  295. # Package and deploy the build to GitHub. This will only run for builds on
  296. # master (i.e. pull requests are only built and tested but not deployed).
  297. #
  298. # GH_TOKEN must be set in order to deploy releases to GitHub
  299. ##
  300. - |
  301. if [ "${TRAVIS_OS_NAME}" == "osx" -a "${TRAVIS_PULL_REQUEST}" == "false" -a "${DEPLOY}" == "1" ]; then
  302. brew ls --versions jq || brew install jq
  303. npm install -g appdmg
  304. export VSN=$(python ${TRAVIS_BUILD_DIR}/src/Tools/ArchiveNameFromVersionHeader.py ${TRAVIS_BUILD_DIR}/build/src/Build/Version.h)
  305. export DEPLOYMENT_ARCHIVE=${VSN}-${QT}.dmg
  306. appdmg ${TRAVIS_BUILD_DIR}/src/MacAppBundle/DiskImage/layout.json "${DEPLOYMENT_ARCHIVE}"
  307. deployContext=$(create_helper_context repo=${TRAVIS_REPO_SLUG} auth_token=${GH_TOKEN} release=${DEPLOY_RELEASE})
  308. gitHub_deploy_asset_to_release_named $deployContext ${DEPLOYMENT_ARCHIVE}
  309. gitHub_prune_assets_for_release_named $deployContext "-${QT}" 1
  310. fi