Skip to content

Commit

Permalink
* fix: post-release hotfix!
Browse files Browse the repository at this point in the history
* chore: pin travis-encrypt so that the requirements for click don't clash with goodtables and jsonschema

* refactor: wait for Travis to activate CI testing

* refactor: make dedicated API call to check if the repo has been activated

* chore: update changelog

* chore: address review comments

* chore: smite flake8
  • Loading branch information
ChristianLieven committed Apr 1, 2019
1 parent d51f6ef commit 411ead2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ History

Next Release
------------
* Repair `memote online` which would not get the most up-to-date status when
checking whether a repo had already been activate for testing on Travis CI.
* Pin `travis-encode` due to conflicts in dependency on `click` with
`goodtables` and `jsonschema`.

0.9.7 (2019-03-29)
------------------
Expand Down
46 changes: 36 additions & 10 deletions memote/suite/cli/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _setup_travis_ci(gh_repo_name, auth_token, repo_access_token):
"Something is wrong with the generated APIv3 authentication token "
"or you did not link your GitHub account on "
"'https://travis-ci.org/'? Please refer to the following error "
"code for further information:".format(str(error)))
"message for further information: {}".format(str(error)))
sys.exit(1)
else:
LOGGER.info("Success!")
Expand Down Expand Up @@ -650,7 +650,7 @@ def _setup_travis_ci(gh_repo_name, auth_token, repo_access_token):
else:
LOGGER.critical(
"An error occurred. Please refer to the following error "
"code for further information:".format(str(error)))
"message for further information: {}".format(str(error)))
sys.exit(1)
else:
LOGGER.info("Success!")
Expand All @@ -671,17 +671,43 @@ def _setup_travis_ci(gh_repo_name, auth_token, repo_access_token):
response.raise_for_status()
except HTTPError as error:
LOGGER.critical("Unable to enable automatic testing on Travis CI! "
"Please refer to the following error code for further "
"information:".format(str(error)))
"Please refer to the following error message for "
"further information: {}".format(str(error)))
sys.exit(1)

# Check if activation was successful
if t_repo["active"]:
LOGGER.info(
"Your repository is now on GitHub and automatic testing has "
"been enabled on Travis CI. Congrats!")
else:
LOGGER.critical("Unable to enable automatic testing on Travis CI!")
activated = False
for _ in range(60):
try:
LOGGER.info("Check if activation {} on Travis CI "
"was successful".format(gh_repo_name))
response = requests.get(
"https://api.travis-ci.org/repo/{}".format(url_safe_repo_name),
headers=headers
)
except HTTPError as error:
LOGGER.critical(
"An error occurred. Please refer to the following error "
"message for further information: {}".format(str(error)))
sys.exit(1)
else:
t_repo = response.json()
if t_repo["active"]:
activated = True
LOGGER.info(
"Your repository is now on GitHub and automatic testing has "
"been enabled on Travis CI. Congrats!")
break
else:
LOGGER.info("Still activating...")
sleep(0.5)
if not activated:
LOGGER.critical("Unable to enable automatic testing on Travis CI! "
"Delete all tokens belonging to this repo at "
"https://github.com/settings/tokens then try running "
"`memote online` again. If this fails yet again, "
"please open an issue at "
"https://github.com/opencobra/memote/issues.")
sys.exit(1)
LOGGER.info(
"Encrypting GitHub token for repo '{}'.".format(gh_repo_name))
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ install_requires =
python-libsbml
lxml
ruamel.yaml >=0.15
travis-encrypt
travis-encrypt<1.2.0
sympy
sqlalchemy
requests
Expand Down

0 comments on commit 411ead2

Please sign in to comment.