Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
init the template structure #1
Browse files Browse the repository at this point in the history
  • Loading branch information
nolte authored and nolte committed Jan 3, 2019
1 parent 0e05684 commit bb48514
Show file tree
Hide file tree
Showing 15 changed files with 341 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 2
aliases:
- &container_python
docker:
- image: circleci/python:3.6.4 # primary container for the build job

- &run_task_install_tox_dependencies
run:
name: install tox dependencies
command: |
sudo apt-get -qq update
sudo apt install -y build-essential libssl-dev libpython-dev python python-pip
sudo pip install tox
jobs:
builddocs:
<<: *container_python
steps:
- checkout
- *run_task_install_tox_dependencies
- run:
name: build the sphinx documentation
command: |
tox -e docs
testing:
<<: *container_python
steps:
- checkout
- *run_task_install_tox_dependencies
- run:
name: execute the pytests documentation
command: |
tox -e test
- store_test_results:
path: .tox/test/tmp/reports

workflows:
version: 2
build_and_test:
jobs:
- builddocs
- testing
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*~
.tox
#Vagrant Files
.vagrant/*
__pycache__
*.retry
1 change: 0 additions & 1 deletion README.md

This file was deleted.

26 changes: 26 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Cookiecutter Template for circleci BuildJobs
=====================================================================

`Cookiecutter Template <https://cookiecutter.readthedocs.io>`_ for a `CircleCI <https://circleci.com/>`_, `Continuous integration <https://en.wikipedia.org/wiki/Continuous_integration>`_/`Continuous delivery <https://en.wikipedia.org/wiki/Continuous_delivery>`_ Pipeline, for different types of projects.

Features
---------------------------------------------------------------------

* Handle `Semantic Versioning <https://semver.org/>`_ of the project. (*planed*)
* Create a `Github Releases <https://help.github.com/articles/creating-releases/>`_. (*planed*)
* Push generated `sphinx <http://www.sphinx-doc.org/en/master/>`_ page to `GithubPage <https://pages.github.com/>`_. (*planed*)
* Create GitHub Based Cangelog with `ferrarimarco/docker-github-changelog-generator <https://github.com/ferrarimarco/docker-github-changelog-generator>`_. (*planed*)


Usage
--------------------------------------------------------------------

Install `cookiecutter <https://pypi.org/project/cookiecutter/>`_ to your local machine.

.. danger::

Be carefull when the config are generated to a existing project. Existing files will be overwrite.



Creating the `.circleci/config.yml <https://circleci.com/docs/2.0/configuration-reference/#section=configuration>`_ Job Configuration.
5 changes: 5 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"generate_tox_docs": true,
"generate_tox_file": false,
"project_slug": ""
}
15 changes: 15 additions & 0 deletions docs/_static/overrides.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@import url('https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.1.1/gh-fork-ribbon.min.css');
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i');
@import url('https://fonts.googleapis.com/css?family=Inconsolata:400,700');

.wy-nav-content {
background: white;
max-width: 100%;
height: 100vh;
margin: 0;
}

.red {
color:red;
font-weight: bold;
}
14 changes: 14 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "!layout.html" %}
{% set sticky_navigation = True %}
{% set extra_css_files = ['_static/overrides.css'] %}
{% block extrahead %}
{{ super() }}
{% endblock %}
{% block footer %}
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a href="https://github.com/nolte/cookiecutter-circleci">Fork me at GitHub</a>
</div>
</div>
{{ super() }}
{% endblock %}
61 changes: 61 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import sys
import os
import shlex


extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinxcontrib.plantuml',
]

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'Cookiecutter CircleCI Pipeline'
version = '0.0.0'


# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

todo_include_todos = True

html_theme = 'sphinx_rtd_theme'
htmlhelp_basename = 'circleci-pipeline-doc'
# HTML options
html_theme = 'sphinx_rtd_theme'
html_short_title = "cookiecutter-circleci-pipeline"
html_use_index = True
html_show_sourcelink = False
html_static_path = ['_static']
9 changes: 9 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. include:: ../README.rst

Index
----------------------------------------------------

.. toctree::
:maxdepth: 3

self
18 changes: 18 additions & 0 deletions tests/test_minimal_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

def test_bake_project(cookies):
result = cookies.bake(extra_context={'project_slug': 'simple'})

assert result.exit_code == 0
assert result.exception is None
assert result.project.basename == 'simple'
assert result.project.isdir()


def test_bake_project_with_tox_ini(cookies):
result = cookies.bake(extra_context={'project_slug': 'simplewithtox','generate_tox_file': 'True' })

assert result.exit_code == 0
assert result.exception is None
assert result.project.basename == 'simplewithtox'
assert result.project.join('tox.ini').isfile()
assert result.project.isdir()
30 changes: 30 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = docs,test
skipsdist=True

[testenv:test]
passenv = LC_ALL, LANG, HOME
commands = pytest --junit-xml {envtmpdir}/reports/simplegeneration/report.xml {posargs:tests}
deps =
pytest-cookies
cookiecutter

[testenv:release]
deps=
bumpversion
commands=
bumpversion --dry-run minor

# generate the sphinx doc
[testenv:docs]
basepython=python
changedir=docs
deps=
sphinx
sphinxcontrib-plantuml
sphinxcontrib-ansibleautodoc
sphinx_rtd_theme
PyYAML
commands=
sphinx-build -b linkcheck -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
34 changes: 34 additions & 0 deletions {{ cookiecutter.project_slug }}/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2
aliases:
- &container_python
docker:
- image: circleci/python:3.6.4 # primary container for the build job

- &run_task_install_tox_dependencies
run:
name: install tox dependencies
command: |
sudo apt-get -qq update
sudo apt install -y build-essential libssl-dev libpython-dev python python-pip
sudo pip install tox
# All required steps for generatin a sphinx-doc
# http://www.sphinx-doc.org/en/master/
- &steps_build_sphinx_doc
steps:
- checkout
- *run_task_install_tox_dependencies
- run:
name: build the sphinx documentation
command: |
tox -e docs
jobs:
builddocs:
<<: *container_python
<<: *steps_build_sphinx_doc

workflows:
version: 2
classicci:
jobs:
- builddocs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# content of: tox.ini , put in same dir as setup.py
[tox]
envlist = docs
skipsdist=True

[testenv:release]
deps=
bumpversion
commands=
bumpversion --dry-run minor

# generate the sphinx doc
[testenv:docs]
basepython=python
changedir=docs
deps=
sphinx
sphinxcontrib-plantuml
sphinxcontrib-ansibleautodoc
sphinx_rtd_theme
PyYAML
commands=
sphinx-build -b -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

0 comments on commit bb48514

Please sign in to comment.