From 345dda9020ac44a306a8a0de9eab916569475f1b Mon Sep 17 00:00:00 2001 From: Sofus Rose Date: Thu, 26 Jan 2017 17:07:35 -0500 Subject: [PATCH] Added some CI utils. --- .gitlab-ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 7 +++---- doc/source/conf.py | 4 ++-- doc/upload.sh | 24 +++++++++++++++++------- mkDocs.sh | 3 +++ setup.cfg | 2 +- setup.py | 12 +++++++++--- 7 files changed, 81 insertions(+), 17 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 mkDocs.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e734dca --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,46 @@ +# This file is a template, and might need editing before it works on your project. +# use the official gcc image, based on debian +# can use verions as well, like gcc:5.2 +# see https://hub.docker.com/_/gcc/ +image: sorose/graphics:v8 + +stages: + - build + - build-docs + - deploy-docs + - test +# - review + +before_script: + - apt update && apt -y install python3-pip gcc libmagickwand-dev + - rm -rf dist build docs/build openlut.egg-info + +build: + stage: build + script: + - python3 setup.py sdist #Build source distribution. + - python3 setup.py bdist_wheel #Build Linux wheel. + artifacts: + paths: + - dist/* + +build-docs: + stage: build-docs + script: + - ./mkDocs.sh + artifacts: + paths: + - docs/build/html + +deploy-docs: + stage: deploy-docs + environment: + name: Documentation + url: https://www.sofusrose.com/openlut + when: manual + +# run tests using the binary built before. +test: + stage: test + script: + - python3 tests/suite.py diff --git a/README.md b/README.md index 1cc965b..3ee4e3e 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,6 @@ First: **Ensure you have dependencies!!!** The pip command will break without th Simply use pip: `pip3 install openlut` (pip3 denotes that you must use a Python 3 version of pip). Keep in mind, there are some external dependencies: * **Python 3.5**: This is Python; you need Python. * **gcc**: This is needed to compile the C++ extensions. -* **pybind11**: This is a library needed to link the C++ extension into Python. pip version is being difficult... * **imagemagick**: For all file IO. It's not like I was gonna write that myself :) . *If it's breaking, try running `pip3 install -U pip setuptools`. Sometimes they are out of date.* @@ -45,13 +44,13 @@ Installing Dependencies ----- Not Difficult, I promise! -On Debian/Ubuntu: `sudo apt-get install python3-pip gcc pybind11-dev libmagickwand-dev` +On Debian/Ubuntu: `sudo apt-get install python3-pip gcc libmagickwand-dev` -On Mac: `brew install python3 gcc pybind11 imagemagick` +On Mac: `brew install python3 gcc imagemagick` * You will need Homebrew ( copy/paste a command from http://brew.sh/ to install ) and XCode Command Line Tools for gcc (it should prompt you to install this). * If this doesn't install pip, run `brew install python3; curl https://bootstrap.pypa.io/get-pip.py | python3` -On Other: You need **python 3.5**, pip, a newer version (must support C++14) of **gcc**, and pybind11 in your `includes`. +On Other: You need **python 3.5**, pip, a newer version (must support C++14) of **gcc**. Basic Library Usage diff --git a/doc/source/conf.py b/doc/source/conf.py index 23cb7d4..887c8a4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -63,9 +63,9 @@ author = u'Sofus Rose' # built documents. # # The short X.Y version. -version = u'0.2.1' +version = u'0.2.3' # The full version, including alpha/beta/rc tags. -release = u'0.2.1' +release = u'0.2.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/upload.sh b/doc/upload.sh index fbfb39e..6080274 100755 --- a/doc/upload.sh +++ b/doc/upload.sh @@ -2,11 +2,21 @@ REMOTE=sofus@wakingnexus -rsync -avzP build/html/* $REMOTE:~/openlut/ +#Remove the old docs. +ssh $REMOTE 'bash -s' << 'ENDSSH' -#ssh $REMOTE 'bash -s' << 'ENDSSH' -# -#cd /var/www/openlut -#chown -R www-data:www-data * -# -#ENDSSH +rm -rf /var/www/openlut/* + +ENDSSH + +#Sync over the new docs. +rsync -avzP build/html/* $REMOTE:/var/www/openlut/ + +#Set strong permissions. +ssh $REMOTE 'bash -s' << 'ENDSSH' + +chown -R sofus:www-data /var/www/openlut/* +find /var/www/openlut -type f -exec chmod 0640 {} \; +find /var/www/openlut -type d -exec chmod 2750 {} \; + +ENDSSH diff --git a/mkDocs.sh b/mkDocs.sh new file mode 100755 index 0000000..678f96c --- /dev/null +++ b/mkDocs.sh @@ -0,0 +1,3 @@ +pandoc --from=markdown --to=rst --output=README.rst README.md + +make -C doc html diff --git a/setup.cfg b/setup.cfg index b88034e..5aef279 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [metadata] -description-file = README.md +description-file = README.rst diff --git a/setup.py b/setup.py index 3a4e59a..1e17cc9 100755 --- a/setup.py +++ b/setup.py @@ -2,14 +2,18 @@ import sys, os import os.path as path +from os.path import join from setuptools import setup from setuptools import Extension from setuptools import find_packages -#pybind11, a dependency, can report its own includes! +#pybind11, a dep of openlut, can report its own includes for gcc compilation! import pybind11 +def read(fname): + return open(join(path.dirname(__file__), fname)).read() + #Make sure we're using gcc. os.environ["CC"] = "g++" os.environ["CXX"] = "g++" @@ -19,15 +23,17 @@ link_args = ['-fopenmp'] olOpt = Extension( 'openlut.lib.olOpt', sources = ['openlut/lib/olOpt.cpp'], - include_dirs=[pybind11.get_include()], #Include pybind11. + include_dirs=[pybind11.get_include()], #Include pybind11 from its pip package. language = 'c++', extra_compile_args = cpp_args, extra_link_args = cpp_args ) setup( name = 'openlut', - version = '0.2.1', + version = '0.2.4', description = 'OpenLUT is a practical color management library.', + long_description = read('README.rst'), + author = 'Sofus Rose', author_email = 'sofus@sofusrose.com', url = 'https://www.github.com/so-rose/openlut',