Added support for automatic builds and releases

This commit is contained in:
squidfunk 2017-02-24 18:36:22 +01:00 committed by Martin Donath
parent 3e50c3394a
commit a9e7a5d421
2 changed files with 75 additions and 24 deletions

View File

@ -21,31 +21,16 @@
language: node_js language: node_js
sudo: false sudo: false
# -----------------------------------------------------------------------------
# Regular builds
# -----------------------------------------------------------------------------
# Node.js versions # Node.js versions
node_js: node_js:
- 5 - 5
- 6 - 6
- 7 - 7
# Build visual tests separately - temporary disabled until tests are stable
# matrix:
# include:
# - node_js: 5
# addons:
# artifacts:
# paths:
# - gemini-report
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - gcc-4.8
# - g++-4.8
# env:
# - CXX=g++-4.8
# install: yarn install
# script: yarn run test:visual:run
# Limit clone depth to 5, to speed up build # Limit clone depth to 5, to speed up build
git: git:
depth: 5 depth: 5
@ -68,3 +53,56 @@ before_script: pip install --user -r requirements.txt
# Perform build and tests # Perform build and tests
script: yarn run build script: yarn run build
# -----------------------------------------------------------------------------
# Additional builds
# -----------------------------------------------------------------------------
# Build matrix for additional builds
matrix:
include:
# Build release and docker image and send to PyPI and Docker Hub.
- python: 2
services:
- docker
# If we're not on a release branch, exit early and indicate success
before_install: [[ $TRAVIS_BRANCH" =~ ^[0-9.]+$ ]] && exit 0
# Perform build
script:
- python setup.py build sdist bdist_wheel --universal
- docker build -t $TRAVIS_REPO_SLUG .
# If build was successful, publish
after_success:
# Install twine and push release to PyPI
- pip install twine
#- twine upload -u $PYPI_USER -p $PYPI_PASS dist/*
# Push to Docker Hub
- docker login -e $DOCKER_EMAIL -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker tag $TRAVIS_REPO_SLUG $TRAVIS_REPO_SLUG:$TRAVIS_BRANCH
- docker tag $TRAVIS_REPO_SLUG $TRAVIS_REPO_SLUG:latest
- docker push $TRAVIS_REPO_SLUG
# Build visual tests separately - temporary disabled until tests are stable
# matrix:
# include:
# - node_js: 5
# addons:
# artifacts:
# paths:
# - gemini-report
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - gcc-4.8
# - g++-4.8
# env:
# - CXX=g++-4.8
# install: yarn install
# script: yarn run test:visual:run

View File

@ -21,17 +21,30 @@
FROM jfloff/alpine-python:2.7-slim FROM jfloff/alpine-python:2.7-slim
MAINTAINER Martin Donath <martin.donath@squidfunk.com> MAINTAINER Martin Donath <martin.donath@squidfunk.com>
# Set working directory # Set build directory
WORKDIR /docs WORKDIR /tmp
# Install packages # Install dependencies
COPY requirements.txt . COPY requirements.txt .
RUN \ RUN \
pip install -r requirements.txt && \ pip install -r requirements.txt && \
pip install mkdocs-material && \
rm requirements.txt rm requirements.txt
# Expose MkDocs default port # Copy files necessary for build
COPY material material
COPY MANIFEST.in MANIFEST.in
COPY package.json package.json
COPY setup.py setup.py
# Perform build and cleanup artifacts
RUN \
python setup.py install && \
rm -rf /tmp/*
# Set working directory
WORKDIR /docs
# Expose MkDocs development server port
EXPOSE 8000 EXPOSE 8000
# Start development server by default # Start development server by default