From a54f57affce4057a5461b9a25abb1c16c061a1df Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 16 Apr 2017 20:02:16 +0200 Subject: [PATCH] Fixed Docker build and added tests --- Dockerfile | 10 +++++----- scripts/travis | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 558383666..a0612766a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,11 +25,11 @@ MAINTAINER Martin Donath WORKDIR /tmp # Copy files necessary for build -COPY material . -COPY MANIFEST.in . -COPY package.json . -COPY requirements.txt . -COPY setup.py . +COPY material material +COPY MANIFEST.in MANIFEST.in +COPY package.json package.json +COPY requirements.txt requirements.txt +COPY setup.py setup.py # Perform build and cleanup artifacts RUN \ diff --git a/scripts/travis b/scripts/travis index 036994c18..348748d6c 100755 --- a/scripts/travis +++ b/scripts/travis @@ -20,9 +20,11 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. +# Exit, if one command fails +set -e + # Run build and terminate on error -yarn run build -[ $? -gt 0 ] && exit 1 +"$(yarn bin)"/gulp build --clean --optimize --revision # Deploy documentation to GitHub pages if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then @@ -41,10 +43,23 @@ echo "$TRAVIS_BRANCH" | grep -qvE "^[0-9.]+$" && exit 0; :; # Install dependencies for release build pip install wheel twine -# Build release and docker image +# Build and install theme and Docker image python setup.py build sdist bdist_wheel --universal +python setup.py install 2>/dev/null docker build -t $TRAVIS_REPO_SLUG . +# Prepare build regression test +pushd /tmp +mkdocs new test && cd test +echo "theme: material" >> mkdocs.yml + +# Test Docker image build +docker run --rm -it -v `pwd`:/docs $TRAVIS_REPO_SLUG build + +# Clean build test +rm -rf /tmp/test +popd + # Push release to PyPI twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD dist/*