def set_git_configs(proj):
    sshopt = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
    sh('''
        git config --local user.name "TizenAPI-Bot"
        git config --local user.email "*****@*****.**"
        git config core.sshCommand '{sshopt}'
    '''.format(sshopt=sshopt),
       cwd=proj.workspace)
Example #2
0
def extract(proj, output):
    artifacts_dir = os.path.join(proj.workspace, 'Artifacts/bin/public')
    if not os.path.isdir(artifacts_dir):
        raise ProjectError('No Artifacts')
    apitool_cmd = [
        os.path.join(os.path.dirname(__file__), APITOOL_PATH),
        'print', '--include-hidden', '--format=json',
        '-o ' + output, artifacts_dir]
    sh('dotnet', apitool_cmd)
def main():
    env = BuildEnvironment(os.environ)
    proj = Project(env)

    # 1. Get Version of TizenFX
    version = '{}.{}'.format(
        conf.VERSION_PREFIX_MAP[env.category], proj.commit_count + 10000)
    print('[VERSION] {}'.format(version))

    # 2. Restore Project
    proj.restore()

    # 3. Run DocFX
    sh('mono --assembly-loader=strict /usr/share/docfx/docfx.exe docs/docfx.json',
       cwd=proj.workspace)

    # 4. Make and push a commit to gh-pages branch
    set_git_configs(proj)
    sh('''
        git branch -f gh-pages origin/gh-pages
        git checkout gh-pages
        git pull --rebase origin gh-pages
        mkdir -p {github_branch}
        cp -fr Artifacts/docs/* {github_branch}/
        git add {github_branch}/
    '''.format(github_branch=env.github_branch_name), cwd=proj.workspace)
    modified = sh('git diff --cached --numstat | wc -l',
                  cwd=proj.workspace, return_stdout=True, print_stdout=False)
    if int(modified.strip()) > 0:
        sh('''
            git commit -m {version}
            git push "https://{userpass}@github.com/{github_repo}.git" gh-pages
        '''.format(version=version,
                   userpass=env.github_userpass, github_repo=env.github_repo))
Example #4
0
 def build(self, with_analysis=True, dummy=False, pack=False):
     args = ['full', '/flp:LogFile=%s' % self.logfile]
     if with_analysis:
         args.append('/p:BuildWithAnalysis=True')
     sh(self.buildshell, args)
     if dummy:
         sh(self.buildshell, ['dummy'])
     if pack:
         sh(self.buildshell, ['pack'])
def push_to_tizen(env, proj):
    if not env.gerrit_branch_name:
        return
    sh('''
        git remote add gerrit {gerrit_url}
        git fetch gerrit {gerrit_branch}
        git checkout -t gerrit/{gerrit_branch}
        git merge --no-edit -s recursive -X theirs origin/{github_branch}
        ./packaging/makespec.sh -r {version} -n {version} -i {version}
        git add packaging/
    '''.format(version=env.version,
               gerrit_url=conf.GERRIT_GIT_URL,
               gerrit_branch=env.gerrit_branch_name,
               github_branch=env.github_branch_name),
       cwd=proj.workspace)

    modified = sh('git diff --cached --numstat | wc -l',
                  cwd=proj.workspace,
                  return_stdout=True,
                  print_stdout=False)
    if int(modified.strip()) > 0:
        dt = datetime.utcnow() + timedelta(hours=9)
        submit_tag = 'submit/{}/{:%Y%m%d.%H%M%S}'.format(
            env.gerrit_branch_name, dt)
        print('[SUBMIT_TAG] {}'.format(submit_tag))
        sh('''
            git commit -m "Release {version}"
            git push -f gerrit {gerrit_branch}
        '''.format(version=env.version,
                   submit_tag=submit_tag,
                   gerrit_branch=env.gerrit_branch_name),
           cwd=proj.workspace)
        if not env.skip_submit_request:
            sh('''
                git tag -m "Release {version}" {submit_tag}
                git push --tags gerrit {gerrit_branch}
            '''.format(version=env.version,
                       submit_tag=submit_tag,
                       gerrit_branch=env.gerrit_branch_name),
               cwd=proj.workspace)
    else:
        print("No changes to publish. Skip publishing to Tizen git repo.")
def set_git_configs(proj):
    sh('''
        git config --local user.name "TizenAPI-Bot"
        git config --local user.email "*****@*****.**"
    ''', cwd=proj.workspace)
Example #7
0
 def push_nuget_packages(self, apikey, source):
     nupkgs = glob(os.path.join(self.workspace, 'Artifacts/*.nupkg'))
     for p in nupkgs:
         cmd = 'dotnet nuget push {} -k {} -s {} -t 3000'.format(
             p, apikey, source)
         sh(cmd, cwd=self.workspace)
Example #8
0
 def restore(self):
     cmd = 'dotnet msbuild ./build/build.proj /nologo /t:restore'
     sh(cmd, cwd=self.workspace)
Example #9
0
 def commit_count(self):
     count = sh('cd {} && git rev-list --count HEAD'.format(self.workspace),
                print_stdout=False,
                return_stdout=True)
     return int(count)