[Docs] Add Travis check for documentation and stop build for docs only

Let Travis build the documentation and prevent full build when only documentation changed.
This commit is contained in:
TD-er
2018-10-08 15:34:02 +02:00
parent dececf24ee
commit 12c3e5f81f
3 changed files with 43 additions and 3 deletions
+2 -1
View File
@@ -22,7 +22,7 @@ addons:
install:
- pip install -U platformio
- pip install -U platformio sphinx recommonmark sphinx_bootstrap_theme
script:
# - cppcheck --enable=warning src/*.ino -q --force -I src --include=src/ESPEasy.ino --error-exitcode=1
@@ -37,6 +37,7 @@ script:
before_deploy:
- bash ./preflight.sh # make sure input files are OK before wasting time with prereqs
- ./before_deploy
- export RELEASE_FILE=$(ls ESPEasy*.zip)
+5 -2
View File
@@ -35,10 +35,13 @@ done
#create a source structure that is the same as the original ESPEasy project (and works with the howto on the wiki)
rm -rf dist/Source 2>/dev/null
mkdir dist/Source
rm -rf dist/* 2>/dev/null
mkdir -p dist/Source
mkdir -p dist/Docs
cp -r lib dist/Source/
cp -r src dist/Source/
cp -r docs/build/ dist/Docs/
cp platformio.ini dist/Source/
cd dist
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# Check for documentation only changes.
# Source: https://github.com/dev-id/Magic-Spoiler/blob/8111a06ab6682e020169991d5e2aa4fa503d787f/preflight.sh
set -e
MAIN_BRANCH="mega"
MD=".md$"
DOCS="^docs/"
CHANGED_FILES=`git diff --name-only ${MAIN_BRANCH}...${TRAVIS_COMMIT}`
ONLY_READMES=True
DOCUMENTATION_CHANGED=False
for CHANGED_FILE in $CHANGED_FILES; do
if ! [[ $CHANGED_FILE =~ $MD || $CHANGED_FILE =~ $DOCS ]]; then
ONLY_READMES=False
break
else
DOCUMENTATION_CHANGED=True
fi
done
if [[ $ONLY_READMES == True ]]; then
echo "Only documentation files found, exiting."
travis_terminate 0
exit 1
else
echo "Non-documentation files found, continuing with build."
fi
if [[ $DOCUMENTATION_CHANGED == True ]]; then
echo "Generate documentation."
cd docs
./make html
fi