|
25 | 25 | import requests
|
26 | 26 |
|
27 | 27 | from adabot import github_requests as github
|
28 |
| -from adabot import travis_requests as travis |
29 | 28 | from adabot import pypi_requests as pypi
|
30 | 29 | from adabot.lib import common_funcs
|
31 | 30 | from adabot.lib import assign_hacktober_label as hacktober
|
|
35 | 34 |
|
36 | 35 |
|
37 | 36 | # Define constants for error strings to make checking against them more robust:
|
38 |
| -ERROR_ENABLE_TRAVIS = "Unable to enable Travis build" |
39 | 37 | ERROR_README_DOWNLOAD_FAILED = "Failed to download README"
|
40 | 38 | ERROR_README_IMAGE_MISSING_ALT = "README image missing alt text"
|
41 | 39 | ERROR_README_DUPLICATE_ALT_TEXT = "README has duplicate alt text"
|
|
69 | 67 | ERROR_MISSING_CODE_OF_CONDUCT = "Missing CODE_OF_CONDUCT.md"
|
70 | 68 | ERROR_MISSING_README_RST = "Missing README.rst"
|
71 | 69 | ERROR_MISSING_READTHEDOCS = "Missing readthedocs.yml"
|
72 |
| -ERROR_MISSING_TRAVIS_CONFIG = "Missing .travis.yml" |
73 |
| -ERROR_MISSING_PYPIPROVIDER = "For pypi compatibility, missing pypi provider in .travis.yml" |
74 | 70 | ERROR_MISSING_SETUP_PY = "For pypi compatibility, missing setup.py"
|
75 | 71 | ERROR_MISSING_REQUIREMENTS_TXT = "For pypi compatibility, missing requirements.txt"
|
76 | 72 | ERROR_MISSING_BLINKA = "For pypi compatibility, missing Adafruit-Blinka in requirements.txt"
|
77 | 73 | ERROR_NOT_IN_BUNDLE = "Not in bundle."
|
78 |
| -ERROR_TRAVIS_DOESNT_KNOW_REPO = "Travis doesn't know of repo" |
79 |
| -ERROR_TRAVIS_ENV = "Unable to read Travis env variables" |
80 |
| -ERROR_TRAVIS_GITHUB_TOKEN = "Unable to find or create (no auth) GITHUB_TOKEN env variable" |
81 |
| -ERROR_TRAVIS_TOKEN_CREATE = "Token creation failed" |
82 | 74 | ERROR_UNABLE_PULL_REPO_CONTENTS = "Unable to pull repo contents"
|
83 | 75 | ERROR_UNABLE_PULL_REPO_DETAILS = "Unable to pull repo details"
|
84 | 76 | ERRRO_UNABLE_PULL_REPO_EXAMPLES = "Unable to retrieve examples folder contents"
|
@@ -172,9 +164,7 @@ def __init__(self, validators, bundle_submodules, latest_pylint, **kw_args):
|
172 | 164 | self.validators = validators
|
173 | 165 | self.bundle_submodules = bundle_submodules
|
174 | 166 | self.latest_pylint = pkg_version_parse(latest_pylint)
|
175 |
| - self.full_auth = None |
176 | 167 | self.output_file_data = []
|
177 |
| - self.github_token = kw_args.get("github_token", False) |
178 | 168 | self.validate_contents_quiet = kw_args.get("validate_contents_quiet", False)
|
179 | 169 |
|
180 | 170 | def run_repo_validation(self, repo):
|
@@ -490,7 +480,7 @@ def validate_contents(self, repo):
|
490 | 480 | files = [x["name"] for x in content_list]
|
491 | 481 |
|
492 | 482 | # ignore new/in-work repos, which should have less than 8 files:
|
493 |
| - # ___.py or folder, CoC, .travis.yml, .readthedocs.yml, docs/, |
| 483 | + # ___.py or folder, CoC, .github/, .readthedocs.yml, docs/, |
494 | 484 | # examples/, README, LICENSE
|
495 | 485 | if len(files) < 8:
|
496 | 486 | BUNDLE_IGNORE_LIST.append(repo["name"])
|
@@ -638,77 +628,6 @@ def validate_contents(self, repo):
|
638 | 628 |
|
639 | 629 | return errors
|
640 | 630 |
|
641 |
| - def _validate_travis(self, repo): |
642 |
| - """ DISABLED: Validate and configure a repository has the expected state in Travis |
643 |
| - CI. This will both check Travis state and attempt to enable Travis CI |
644 |
| - and setup the expected state in Travis if not enabled. Expects a |
645 |
| - dictionary with a GitHub API repository state (like from the list_repos |
646 |
| - function). Returns a list of string error messages for the repository. |
647 |
| - """ |
648 |
| - return [] |
649 |
| - |
650 |
| - if not (repo["owner"]["login"] == "adafruit" and |
651 |
| - repo["name"].startswith("Adafruit_CircuitPython")): |
652 |
| - return [] |
653 |
| - repo_url = "/repo/" + repo["owner"]["login"] + "%2F" + repo["name"] |
654 |
| - result = travis.get(repo_url) |
655 |
| - if not result.ok: |
656 |
| - #print(result, result.request.url, result.request.headers) |
657 |
| - #print(result.text) |
658 |
| - return [ERROR_TRAVIS_DOESNT_KNOW_REPO] |
659 |
| - result = result.json() |
660 |
| - if not result["active"]: |
661 |
| - activate = travis.post(repo_url + "/activate") |
662 |
| - if not activate.ok: |
663 |
| - #print(activate.request.url) |
664 |
| - #print("{} {}".format(activate, activate.text)) |
665 |
| - return [ERROR_ENABLE_TRAVIS] |
666 |
| - |
667 |
| - env_variables = travis.get(repo_url + "/env_vars") |
668 |
| - if not env_variables.ok: |
669 |
| - #print(env_variables, env_variables.text) |
670 |
| - #print(env_variables.request.headers) |
671 |
| - return [ERROR_TRAVIS_ENV] |
672 |
| - env_variables = env_variables.json() |
673 |
| - found_token = False |
674 |
| - for var in env_variables["env_vars"]: |
675 |
| - found_token = found_token or var["name"] == "GITHUB_TOKEN" |
676 |
| - ok = True |
677 |
| - if not found_token: |
678 |
| - if not self.github_token: |
679 |
| - return [ERROR_TRAVIS_GITHUB_TOKEN] |
680 |
| - else: |
681 |
| - if not self.full_auth: |
682 |
| - #github_user = github_token |
683 |
| - github_user = github.get("/user").json() |
684 |
| - password = input("Password for " + github_user["login"] + ": ") |
685 |
| - self.full_auth = (github_user["login"], password.strip()) |
686 |
| - if not self.full_auth: |
687 |
| - return [ERROR_TRAVIS_GITHUB_TOKEN] |
688 |
| - |
689 |
| - new_access_token = {"scopes": ["public_repo"], |
690 |
| - "note": "TravisCI release token for " + repo["full_name"], |
691 |
| - "note_url": "https://travis-ci.com/" + repo["full_name"]} |
692 |
| - token = github.post("/authorizations", json=new_access_token, auth=self.full_auth) |
693 |
| - if not token.ok: |
694 |
| - print(token.text) |
695 |
| - return [ERROR_TRAVIS_TOKEN_CREATE] |
696 |
| - |
697 |
| - token = token.json() |
698 |
| - grant_id = token["id"] |
699 |
| - token = token["token"] |
700 |
| - |
701 |
| - new_var = {"env_var.name": "GITHUB_TOKEN", |
702 |
| - "env_var.value": token, |
703 |
| - "env_var.public": False} |
704 |
| - new_var_result = travis.post(repo_url + "/env_vars", json=new_var) |
705 |
| - if not new_var_result.ok: |
706 |
| - #print(new_var_result.headers, new_var_result.text) |
707 |
| - github.delete("/authorizations/{}".format(grant_id), auth=self.full_auth) |
708 |
| - return [ERROR_TRAVIS_GITHUB_TOKEN] |
709 |
| - |
710 |
| - return [] |
711 |
| - |
712 | 631 | def validate_readthedocs(self, repo):
|
713 | 632 | if not (repo["owner"]["login"] == "adafruit" and
|
714 | 633 | repo["name"].startswith("Adafruit_CircuitPython")):
|
|
0 commit comments