Reorganize Travis tests

This commit is contained in:
JAremko 2017-07-25 21:01:32 +03:00
parent 3c03c4893b
commit f11f927485
2 changed files with 136 additions and 148 deletions

View File

@ -36,26 +36,20 @@ ln -sf ~/.emacs.d "${TRAVIS_BUILD_DIR}"
cd ~/.emacs.d
echo "Pwd $(pwd)"
echo_headline () {
printf '=%.0s' {1..70}
printf "\n$1\n"
printf '=%.0s' {1..70}
echo
}
# Formatting conventions tests
if [ ! -z "$FORMATTING" ]; then
echo "TRAVIS_COMMIT_RANGE: ${TRAVIS_COMMIT_RANGE}"
first_commit=`echo ${TRAVIS_COMMIT_RANGE} | sed -r 's/\..*//'`
git diff --name-only "${first_commit}" HEAD > /tmp/changed_files
case "${FORMATTING}" in
space-test)
echo "Testing for trailing and all sorts of broken white spaces"
git reset -q "${first_commit}"
git add -N .
git diff --check --color > space_test_result
if [[ -s space_test_result ]]; then
cat space_test_result
exit 1
fi
echo "No bad spaces detected"
exit 0
;;
spacefmt)
echo "Testing changed ORG files with spacefmt"
echo_headline "Testing changed ORG files with spacefmt"
cp ~/.emacs.d/core/templates/.spacemacs.template ~/
mv ~/.spacemacs.template ~/.spacemacs
while read p
@ -73,20 +67,25 @@ if [ ! -z "$FORMATTING" ]; then
done </tmp/changed_files
git diff --color HEAD > spacefmt_result
if [[ -s spacefmt_result ]]; then
printf '=%.0s' {1..70}
printf "\nPLEASE APPLY CHANGES BELOW:\n"
printf '=%.0s' {1..70}
echo
echo_headline "PLEASE APPLY CHANGES BELOW:"
cat spacefmt_result
exit 1
fi
echo "All changed files comply with spacefmt"
echo_headline "Testing for trailing and all sorts of broken white spaces"
git reset -q "${first_commit}"
git add -N .
git diff --check --color > space_test_result
if [[ -s space_test_result ]]; then
cat space_test_result
exit 1
fi
echo "No bad spaces detected"
exit 0
;;
esac
fi
# If we are pushing changes to the master branch,
# If we are pushing changes to the master or develop branch,
# open PR to syl20bnr/${PUBLISH} with Spacemacs
# documentation exported as HTML and formatted with spacefmt
if [ $TRAVIS_SECURE_ENV_VARS = true ] && [ ! -z "$PUBLISH" ] && [ $TRAVIS_PULL_REQUEST = false ]; then
@ -95,10 +94,8 @@ if [ $TRAVIS_SECURE_ENV_VARS = true ] && [ ! -z "$PUBLISH" ] && [ $TRAVIS_PULL_
echo "branch is \"${TRAVIS_BRANCH}\", won't publish to \"${PUBLISH}\" repository!"
exit 0
fi
printf '=%.0s' {1..70}
printf "\n FORMATTING DOCUMENTATION:\n"
printf '=%.0s' {1..70}
echo
echo_headline "FORMATTING DOCUMENTATION:"
cp ~/.emacs.d/tests/doc/dotspacemacs.el ~/dotspacemacs.el
mv ~/dotspacemacs.el ~/.spacemacs
./core/tools/spacefmt/spacefmt doc
@ -106,10 +103,8 @@ if [ $TRAVIS_SECURE_ENV_VARS = true ] && [ ! -z "$PUBLISH" ] && [ $TRAVIS_PULL_
echo "spacefmt exited with: $?"
exit 2
fi
printf '=%.0s' {1..70}
printf "\n EXPORTING DOCUMENTATION:\n"
printf '=%.0s' {1..70}
echo
echo_headline "EXPORTING DOCUMENTATION:"
emacs -batch -l init.el > /dev/null 2>&1
emacs -batch -l init.el -l core/core-documentation.el -f spacemacs/publish-doc
if [ $? -ne 0 ]; then
@ -124,12 +119,10 @@ if [ $TRAVIS_SECURE_ENV_VARS = true ] && [ ! -z "$PUBLISH" ] && [ $TRAVIS_PULL_
git clone "https://github.com/syl20bnr/${PUBLISH}.git" -b gh-pages "/tmp/${PUBLISH}"
rsync -avh ~/.emacs.d/export/ "/tmp/${PUBLISH}"
git add -N .
cd "/tmp/${PUBLISH}"
if ! git diff-files --quiet --; then
printf '=%.0s' {1..70}
printf "\n COMMITTING CHANGES TO ${BOT_NAME}/${PUBLISH}:\n"
printf '=%.0s' {1..70}
echo
echo_headline "COMMITTING CHANGES TO ${BOT_NAME}/${PUBLISH}:"
git diff --color HEAD
curl -L https://github.com/github/hub/releases/download/v2.2.9/hub-linux-amd64-2.2.9.tgz | tar \
--strip-components=2 -xz --wildcards -C /tmp/ "*hub"
@ -142,23 +135,15 @@ if [ $TRAVIS_SECURE_ENV_VARS = true ] && [ ! -z "$PUBLISH" ] && [ $TRAVIS_PULL_
git remote set-url "${BOT_NAME}" \
"https://${BOT_NAME}:${BOT_TK}@github.com/${BOT_NAME}/${PUBLISH}.git"
/tmp/hub push -f "${BOT_NAME}" gh-pages
printf '=%.0s' {1..70}
printf "\n OPENING PR TO syl20bnr/${PUBLISH}.git\n"
printf '=%.0s' {1..70}
echo
echo_headline "OPENING PR TO syl20bnr/${PUBLISH}.git"
echo "Documentation updates (autoexport)" > msg
echo "beep beep boop... Beep?" >> msg
/tmp/hub pull-request -F msg
printf '=%.0s' {1..70}
printf "\n DONE!\n"
printf '=%.0s' {1..70}
echo
echo "DONE!"
exit 0
else
printf '=%.0s' {1..70}
printf "\n NOTHING TO COMMIT!\n"
printf '=%.0s' {1..70}
echo
echo "NOTHING TO COMMIT!"
exit 0
fi
fi
@ -168,9 +153,8 @@ for test in "${TESTS[@]}"; do
rm -rf ~/.emacs.d/elpa
rm -rf ~/.emacs.d/.cache
rm -f ~/.spacemacs
testdir=~/.emacs.d/tests/$test
echo "Running '$test' in '$testdir' folder"
echo_headline "Running '$test' in '$testdir' folder"
if [ -f $testdir/dotspacemacs.el ]; then
cp $testdir/dotspacemacs.el ~/.spacemacs
fi

View File

@ -5,13 +5,12 @@ branches:
- master
- develop
before_install:
- if [ ! -z "$EVM_EMACS" ]; then curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw
> x.sh && source ./x.sh; fi
- if [ ! -z "$EVM_EMACS" ]; then evm install $EVM_EMACS --use --skip; fi
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw
> /tmp/x.sh && source /tmp/x.sh
- evm install $EVM_EMACS --use --skip
env:
matrix:
- FORMATTING=space-test
- FORMATTING=spacefmt EVM_EMACS=emacs-25.1-travis
- FORMATTING=doc EVM_EMACS=emacs-25.1-travis
- TESTS=core EVM_EMACS=emacs-24.4-travis
- TESTS=core EVM_EMACS=emacs-24.5-travis
- TESTS=core EVM_EMACS=emacs-25.1-travis
@ -21,10 +20,12 @@ env:
- TESTS=doc EVM_EMACS=emacs-25.1-travis
- TESTS=doc EVM_EMACS=emacs-git-snapshot-travis
- TESTS=doc-edn EVM_EMACS=emacs-25.1-travis
- PUBLISH=spacemacs.org EVM_EMACS=emacs-25.1-travis BOT_NAME=emacspace BOT_EMAIL=emacspace@gmail.com
- PUBLISH=develop.spacemacs.org EVM_EMACS=emacs-25.1-travis BOT_NAME=emacspace BOT_EMAIL=emacspace@gmail.com
- PUBLISH=spacemacs.org EVM_EMACS=emacs-25.1-travis
- PUBLISH=develop.spacemacs.org EVM_EMACS=emacs-25.1-travis
global:
- secure: "M8NF1Uw7VGkLdNmWiUF4T+VOJXwN8KCKVQb45/BWVpGm88Rcfom/9bxRTUme8VYuzIavph32QF+P9KyhX8aj2p2FMItNnxiEySzap5UrLrNiwB6ZxbQglMJj0yMQKASynNBai9KKI7mYlsM5jRpFJ9OSgj7Ko00RIFpO3EpJ+kE="
- BOT_NAME=emacspace
- BOT_EMAIL=emacspace@gmail.com
matrix:
fast_finish: true
allow_failures:
@ -32,4 +33,7 @@ matrix:
- env: TESTS=doc EVM_EMACS=emacs-24.4-travis
- env: TESTS=doc EVM_EMACS=emacs-24.5-travis
- env: TESTS=doc EVM_EMACS=emacs-git-snapshot-travis
- env: TESTS=doc-edn EVM_EMACS=emacs-25.1-travis
- env: PUBLISH=spacemacs.org EVM_EMACS=emacs-25.1-travis
- env: PUBLISH=develop.spacemacs.org EVM_EMACS=emacs-25.1-travis
script: "./.travis-build.sh"