Skip to content

Commit

Permalink
Add docs, switch to github actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
matham committed Nov 27, 2019
1 parent 432ad79 commit 6416798
Show file tree
Hide file tree
Showing 16 changed files with 380 additions and 37 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Garden flower
on: [push, pull_request]

jobs:
lint_test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip virtualenv wheel setuptools
- name: Lint with pycodestyle
run: |
python3 -m pip install flake8
python3 -m flake8 . --count --ignore=E125,E126,E127,E128,E402,E741,E731,W503,F401,W504,F841 --show-source --statistics --max-line-length=80 --exclude=__pycache__,.tox,.git/,doc/
linux_test:
runs-on: ubuntu-18.04
env:
DISPLAY: :99.0
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Make sdist
run: python3 setup.py sdist --formats=gztar
- name: Install dependencies
run: |
sudo apt update
sudo apt -y install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
sudo apt-get -y install python3-setuptools build-essential libgl1-mesa-dev libgles2-mesa-dev
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1280x720x24 -ac +extension GLX
python3 -m pip install --upgrade pip virtualenv wheel setuptools
python3 -m pip install kivy[base] --pre --extra-index-url https://kivy.org/downloads/simple/
- name: Install flower
run: python3 -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Make wheel
run: python3 setup.py bdist_wheel --universal
- name: Upload wheels as artifact
uses: actions/upload-artifact@master
with:
name: wheels
path: dist
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
draft: true
- name: Test with pytest
run: |
flower_name=$(python3 -c "print('$GITHUB_REPOSITORY'.split('/')[-1])")
python3 -m pytest --cov=kivy_garden.$flower_name --cov-report term --cov-branch
windows_test:
runs-on: windows-latest
env:
KIVY_GL_BACKEND: angle_sdl2
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip virtualenv wheel setuptools
python -m pip install kivy[win_full] --pre --extra-index-url https://kivy.org/downloads/simple/
- name: Install flower
run: python -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Test with pytest
run: |
$flower_name=(python -c "print('$GITHUB_REPOSITORY'.split('/')[-1])")
python -m pytest --cov=kivy_garden.$flower_name --cov-report term --cov-branch
docs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Install dependencies
env:
KIVY_DOC_INCLUDE: 1
KIVY_DOC: 1
run: |
python3 -m pip install --upgrade pip virtualenv wheel setuptools sphinx
python3 -m pip install kivy[base] --pre --extra-index-url https://kivy.org/downloads/simple/
python3 -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Generate docs
run: |
cd doc
make html
- name: Upload docs as artifact
uses: actions/upload-artifact@master
with:
name: docs
path: doc/build/html
- name: gh-pages upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flower_name=$(python3 -c "print('$GITHUB_REPOSITORY'.split('/')[-1])")
cp -r doc/build/html ~/docs_temp
git config --global user.email "[email protected]"
git config --global user.name "Kivy Developers"
git remote rm origin || true
git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY.git"
git checkout --orphan gh-pages
cp -r .git ~/docs_git
cd ..
rm -rf $flower_name
mkdir $flower_name
cd $flower_name
cp -r ~/docs_git .git
cp -r ~/docs_temp/* .
touch .nojekyll
git add .
git commit -a -m "Docs for git-$GITHUB_SHA"
git push origin gh-pages -f
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Coverage Status](https://coveralls.io/repos/github/kivy-garden/graph/badge.svg?branch=master)](https://coveralls.io/github/kivy-garden/graph?branch=master)
[![Build Status](https://travis-ci.com/kivy-garden/graph.svg?branch=master)](https://travis-ci.com/kivy-garden/graph)
[![Github Build Status](https://github.com/kivy-garden/graph/workflows/Garden%20flower/badge.svg)](https://github.com/kivy-garden/graph/actions)

Graph
======
Expand Down Expand Up @@ -51,6 +51,13 @@ Install
pip install kivy_garden.graph
```

CI
--

Every push or pull request run the [GitHub Action](https://github.com/kivy-garden/flower/actions) CI.
It tests the code on various OS and also generates wheels that can be released on PyPI upon a
tag. Docs are also generated and uploaded to the repo as well as artifacts of the CI.

TODO
-------

Expand Down
20 changes: 20 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions doc/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
9 changes: 9 additions & 0 deletions doc/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

####################
The Graph API
####################

.. toctree::
:maxdepth: 1

flower.rst
60 changes: 60 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sphinx_rtd_theme


# -- Project information -----------------------------------------------------

project = 'Graph'
copyright = '2019, Kivy'
author = 'Kivy'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.intersphinx',
"sphinx_rtd_theme",
]

intersphinx_mapping = {
'kivy': ('https://kivy.org/docs/', None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
11 changes: 11 additions & 0 deletions doc/source/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _examples:

********
Examples
********


Basic Example
-------------

Add your examples here
13 changes: 13 additions & 0 deletions doc/source/flower.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _flower-api:

******
Graph
******

:mod:`kivy_garden.graph`
=============================

.. automodule:: kivy_garden.graph
:members:
:undoc-members:
:show-inheritance:
11 changes: 11 additions & 0 deletions doc/source/getting_started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _started:

####################
Getting Started
####################

.. toctree::
:maxdepth: 2

installation.rst
examples.rst
23 changes: 23 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. Flower documentation master file, created by
sphinx-quickstart on Wed Jun 19 14:32:58 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Graphs's documentation!
==================================

.. toctree::
:maxdepth: 2
:caption: Contents:

getting_started.rst
api.rst



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Loading

0 comments on commit 6416798

Please sign in to comment.