Skip to content

Commit

Permalink
Replace travis with github actions (#729)
Browse files Browse the repository at this point in the history
* refactor: replace travis with github actions

* enhance: use deployment branch from configuration at memote online

* fix: use the actual deployment branch on memote online

* test: remove travis_ci from tests

* docs: add new entries to next release

* refactor: remove github username from online

Since it is now Github's token dependant

* docs: write down user documentation for GH token

* fix: create deployment branch if it does not exist

* test: print debug information on failing the CLI command

* test: add a mock github token for testing

* chore: drop support for python3.6/7 in favor of pyhon3.9/10

Since python3.6 is deprecated and python3.7 has
dependencies with unresolvable security issues (no longer supported).

* style: flake8

* docs: update HISTORY.rst

Co-authored-by: Moritz E. Beber <[email protected]>

* chore: point `memote new` back to to the upstream cookiecutter

---------

Co-authored-by: Moritz E. Beber <[email protected]>
  • Loading branch information
carrascomj and Midnighter authored Sep 18, 2023
1 parent 3687f37 commit 4c08f46
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 367 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ History
Next Release
------------

* Fix ``memote online``, given breaking changes in Github Authentication.
* Replace travis-CI with github actions.
* (Cookiecutter) Add an action for comparing models in Pull
Requests (`#23 <https://github.com/opencobra/cookiecutter-memote/pull/23>`_).
* Dropped support for python3.6 and python3.7 in favor of python3.8 to python3.11.

0.14.0 (2023-09-13)
-------------------
* Fix problems with the deprecated API of ``importlib_resources``. Update to either use
Expand Down
12 changes: 6 additions & 6 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,18 @@ results and report are stored on the deployment branch (typically the
``gh-pages`` branch).


In order to make your local git repository available online and enable continuous integration via Travis CI, you can run:
In order to make your local git repository available online and enable continuous integration via Github Actions, you can run:

.. code-block:: console
$ memote online
$ memote online --token "your-github-token"
This will use require your GitHub password to create the repository, connect it
with Travis CI, and generate a GitHub token to be used for continuous
integration of the history report.
This requires setting a token on Github (see `GitHub documentation`_) and providing it as
the ``--token`` argument. Alternatively, an environment variable ``GITHUB_TOKEN`` can be set to avoid writing the token in the command line.

Now, after each edit to the model in the repository, the user can generate
an update to the continuous model report shown at the project's gh-pages
branch. That means each commit should be pushed to Travis individually.
branch. That means each commit should be pushed individually.

The continuous report will look like this:

Expand Down Expand Up @@ -227,6 +226,7 @@ history report in your repository, you can run ``memote report history`` from
any branch at any time to generate it.

.. _GitHub: https://github.com
.. _GitHub documentation: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
.. _GitLab: https://gitlab.com

*******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ install_requires =
future
pytest >=4.0
gitpython
PyGithub ~= 1.55
pandas
Jinja2
cookiecutter
cobra >=0.17
ruamel.yaml >=0.15
travis-encrypt<1.2.0
sympy
sqlalchemy
requests
Expand Down
10 changes: 7 additions & 3 deletions src/memote/suite/cli/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ def validate_repository(context, param, value):
raise click.BadParameter("No GitHub repository slug provided or configured.")


def validate_username(context, param, value):
"""Load username from different locations."""
def validate_token(context, param, value):
"""Verify that a token was provided, pointing to documentation."""
if value is not None:
return value
else:
raise click.BadParameter("No GitHub username provided or configured.")
raise click.BadParameter(
"No GitHub token provided. See https://memote.readthedocs.io/en/"
"latest/getting_started.html#ci-tested-online-and-public-workflow"
" for instructions on how to set it up."
)


def probe_git():
Expand Down
Loading

0 comments on commit 4c08f46

Please sign in to comment.