mirror of
https://github.com/ModOrganizer2/modorganizer-umbrella.git
synced 2026-07-27 13:58:32 -07:00
Test gh integration
This commit is contained in:
@@ -79,6 +79,8 @@ config = {
|
||||
'Distrib_Author': 'TanninOne', # the current distribution (and the original Author)
|
||||
'Work_Author': '', # yourself
|
||||
|
||||
'gh_cli_token': '',
|
||||
|
||||
# manualy set all versions
|
||||
'7zip_version': '19.00',
|
||||
'boost_version': '1.73.0',
|
||||
@@ -159,6 +161,7 @@ config['paths'] = {
|
||||
# 'graphviz': path_or_default("dot.exe", [["Graphviz2.38", "bin"]]),
|
||||
'cmake': path_or_default("cmake.exe", [["CMake", "bin"]]),
|
||||
'git': path_or_default("git.exe", [["Git", "bin"]]),
|
||||
'gh': path_or_default("gh.exe", [["GitHub CLI"]]),
|
||||
'perl': path_or_default("perl.exe", [["StrawberryPerl", "perl", "bin"], ["Strawberry", "perl", "bin"]]),
|
||||
#'svn': path_or_default("svn.exe", [["SlikSvn", "bin"]]),
|
||||
'7z': path_or_default("7z.exe", [["7-Zip"]]),
|
||||
|
||||
+5
-1
@@ -148,6 +148,10 @@ for author, git_path, path, branch, dependencies, Build in [
|
||||
|
||||
if config['Appveyor_Build']:
|
||||
appveyor_cmake_step = cmake.CMakeJOM().arguments(cmake_param).install()
|
||||
gh_pr_branch = None
|
||||
|
||||
if os.getenv('APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH') is not None:
|
||||
gh_pr_branch = '{}:{}'.format(os.getenv('APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME'), os.getenv('APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH'))
|
||||
|
||||
if git_path != "cmake_common":
|
||||
appveyor_cmake_step.depend("cmake_common")
|
||||
@@ -158,7 +162,7 @@ for author, git_path, path, branch, dependencies, Build in [
|
||||
if os.getenv("APPVEYOR_PROJECT_NAME","") == git_path:
|
||||
source_retrieval_step = appveyor.SetProjectFolder(os.getenv("APPVEYOR_BUILD_FOLDER", ""))
|
||||
else:
|
||||
source_retrieval_step = github.Source(author, git_path, branch, feature_branch=config['Feature_Branch'], super_repository=tl_repo).set_destination(path)
|
||||
source_retrieval_step = github.Source(author, git_path, branch, feature_branch=config['Feature_Branch'], super_repository=tl_repo, gh_pr=gh_pr_branch).set_destination(path)
|
||||
|
||||
if git_path == "modorganizer" and config['override_build_version']:
|
||||
#add patching step that depends on source retrieval
|
||||
|
||||
@@ -80,7 +80,7 @@ class SuperRepository(Task):
|
||||
|
||||
|
||||
class Clone(Repository):
|
||||
def __init__(self, url, branch, feature_branch=None, super_repository=None, update=True, commit=None, shallowclone=False):
|
||||
def __init__(self, url, branch, feature_branch=None, super_repository=None, update=True, commit=None, shallowclone=False, gh_pr=None):
|
||||
if config['shallowclone']:
|
||||
self.shallowclone = True
|
||||
super(Clone, self).__init__(url, branch, feature_branch)
|
||||
@@ -89,6 +89,7 @@ class Clone(Repository):
|
||||
self.__update = update
|
||||
self.__commit = commit
|
||||
self.__shallowclone = shallowclone
|
||||
self.__gh_pr = gh_pr
|
||||
|
||||
if self._feature_branch is not None:
|
||||
proc = Popen([config['paths']['git'], "ls-remote", "--heads", "--exit-code", self._url, self._feature_branch],
|
||||
@@ -151,7 +152,12 @@ class Clone(Repository):
|
||||
logging.error("failed to clone repository %s (returncode %s)", self._url, proc.returncode)
|
||||
return False
|
||||
|
||||
if self.__commit is not None:
|
||||
if self.__gh_pr is not None:
|
||||
proc = Popen([config['paths']['gh'], "pr", "checkout", self.__gh_pr],
|
||||
cwd=self.__super_repository.path,
|
||||
env=config['__environment'])
|
||||
proc.communicate()
|
||||
elif self.__commit is not None:
|
||||
if self.__shallowclone:
|
||||
proc = Popen([config['paths']['git'], "checkout","--depth", "1", self.__commit],
|
||||
cwd=self._context["build_path"],
|
||||
|
||||
@@ -43,10 +43,10 @@ class Tag(URLDownload):
|
||||
|
||||
|
||||
class Source(Clone):
|
||||
def __init__(self, author, project, branch="master", feature_branch=None, super_repository=None, update=True, commit=None, shallowclone=False):
|
||||
def __init__(self, author, project, branch="master", feature_branch=None, super_repository=None, update=True, commit=None, shallowclone=False, gh_pr=None):
|
||||
if config['shallowclone']:
|
||||
self.shallowclone = True
|
||||
|
||||
super(Source, self).__init__("https://github.com/{author}/{project}.git".format(author=author, project=project),
|
||||
branch, feature_branch, super_repository, update, commit, shallowclone)
|
||||
branch, feature_branch, super_repository, update, commit, shallowclone, gh_pr)
|
||||
self.set_destination(project)
|
||||
|
||||
@@ -110,6 +110,7 @@ def dump_config():
|
||||
logging.debug(" Config: config['paths']['cmake']=%s", config['paths']['cmake'])
|
||||
logging.debug(" Config: config['paths']['jom']=%s", config['paths']['jom'])
|
||||
logging.debug(" Config: config['paths']['git']=%s", config['paths']['git'])
|
||||
logging.debug(" Config: config['paths']['gh']=%s", config['paths']['gh'])
|
||||
logging.debug(" Config: config['paths']['perl']=%s", config['paths']['perl'])
|
||||
#logging.debug(" Config: config['paths']['ruby']=%s", config['paths']['ruby'])
|
||||
#logging.debug(" Config: config['paths']['svn']=%s", config['paths']['svn'])
|
||||
|
||||
@@ -87,6 +87,8 @@ def check_prerequisites_config():
|
||||
return False
|
||||
if not config['paths']['git']:
|
||||
return False
|
||||
if not config['paths']['gh']:
|
||||
return False
|
||||
if not config['paths']['perl']:
|
||||
return False
|
||||
if config["Installer"]:
|
||||
@@ -118,6 +120,10 @@ def main():
|
||||
print('\nMissing prerequisites listed above - cannot continue')
|
||||
exit(1)
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
p = Popen([config['paths']['gh'], 'auth', 'login', '--with-token'], stdout=PIPE, stdin=PIPE, stderr=PIPE, text=True)
|
||||
stdout_data = p.communicate(input=config['gh_cli_token'])[0]
|
||||
|
||||
for d in ["download", "build", "progress", "install"]:
|
||||
if not os.path.exists(config["paths"][d]):
|
||||
os.makedirs(config["paths"][d])
|
||||
|
||||
Reference in New Issue
Block a user