Mirror of Awesome WM window manager
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 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. dist: xenial
  2. language: c
  3. # Build only master and stable branches. Other branches go through PRs.
  4. branches:
  5. only:
  6. - master
  7. - 3.5
  8. addons:
  9. apt:
  10. packages: &BASE_PACKAGES
  11. # Build dependencies.
  12. # See also `apt-cache showsrc awesome | grep -E '^(Version|Build-Depends)'`.
  13. - libnotify-bin
  14. - libcairo2-dev
  15. - gir1.2-gtk-3.0
  16. - libpango1.0-dev
  17. - libxcb-xtest0-dev
  18. - libxcb-icccm4-dev
  19. - libxcb-randr0-dev
  20. - libxcb-keysyms1-dev
  21. - libxcb-xinerama0-dev
  22. - libdbus-1-dev
  23. - libxdg-basedir-dev
  24. - libstartup-notification0-dev
  25. - imagemagick
  26. - libxcb1-dev
  27. - libxcb-shape0-dev
  28. - libxcb-util0-dev
  29. - libx11-xcb-dev
  30. - libxcb-cursor-dev
  31. - libxcb-xkb-dev
  32. - libxcb-xfixes0-dev
  33. - libxkbcommon-dev
  34. - libxkbcommon-x11-dev
  35. # Deps for tests.
  36. - dbus-x11
  37. - xterm
  38. - xdotool
  39. - wmctrl
  40. - xterm
  41. - xvfb
  42. - zsh
  43. - x11-apps
  44. # Need xorg-macros
  45. - xutils-dev
  46. # lgi.
  47. - gir1.2-pango-1.0
  48. - libgirepository1.0-dev
  49. jobs:
  50. include:
  51. - env: LUA=5.2 LUANAME=lua5.2 DO_COVERAGE=coveralls MANUAL_SCREENS=1
  52. addons:
  53. apt:
  54. packages:
  55. - *BASE_PACKAGES
  56. - liblua5.2-dev
  57. - lua5.2
  58. - env: LUA=5.3 LUANAME=lua5.3 DO_COVERAGE=codecov MANUAL_SCREENS=1
  59. addons:
  60. apt:
  61. packages:
  62. - *BASE_PACKAGES
  63. - liblua5.3-dev
  64. - lua5.3
  65. - env: LUA=5.1 LUANAME=lua5.1 BUILD_IN_DIR=/tmp/awesome-build WITH_XCB_ERRORS=yes
  66. addons:
  67. apt:
  68. packages:
  69. - *BASE_PACKAGES
  70. - liblua5.1-dev
  71. - lua5.1
  72. # For xcb-errors
  73. - xcb-proto
  74. - env: LUA=5.1 LUANAME=luajit-2.0 LUALIBRARY=/usr/lib/x86_64-linux-gnu/libluajit-5.1.so LUAROCKS_ARGS=--lua-suffix=jit-2.0.4
  75. addons:
  76. apt:
  77. packages:
  78. - *BASE_PACKAGES
  79. - libluajit-5.1-dev
  80. - luajit
  81. # Lua 5.2 with older lgi and screen size not divisible by 2.
  82. # SOURCE_DATE_EPOCH: used for stable dates during build.
  83. - env: LUA=5.2 LUANAME=lua5.2 LGIVER=0.8.0 TESTS_SCREEN_SIZE=1921x1079 BUILD_APIDOC=true DO_CHECKQA=1 EMPTY_THEME_WHILE_LOADING=1 SOURCE_DATE_EPOCH=1893456000 TEST_PREV_COMMITS=1
  84. addons:
  85. apt:
  86. packages:
  87. - *BASE_PACKAGES
  88. - liblua5.2-dev
  89. - lua5.2
  90. - lua-discount
  91. env:
  92. global:
  93. # Secure GH_APIDOC_TOKEN to push to awesomeWM/apidoc.
  94. - secure: "R/HYDclnws1I1+v9Yjt+RKa4CsFhbBT9tiwE3EfPhEj2KCYX4sFRMxuZvLf5sq0XWdrQaPhQ54fgAZGr3f054JKRXcTB0g9J6nhSHz9kIjPh446gafUhEeDQcZRwM/MeCWiwFIkiZm6smYoDFE9JTWu6quNV+lQ4kcVDOp2ibEc="
  95. before_install:
  96. - if [ "$BUILD_APIDOC" = true ] && [ -n "$DO_COVERAGE" ]; then echo "BUILD_APIDOC and DO_COVERAGE are not meant to be used together." >&2; exit 1; fi
  97. - if [ -z $LUAINCLUDE ]; then LUAINCLUDE=/usr/include/${LUANAME}; fi
  98. - if [ -z $LUALIBRARY ]; then LUALIBRARY=/usr/lib/x86_64-linux-gnu/lib${LUANAME}.so; fi
  99. - cmake --version
  100. install:
  101. - sudo gem install asciidoctor
  102. - |
  103. # Install xcb-util-xrm.
  104. set -e
  105. (git clone --depth 1 --recursive https://github.com/Airblader/xcb-util-xrm.git /tmp/xcb-util-xrm
  106. cd /tmp/xcb-util-xrm
  107. ./autogen.sh --prefix=/usr
  108. make && sudo make install)
  109. # Install xcb-errors if needed
  110. - |
  111. set -e
  112. if [[ "$WITH_XCB_ERRORS" == "yes" ]]; then
  113. git clone --depth 1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-errors.git /tmp/xcb-errors
  114. (cd /tmp/xcb-errors
  115. ./autogen.sh --prefix=/usr
  116. make && sudo make install)
  117. fi
  118. - |
  119. # Install Lua (per env).
  120. if [[ "$LUANAME" == "luajit-2.0" ]]; then
  121. # "Create" /usr/bin/lua if needed (Yup, this is a bad hack)
  122. if [ ! -e "/usr/bin/lua" ]; then sudo ln -s /usr/bin/luajit /usr/bin/lua; fi
  123. else
  124. # lua5.3 does not install /usr/bin/lua, but lua5.1/lua5.2 do.
  125. if [ ! -e "/usr/bin/lua" ]; then sudo ln -s /usr/bin/${LUANAME} /usr/bin/lua; fi
  126. fi
  127. - lua -v
  128. # Install luarocks (for the selected Lua version).
  129. - |
  130. travis_retry wget https://github.com/luarocks/luarocks/archive/v3.0.4.tar.gz
  131. tar xf v3.0.4.tar.gz -C /tmp
  132. (cd /tmp/luarocks-* \
  133. && ./configure --lua-version=$LUA --with-lua-include=${LUAINCLUDE} ${LUAROCKS_ARGS} \
  134. && make build \
  135. && sudo make install)
  136. - travis_retry sudo luarocks install lgi $LGIVER
  137. # Install busted for "make check-unit".
  138. - travis_retry sudo luarocks install busted
  139. # Install luacheck for "make check-qa".
  140. - if [ "$DO_CHECKQA" = 1 ]; then travis_retry sudo luarocks install luacheck; fi
  141. # Install depgraph for "make check-qa".
  142. - if [ "$DO_CHECKQA" = 1 ]; then travis_retry sudo luarocks install depgraph; fi
  143. # Install ldoc for building docs and check-ldoc-warnings.
  144. - |
  145. if [ "$BUILD_APIDOC" = "true" ] || [ "$DO_CHECKQA" = 1 ]; then
  146. travis_retry sudo luarocks install ldoc
  147. fi
  148. # Install dependencies for code coverage testing.
  149. - if [ -n "$DO_COVERAGE" ]; then sudo luarocks install cluacov; fi
  150. - if [ "$DO_COVERAGE" = "coveralls" ]; then sudo luarocks install luacov-coveralls; fi
  151. # Determine custom version.
  152. - export AWESOME_VERSION="${TRAVIS_BRANCH}-g$(git rev-parse --short HEAD)"
  153. - |
  154. if [ "$TRAVIS_PULL_REQUEST" != false ] && [ "$TEST_PREV_COMMITS" = 1 ]; then
  155. AWESOME_VERSION="${AWESOME_VERSION}-PR${TRAVIS_PULL_REQUEST}"
  156. elif [ "$TRAVIS_PULL_REQUEST" != false ]; then
  157. AWESOME_VERSION="v9999-PR${TRAVIS_PULL_REQUEST}";
  158. fi
  159. # function for codecov support
  160. - if [ "$DO_COVERAGE" = "codecov" ]; then travis_retry wget -O /tmp/codecov-bash https://codecov.io/bash; fi
  161. - |
  162. do_codecov() {
  163. echo "== do_codecov in $PWD: $*: build/luacov.stats.out: =="
  164. if [ "$DO_COVERAGE" = "codecov" ]; then
  165. test -f build/luacov.stats.out || { echo 'build/luacov.stats.out does not exist.'; return 1; }
  166. luacov || return 1
  167. travis_retry bash /tmp/codecov-bash -f build/luacov.report.out -X gcov -X coveragepy -F luacov -e LUANAME,LGIVER || return 1
  168. rm build/luacov.report.out build/luacov.stats.out
  169. fi
  170. return 0
  171. }
  172. - |
  173. do_codecov_gcov() {
  174. echo "== do_codecov_gcov in $PWD: $*: =="
  175. if [ "$DO_COVERAGE" = "codecov" ]; then
  176. # Report coverage for each .gcno file separately.
  177. # gcov will create .gcov files for the same source (e.g. for
  178. # globalconf.h from awesome.c.gcno and event.c.gcno).
  179. i=0
  180. set -x
  181. (
  182. cd build
  183. find -path "*/lgi-check.dir" -prune -o \( -name '*.gcno' -print \) | while read -r gcno; do
  184. gcov -pb "$gcno"
  185. mkdir gcov.$(( ++i ))
  186. mv *.gcov "gcov.$i"
  187. # Delete any files for /usr.
  188. # They are not relevant and might cause "Invalid path part" errors
  189. # with Code Climate.
  190. find "gcov.$i" -maxdepth 1 -type f -name '#usr#*.gcov' -delete
  191. done
  192. # Upload to Codecov.
  193. travis_retry bash /tmp/codecov-bash -X gcov -X coveragepy -F gcov -e LUANAME,LGIVER
  194. )
  195. fi
  196. return 0
  197. }
  198. # Functions for custom Travis folds.
  199. - |
  200. travis_fold_start() {
  201. travis_fold start "$1"
  202. travis_fold_current="$1"
  203. }
  204. travis_fold_end() {
  205. travis_fold end "$travis_fold_current"
  206. }
  207. travis_run_in_fold() {
  208. travis_fold_start "$1"
  209. shift
  210. "$@" || return 1
  211. travis_fold_end
  212. return 0
  213. }
  214. script:
  215. - if [ "$MANUAL_SCREENS" != "1" ]; then export MANUAL_SCREENS=0; fi
  216. - export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIBRARY} -D LUA_INCLUDE_DIR=${LUAINCLUDE} -D OVERRIDE_VERSION=$AWESOME_VERSION -D STRICT_TESTS=true -D DO_COVERAGE=$DO_COVERAGE -D TEST_MANUAL_SCREENS=$MANUAL_SCREENS -D CMAKE_C_FLAGS=-Werror"
  217. - |
  218. if [ "$EMPTY_THEME_WHILE_LOADING" = 1 ]; then
  219. # Break beautiful so that trying to access the theme before beautiful.init() causes an error
  220. sed -i -e 's/theme = {}/theme = setmetatable({}, { __index = function() error("May not access theme before beautiful.init()") end })/' lib/beautiful/init.lua \
  221. && grep -q 'May not access' lib/beautiful/init.lua
  222. fi
  223. - |
  224. set -e
  225. if [ -n "$BUILD_IN_DIR" ]; then
  226. # Explicitly remove the Makefile to not build from the src dir accidentally.
  227. rm Makefile
  228. SOURCE_DIRECTORY="$PWD"
  229. mkdir "$BUILD_IN_DIR"
  230. cd "$BUILD_IN_DIR"
  231. travis_run_in_fold "build_in_dir" cmake $CMAKE_ARGS "$SOURCE_DIRECTORY"
  232. fi
  233. - travis_run_in_fold "make" make
  234. - |
  235. if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
  236. travis_run_in_fold "make.install" sudo env PATH=$PATH make install
  237. awesome --version
  238. fi
  239. # Run checks.
  240. - |
  241. if [ "$TRAVIS_TEST_RESULT" = 0 ]; then
  242. set -ex
  243. if [ -n "$DO_COVERAGE" ]; then
  244. travis_fold_start "DO_COVERAGE"
  245. # Run tests/examples explicitly.
  246. make check-examples || exit 1
  247. do_codecov samples
  248. make check-unit || exit 1
  249. do_codecov unittests
  250. make check-integration || exit 1
  251. do_codecov functionaltests
  252. make check-themes || exit 1
  253. do_codecov themes
  254. do_codecov_gcov c_code
  255. travis_fold_end
  256. else
  257. # TODO: does not run check-examples. Should it?
  258. travis_run_in_fold "make.check-unit" make check-unit
  259. travis_run_in_fold "make.check-integration" make check-integration
  260. travis_run_in_fold "make.check-themes" make check-themes
  261. fi
  262. set +x
  263. fi
  264. # Run check-qa.
  265. - |
  266. if [ "$DO_CHECKQA" = 1 ]; then
  267. travis_run_in_fold "make.check-qa" make check-qa
  268. fi
  269. - |
  270. if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then
  271. set -e
  272. # Check each commit separately (to make git-bisect less annoying).
  273. # Fix Travis' commit range (https://github.com/travis-ci/travis-ci/issues/4596).
  274. commit_range="${TRAVIS_COMMIT_RANGE/.../..}"
  275. echo "Testing previous commits ($commit_range)"
  276. rev_list="$(git rev-list --bisect-all $commit_range)"
  277. echo "rev-list: $rev_list"
  278. commits="$(echo "$rev_list" | grep -v 'dist=0' | cut -d\ -f 1)"
  279. n="$(echo "$commits" | wc -l)"
  280. echo "Testing $n commits: $commits"
  281. i=0
  282. failed=
  283. for commit in $commits; do
  284. i=$((i+1))
  285. travis_fold_start "test_commit_${commit}_.$i.$n"
  286. echo "Testing commit $commit"
  287. git reset --hard # Some files are updated when compiling...
  288. git checkout "$commit"
  289. git --no-pager show --stat
  290. if ! make all check CMAKE_ARGS+="-D DO_COVERAGE=0"; then
  291. failed="$failed $commit"
  292. fi
  293. travis_fold_end
  294. done
  295. git checkout -qf FETCH_HEAD
  296. if [ -n "$failed" ]; then
  297. echo "Checks failed for these commits:"
  298. for c in $failed; do
  299. git log -1 --pretty="%h %s (%an, %ad)" "$c"
  300. done
  301. false
  302. fi
  303. fi
  304. after_success:
  305. # Push updated API docs for relevant branches, e.g. non-PRs builds on master.
  306. - if [ "$BUILD_APIDOC" = "true" ]; then build-utils/travis-apidoc.sh; fi
  307. # Push code coverage information
  308. - |
  309. set -e
  310. if [ "$DO_COVERAGE" = "coveralls" ]; then
  311. test -f build/luacov.stats.out || { echo 'build/luacov.stats.out does not exist.'; return 1; }
  312. luacov-coveralls --verbose --merge
  313. fi