diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 832120558..000000000 --- a/.travis.yml +++ /dev/null @@ -1,342 +0,0 @@ -dist: xenial -language: c - -# Build only master and stable branches. Other branches go through PRs. -branches: - only: - - master - - 3.5 - -addons: - apt: - packages: &BASE_PACKAGES - # Build dependencies. - # See also `apt-cache showsrc awesome | grep -E '^(Version|Build-Depends)'`. - - libnotify-bin - - libcairo2-dev - - gir1.2-gtk-3.0 - - libpango1.0-dev - - libxcb-xtest0-dev - - libxcb-icccm4-dev - - libxcb-randr0-dev - - libxcb-keysyms1-dev - - libxcb-xinerama0-dev - - libdbus-1-dev - - libxdg-basedir-dev - - libstartup-notification0-dev - - imagemagick - - libxcb1-dev - - libxcb-shape0-dev - - libxcb-util0-dev - - libx11-xcb-dev - - libxcb-cursor-dev - - libxcb-xkb-dev - - libxcb-xfixes0-dev - - libxkbcommon-dev - - libxkbcommon-x11-dev - # Deps for tests. - - dbus-x11 - - xterm - - xdotool - - wmctrl - - xterm - - xvfb - - zsh - - x11-apps - # Need xorg-macros - - xutils-dev - # lgi. - - gir1.2-pango-1.0 - - libgirepository1.0-dev - -jobs: - include: - - env: LUA=5.2 LUANAME=lua5.2 DO_COVERAGE=coveralls MANUAL_SCREENS=1 - addons: - apt: - packages: - - *BASE_PACKAGES - - liblua5.2-dev - - lua5.2 - - env: LUA=5.3 LUANAME=lua5.3 DO_COVERAGE=codecov MANUAL_SCREENS=1 - addons: - apt: - packages: - - *BASE_PACKAGES - - liblua5.3-dev - - lua5.3 - - env: LUA=5.1 LUANAME=lua5.1 BUILD_IN_DIR=/tmp/awesome-build WITH_XCB_ERRORS=yes - addons: - apt: - packages: - - *BASE_PACKAGES - - liblua5.1-dev - - lua5.1 - # For xcb-errors - - xcb-proto - - 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 - addons: - apt: - packages: - - *BASE_PACKAGES - - libluajit-5.1-dev - - luajit - # Lua 5.2 with older lgi and screen size not divisible by 2. - # SOURCE_DATE_EPOCH: used for stable dates during build. - - 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 - addons: - apt: - packages: - - *BASE_PACKAGES - - liblua5.2-dev - - lua5.2 - - lua-discount - -env: - global: - # Secure GH_APIDOC_TOKEN to push to awesomeWM/apidoc. - - secure: "R/HYDclnws1I1+v9Yjt+RKa4CsFhbBT9tiwE3EfPhEj2KCYX4sFRMxuZvLf5sq0XWdrQaPhQ54fgAZGr3f054JKRXcTB0g9J6nhSHz9kIjPh446gafUhEeDQcZRwM/MeCWiwFIkiZm6smYoDFE9JTWu6quNV+lQ4kcVDOp2ibEc=" - -before_install: - - 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 - - if [ -z $LUAINCLUDE ]; then LUAINCLUDE=/usr/include/${LUANAME}; fi - - if [ -z $LUALIBRARY ]; then LUALIBRARY=/usr/lib/x86_64-linux-gnu/lib${LUANAME}.so; fi - - cmake --version - -install: - - sudo gem install asciidoctor - - | - # Install xcb-util-xrm. - set -e - (git clone --depth 1 --recursive https://github.com/Airblader/xcb-util-xrm.git /tmp/xcb-util-xrm - cd /tmp/xcb-util-xrm - ./autogen.sh --prefix=/usr - make && sudo make install) - - # Install xcb-errors if needed - - | - set -e - if [[ "$WITH_XCB_ERRORS" == "yes" ]]; then - git clone --depth 1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-errors.git /tmp/xcb-errors - (cd /tmp/xcb-errors - ./autogen.sh --prefix=/usr - make && sudo make install) - fi - - - | - # Install Lua (per env). - if [[ "$LUANAME" == "luajit-2.0" ]]; then - # "Create" /usr/bin/lua if needed (Yup, this is a bad hack) - if [ ! -e "/usr/bin/lua" ]; then sudo ln -s /usr/bin/luajit /usr/bin/lua; fi - else - # lua5.3 does not install /usr/bin/lua, but lua5.1/lua5.2 do. - if [ ! -e "/usr/bin/lua" ]; then sudo ln -s /usr/bin/${LUANAME} /usr/bin/lua; fi - fi - - lua -v - - # Install luarocks (for the selected Lua version). - - | - travis_retry wget https://github.com/luarocks/luarocks/archive/v3.0.4.tar.gz - tar xf v3.0.4.tar.gz -C /tmp - (cd /tmp/luarocks-* \ - && ./configure --lua-version=$LUA --with-lua-include=${LUAINCLUDE} ${LUAROCKS_ARGS} \ - && make build \ - && sudo make install) - - - travis_retry sudo luarocks install lgi $LGIVER - - # Install busted for "make check-unit". - - travis_retry sudo luarocks install busted - # Install luacheck for "make check-qa". - - if [ "$DO_CHECKQA" = 1 ]; then travis_retry sudo luarocks install luacheck; fi - # Install depgraph for "make check-qa". - - if [ "$DO_CHECKQA" = 1 ]; then travis_retry sudo luarocks install depgraph; fi - - # Install ldoc for building docs and check-ldoc-warnings. - - | - if [ "$BUILD_APIDOC" = "true" ] || [ "$DO_CHECKQA" = 1 ]; then - travis_retry sudo luarocks install ldoc - fi - - # Install dependencies for code coverage testing. - - if [ -n "$DO_COVERAGE" ]; then sudo luarocks install cluacov; fi - - if [ "$DO_COVERAGE" = "coveralls" ]; then sudo luarocks install luacov-coveralls; fi - - # Determine custom version. - - export AWESOME_VERSION="${TRAVIS_BRANCH}-g$(git rev-parse --short HEAD)" - - | - if [ "$TRAVIS_PULL_REQUEST" != false ] && [ "$TEST_PREV_COMMITS" = 1 ]; then - AWESOME_VERSION="${AWESOME_VERSION}-PR${TRAVIS_PULL_REQUEST}" - elif [ "$TRAVIS_PULL_REQUEST" != false ]; then - AWESOME_VERSION="v9999-PR${TRAVIS_PULL_REQUEST}"; - fi - # function for codecov support - - if [ "$DO_COVERAGE" = "codecov" ]; then travis_retry wget -O /tmp/codecov-bash https://codecov.io/bash; fi - - | - do_codecov() { - echo "== do_codecov in $PWD: $*: build/luacov.stats.out: ==" - if [ "$DO_COVERAGE" = "codecov" ]; then - test -f build/luacov.stats.out || { echo 'build/luacov.stats.out does not exist.'; return 1; } - luacov || return 1 - travis_retry bash /tmp/codecov-bash -f build/luacov.report.out -X gcov -X coveragepy -F luacov -e LUANAME,LGIVER || return 1 - rm build/luacov.report.out build/luacov.stats.out - fi - return 0 - } - - | - do_codecov_gcov() { - echo "== do_codecov_gcov in $PWD: $*: ==" - if [ "$DO_COVERAGE" = "codecov" ]; then - # Report coverage for each .gcno file separately. - # gcov will create .gcov files for the same source (e.g. for - # globalconf.h from awesome.c.gcno and event.c.gcno). - i=0 - set -x - ( - cd build - find -path "*/lgi-check.dir" -prune -o \( -name '*.gcno' -print \) | while read -r gcno; do - gcov -pb "$gcno" - - mkdir gcov.$(( ++i )) - mv *.gcov "gcov.$i" - - # Delete any files for /usr. - # They are not relevant and might cause "Invalid path part" errors - # with Code Climate. - find "gcov.$i" -maxdepth 1 -type f -name '#usr#*.gcov' -delete - done - - # Upload to Codecov. - travis_retry bash /tmp/codecov-bash -X gcov -X coveragepy -F gcov -e LUANAME,LGIVER - ) - fi - return 0 - } - - # Functions for custom Travis folds. - - | - travis_fold_start() { - travis_fold start "$1" - travis_fold_current="$1" - } - travis_fold_end() { - travis_fold end "$travis_fold_current" - } - travis_run_in_fold() { - travis_fold_start "$1" - shift - "$@" || return 1 - travis_fold_end - return 0 - } -script: - - if [ "$MANUAL_SCREENS" != "1" ]; then export MANUAL_SCREENS=0; fi - - 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" - - | - if [ "$EMPTY_THEME_WHILE_LOADING" = 1 ]; then - # Break beautiful so that trying to access the theme before beautiful.init() causes an error - sed -i -e 's/theme = {}/theme = setmetatable({}, { __index = function() error("May not access theme before beautiful.init()") end })/' lib/beautiful/init.lua \ - && grep -q 'May not access' lib/beautiful/init.lua - fi - - | - trap 'echo ERR CODE $? from $BASH_COMMAND : $LINENO' ERR - trap 'echo EXIT CODE $? from $BASH_COMMAND : $LINENO' EXIT - set -ex - if [ -n "$BUILD_IN_DIR" ]; then - # Explicitly remove the Makefile to not build from the src dir accidentally. - rm Makefile - SOURCE_DIRECTORY="$PWD" - mkdir "$BUILD_IN_DIR" - cd "$BUILD_IN_DIR" - travis_run_in_fold "build_in_dir" cmake $CMAKE_ARGS "$SOURCE_DIRECTORY" - fi - - travis_run_in_fold "make" make - - | - if [ "$TRAVIS_TEST_RESULT" = 0 ]; then - travis_run_in_fold "make.install" sudo env PATH=$PATH make install - awesome --version - fi - # Run checks. - - | - if [ "$TRAVIS_TEST_RESULT" = 0 ]; then - set -ex - if [ -n "$DO_COVERAGE" ]; then - travis_fold_start "DO_COVERAGE" - - # Run tests/examples explicitly. - make check-examples || exit 1 - do_codecov samples - - make check-unit || exit 1 - do_codecov unittests - make check-integration || exit 1 - do_codecov functionaltests - make check-themes || exit 1 - do_codecov themes - do_codecov_gcov c_code - - travis_fold_end - else - # TODO: does not run check-examples. Should it? - travis_run_in_fold "make.check-unit" make check-unit - travis_run_in_fold "make.check-integration" make check-integration - travis_run_in_fold "make.check-themes" make check-themes - fi - set +x - fi - # Run check-qa. - - | - if [ "$DO_CHECKQA" = 1 ]; then - travis_run_in_fold "make.check-qa" make check-qa - fi - - | - if [ "$TEST_PREV_COMMITS" = 1 ] && ! [ "$TRAVIS_PULL_REQUEST" = false ]; then - set -ex - # Check each commit separately (to make git-bisect less annoying). - # Fix Travis' commit range (https://github.com/travis-ci/travis-ci/issues/4596). - commit_range="${TRAVIS_COMMIT_RANGE/.../..}" - echo "Testing previous commits ($commit_range)" - rev_list="$(git rev-list --bisect-all $commit_range)" - echo "rev-list: $rev_list" - commits="$(echo "$rev_list" | grep -v 'dist=0' | cut -d\ -f 1)" - n="$(echo "$commits" | wc -l)" - echo "Testing $n commits: $commits" - i=0 - failed= - for commit in $commits; do - i=$((i+1)) - travis_fold_start "test_commit_${commit}_.$i.$n" - echo "Testing commit $commit" - git reset --hard # Some files are updated when compiling... - git checkout "$commit" - git --no-pager show --stat - - if ! make all check CMAKE_ARGS+="-D DO_COVERAGE=0"; then - failed="$failed $commit" - fi - travis_fold_end - done - - git checkout -qf FETCH_HEAD - if [ -n "$failed" ]; then - echo "Checks failed for these commits:" - for c in $failed; do - git log -1 --pretty="%h %s (%an, %ad)" "$c" - done - false - fi - fi - -after_success: - # Push updated API docs for relevant branches, e.g. non-PRs builds on master. - - if [ "$BUILD_APIDOC" = "true" ]; then build-utils/travis-apidoc.sh; fi - # Push code coverage information - - | - trap 'echo ERR CODE $? from $BASH_COMMAND : $LINENO' ERR - trap 'echo EXIT CODE $? from $BASH_COMMAND : $LINENO' EXIT - set -ex - if [ "$DO_COVERAGE" = "coveralls" ]; then - test -f build/luacov.stats.out || { echo 'build/luacov.stats.out does not exist.'; return 1; } - luacov-coveralls --verbose --merge - fi - - echo "The build finished normally" diff --git a/build-utils/travis-apidoc.sh b/build-utils/travis-apidoc.sh deleted file mode 100755 index ecb6188d4..000000000 --- a/build-utils/travis-apidoc.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash -# -# Process (API) docs after a successful build on Travis (via ../.travis.yml). -# -# Updated/changed documentation for "master" is pushed to gh-pages. -# In case of pull requests or other branches, it will get added to a separate branch. -# In case of a pull request, a compare view comment will be posted. -# -# NOTE: stdout/stderr might/should be discarded to not leak sensitive information. - -echo "Post-processing (API) documentation." -echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" -echo "TRAVIS_BRANCH: $TRAVIS_BRANCH" - -if [ -z "$GH_APIDOC_TOKEN" ]; then - echo "No GH_APIDOC_TOKEN available. Skipping." - exit -fi - -# NOTE: DO NOT USE "set -x", or anything else that would reveal GH_APIDOC_TOKEN! -set -e -set +x - -# Display exit code in term of failure (probably due to 'set -x'). -trap '[ "$?" = 0 ] || echo "EXIT CODE: $?"' EXIT - -REPO_APIDOC="https://${GH_APIDOC_TOKEN}@github.com/awesomeWM/apidoc" -REPO_DIR="$PWD" - -export GIT_AUTHOR_NAME="awesome-robot on Travis CI" -export GIT_AUTHOR_EMAIL="awesome-robot@users.noreply.github.com" -export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" -export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL" - -git clone --depth 1 --branch gh-pages "$REPO_APIDOC" build/apidoc \ - 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g" -cd build/apidoc - -# This will re-use already existing branches (updated PR). -if [ "$TRAVIS_PULL_REQUEST" != false ]; then - BRANCH="pr-$TRAVIS_PULL_REQUEST" -elif [ "$TRAVIS_BRANCH" != master ]; then - # Use merge-base of master in branch name, to keep different branches with - # the same name apart. - # shellcheck disable=SC2015 - BRANCH="$TRAVIS_BRANCH-$(cd "$REPO_DIR" \ - && git fetch --unshallow origin master \ - && git rev-parse --short "$(git merge-base HEAD FETCH_HEAD || true)" || true)" -else - BRANCH="gh-pages" -fi -if [ "$BRANCH" != "gh-pages" ]; then - git checkout -b "$BRANCH" "origin/${BRANCH}" || git checkout -b "$BRANCH" -fi - -# Use a temporary branch for the two commits, which allows for a better UI. -git checkout -b merged-update - -# Create the README for the Git repo (https://github.com/awesomeWM/apidoc). -cat > ../doc/README.md <Release:" \ - -I "

API documentation for awesome, a highly configurable X window manager (version .*)\.

" \ - -x .git | patch -p1 - -git add --all . -if git diff --cached --exit-code --quiet; then - echo "Documentation has not changed." - exit -fi - -LAST_COMMIT_MSG="$(cd "$REPO_DIR" && git log -1 --pretty=format:%s)" -LAST_COMMIT="$(cd "$REPO_DIR" && git rev-parse --short HEAD)" - -# Commit the relevant changes. -COMMIT_MSG="Update docs for $AWESOME_VERSION via Travis - -Last commit message: -$LAST_COMMIT_MSG - -Commits: https://github.com/awesomeWM/awesome/compare/${TRAVIS_COMMIT_RANGE/.../..} -Build URL: https://travis-ci.com/awesomeWM/awesome/builds/${TRAVIS_BUILD_ID}" -git commit -m "[relevant] $COMMIT_MSG" - -# Commit the irrelevant changes. -mv .git ../doc -cd ../doc -git add --all . -BOILERPLATE_FAILED=0 -git commit -m "[boilerplate] $COMMIT_MSG" || export BOILERPLATE_FAILED=1 - -# Reorder/swap commits, to have "relevant" after "boilerplate". -# This makes it show up earlier in the Github interface etc. -if [ "$BOILERPLATE_FAILED" == "0" ]; then - git tag _old - git reset --hard HEAD~2 - git cherry-pick _old _old~1 - RELEVANT_REV="$(git rev-parse --short HEAD)" - git tag -d _old -fi - -git checkout "$BRANCH" -OLD_REV="$(git rev-parse --short HEAD)" -if [ "$TRAVIS_PULL_REQUEST" != false ]; then - MERGE_COMMIT_MSG="$COMMIT_MSG -Pull request: https://github.com/awesomeWM/awesome/pull/${TRAVIS_PULL_REQUEST}" -else - PR_OR_ISSUE="$(echo "$COMMIT_MSG" | head -n 1 | grep -o '#[0-9]\+' || true)" - if [ -n "$PR_OR_ISSUE" ]; then - MERGE_COMMIT_MSG="$COMMIT_MSG -Ref: https://github.com/awesomeWM/awesome/pull/${PR_OR_ISSUE}" - else - PR_OR_ISSUE_URL="$(echo "$COMMIT_MSG" \ - | grep -Eo 'https://github.com/awesomeWM/awesome/(issues|pull)/[0-9]+' || true)" - if [ -n "$PR_OR_ISSUE_URL" ]; then - MERGE_COMMIT_MSG="$COMMIT_MSG -Ref: $PR_OR_ISSUE_URL" - else - MERGE_COMMIT_MSG="$COMMIT_MSG -Commit: https://github.com/awesomeWM/awesome/commit/${LAST_COMMIT} -Tree: https://github.com/awesomeWM/awesome/commits/${LAST_COMMIT}" - fi - fi -fi -git merge --no-ff -m "$MERGE_COMMIT_MSG" merged-update -NEW_REV="$(git rev-parse --short HEAD)" - -git push origin "$BRANCH" 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g" - -# Generate compare view links. -# NOTE: use "\n" for line endings, not real ones for valid json! -COMPARE_LINKS="Compare view: https://github.com/awesomeWM/apidoc/compare/${OLD_REV}...${NEW_REV}" -COMPARE_LINKS="$COMPARE_LINKS\nRelevant changes: https://github.com/awesomeWM/apidoc/commit/${RELEVANT_REV}" -if [ "$BRANCH" != "gh-pages" ]; then - COMPARE_LINKS="$COMPARE_LINKS\nComparison against master (gh-pages): https://github.com/awesomeWM/apidoc/compare/gh-pages...${NEW_REV}" -fi -# shellcheck disable=SC2028 -echo "Compare links:\n$COMPARE_LINKS" - -# Post a comment to the PR. -if [ "$TRAVIS_PULL_REQUEST" != false ]; then - curl -H "Authorization: token $GH_APIDOC_TOKEN" \ - -d "{\"body\": \"Documentation has been updated for this PR.\n\n$COMPARE_LINKS\"}" \ - "https://api.github.com/repos/awesomeWM/awesome/issues/${TRAVIS_PULL_REQUEST}/comments" \ - 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g" -fi - -# vim: filetype=sh:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80