Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve CD/CI #3

Merged
merged 8 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ on:
- workflow_dispatch

jobs:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: pre-commit/action@v3.0.0

build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -20,15 +30,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install .[test]
- name: Test formatting
uses: psf/black@stable
- name: PEP8 rules
uses: tonybajan/flake8-check-action@v1.0.0
with:
repotoken: ${{ secrets.GITHUB_TOKEN }}
- name: test with pytest
run: coverage run -m pytest --color=yes tests
run: pytest --color=yes --cov --cov-report=xml tests
- name: coverage
run: coverage report -m
- name: codecov
run: bash <(curl -s https://codecov.io/bash)
#- name: codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/source/_api/

# PyBuilder
target/
Expand Down
19 changes: 15 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
repos:
- repo: 'https://github.com/psf/black'
rev: 21.7b0
rev: 22.3.0
hooks:
- id: black
stages: [commit]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: 'https://github.com/pycqa/flake8'
rev: 6.0.0
hooks:
- id: flake8
stages: [commit]
additional_dependencies: [Flake8-pyproject]
- repo: 'https://github.com/commitizen-tools/commitizen'
rev: v2.18.0
hooks:
- id: commitizen
stages: [commit-msg]
stages: [commit-msg]
- repo: 'https://github.com/pycqa/isort'
rev: 5.10.1
hooks:
- id: isort
stages: [commit]
- repo: 'https://github.com/kynan/nbstripout'
rev: 0.5.0
hooks:
- id: nbstripout
stages: [commit]
17 changes: 7 additions & 10 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
# -- Required ------------------------------------------------------------------
version: 2

# build with latest available ubuntu version
# -- build environment ---------------------------------------------------------
build:
os: ubuntu-20.04
tools:
python: "3.9"
jobs:
pre_build:
- sphinx-apidoc --force --module-first --templatedir=docs/source/_templates/apidoc -o docs/source/_api ./src

# Build documentation in the docs/ directory with Sphinx
# -- conf location -------------------------------------------------------------
sphinx:
configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF
formats:
- epub

# Optionally set the version of Python and requirements required to build your docs
# -- requirements --------------------------------------------------------------
python:
install:
- method: pip
Expand Down
24 changes: 20 additions & 4 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,37 @@ Thanks goes to these wonderful people (`emoji key <https://allcontributors.org/d
<table class="table table-bordered">
<tr>
<td align="center">
<a href="https://www.linkedin.com/in/pierrickrambaud/">
<img src="https://avatars3.githubusercontent.com/u/12596392?v=4" width="70px;" alt="12rambau"/><br />
<sub><b>Pierrick Rambaud</b></sub>
<a href="https://github.com/alice4space">
<img src="https://avatars.githubusercontent.com/u/35078474?v=4" width="70px;" alt="alice4space"/><br />
<sub><b>Alice Barthe</b></sub>
</a>
<br/>
<a href="#code" title="Code">💻</a>
<a href="#ideas" title="Ideas, Planning, & Feedback">🤔</a>
<a href="#question" title="Answering Questions">💬</a>
<br/>
<a href="#issue" title="Bug reports">🐛</a>
<a href="#maintenance" title="Maintenance">🚧</a>
<a href="#review" title="Reviewed Pull Requests">👀</a>
<br/>
<a href="#example" title="Examples">💡</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://github.com/12rambau">
<img src="https://avatars3.githubusercontent.com/u/12596392?v=4" width="70px;" alt="12rambau"/><br />
<sub><b>Pierrick Rambaud</b></sub>
</a>
<br/>
<a href="#code" title="Code">💻</a>
<a href="#issue" title="Bug reports">🐛</a>
<a href="#documentation" title="Documentation">📖</a>
<br/>
<a href="#maintenance" title="Maintenance">🚧</a>
<a href="#review" title="Reviewed Pull Requests">👀</a>
<a href="#test" title="Tests">⚠️</a>
<a href="#example" title="Examples">💡</a>
</br>
<a href="#infra" title="Infrastructure">🚇</a>
</td>
</tr>
Expand Down
18 changes: 6 additions & 12 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ Develop within the project

Since 2020-08-14, this repository follows these `development guidelines <https://nvie.com/posts/a-successful-git-branching-model/>`__.

.. tip::

Please consider using the :code:`--no-ff` option when merging to keep the repository consistent with PR.

In the project to adapt to :code:`JupyterLab` IntelSense, we decided to explicitly write the `return` statement for every function.

We need to provide the users with version informations. When a new function or class is created please use the `Deprecated <https://pypi.org/project/Deprecated/>`__ lib to specify that the feature is new in the documentation.

.. code-block:: python
Expand Down Expand Up @@ -54,16 +48,16 @@ How to commit
In this repository we use the Conventional Commits specification.
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.

You can learn more about Conventional Commits following this `link <https://www.conventionalcommits.org/en/v1.0.0/>`__
You can learn more about Conventional Commits following this `link <https://www.conventionalcommits.org/en/v1.0.0/>`__.

What can I push and where
-------------------------

Our branching system embed some rules to avoid crash of the production environment. If you want to contribute to this framework, here are some basic rules that we try our best to follow :

- the modification you offer is solving a critical bug in prod : **PR in a patch branch**
- the modification you propose solve the following issues : test, documentation, typo, quality, refactoring, translation **PR in main**
- the modification you propose is a new feature : open an issue to discuss with the maintainers and then **PR from a named branch**
- PR should answer issues. describe your problem or feature request in a GitHub issue and discuss with our team before starting coding.
- start a new branch from the :code:`develop` branch
- when ready open a PR on our repository on the same :code:`develop` branch

the maintainers will try their best to use PR for new features, to help the community follow the development, for other modification they will simply push to the appropriate branch

Expand All @@ -84,10 +78,10 @@ In the files change the version number by runnning commitizen `bump`:

cz bump

It should modify for you the version number in :code:`sepal_ui/__init__.py`, :code:`setup.py`, and :code:`.cz.yaml` according to sementic versionning thanks to the conventional commit that we use in the lib.
It should modify for you the version number in :code:`src/__init__.py` and :code:`setup.cfg` according to sementic versionning thanks to the conventional commit that we use in the lib.

It will also update the :code:`CHANGELOG.md` file with the latest commits, sorted by categories.

Then you can now create a new tag with your new version number. use the same convention as the one found in :code:`.cz.yaml`: :code:`v$minor.$major.$patch$prerelease`.
Then you can now create a new tag with your new version number. use the same convention as the one found in :code:`setup.cfg`: :code:`v$minor.$major.$patch$prerelease`.

The CI should take everything in control from here and execute the :code:`Upload Python Package` GitHub Action that is publishing the new version on `PyPi <#>`_.
5 changes: 5 additions & 0 deletions alicelib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__version__ = "0.0.0"
__author__ = "Alice Barthe"
__email__ = "alice.barthe@cern.ch"

from .dummy import hello_world
13 changes: 13 additions & 0 deletions alicelib/dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__all__ = ["hello_world"]


def hello_world():
"""
test function to check that everything run smoothly

Returns
-------
the little example str
"""

return "hello world !"
9 changes: 0 additions & 9 deletions build.py

This file was deleted.

20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

29 changes: 29 additions & 0 deletions docs/source/_templates/apidoc/package.rst_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ pkgname | e | heading }}

{% if subpackages -%}
Subpackages
-----------

.. autosummary::
:recursive:
:toctree:
:template: autosummary/module.rst

{% for package in subpackages -%}
{{ package }}
{% endfor -%}
{% endif -%}

{% if submodules %}
Submodules
----------

.. autosummary::
:recursive:
:toctree:
:template: autosummary/module.rst

{% for submodule in submodules -%}
{{ submodule }}
{% endfor -%}
{% endif -%}
42 changes: 42 additions & 0 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ fullname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

{% block attributes -%}
{% if attributes -%}
.. rubric:: {{ _('Attributes') }}

.. autosummary::

{% for item in attributes -%}
{% if item not in inherited_members -%}
~{{ name }}.{{ item }}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endblock -%}

{% block methods -%}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:

{% for item in methods -%}
{% if item not in inherited_members -%}
~{{ name }}.{{ item }}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endblock -%}

{% block details %}
{% if methods -%}
{% for item in methods if item not in inherited_members -%}
.. autofunction:: {{ module }}.{{ objname }}.{{ item }}
{% endfor -%}
{% endif -%}
{% endblock -%}
Loading