Exemple #1
0
    def __init__(self, **kwargs):
        git = kwargs.pop('git', GIT_VERSION)
        hg = kwargs.pop('hg', MERCURIAL_VERSION)
        commit = kwargs.pop('commit', None)
        task_env = kwargs.pop('task_env', 'linux')
        variant = kwargs.pop('variant', None)
        helper = kwargs.pop('helper', None)
        clone = kwargs.pop('clone', TC_COMMIT)
        desc = kwargs.pop('description', None)
        extra_desc = kwargs.pop('extra_desc', None)
        pre_command = kwargs.pop('pre_command', None)
        if helper is None:
            helper = '{}.{}'.format(task_env, variant) if variant else task_env
            helper = Helper.install(helper)
        if variant:
            kwargs.setdefault('env', {})['VARIANT'] = variant
        env = TaskEnvironment.by_name('{}.test'.format(task_env))
        command = []
        if pre_command:
            command.extend(pre_command)
        if hg:
            command.extend(Hg.install('{}.{}'.format(task_env, hg)))
            command.append('hg --version')
            try:
                if StrictVersion(hg) < '3.6':
                    kwargs.setdefault('env', {})['NO_CLONEBUNDLES'] = '1'
            except ValueError:
                # `hg` is a sha1 for trunk, which means it's >= 3.6
                pass
        if git:
            command.extend(Git.install('{}.{}'.format(task_env, git)))
            command.append('git --version')
        command.extend(Task.checkout(commit=commit))
        command.extend(helper)
        if clone:
            command.extend([
                'curl -L {{{}.artifact}} -o repo/bundle.git'.format(
                    Clone.by_name(clone)),
                'git init repo/hg.old.git',
                'git -C repo/hg.old.git fetch ../bundle.git refs/*:refs/*',
                'git -C repo/hg.old.git remote add origin hg::$REPO',
                'git -C repo/hg.old.git symbolic-ref HEAD'
                ' refs/heads/branches/default/tip',
            ])
            kwargs.setdefault('env', {})['REPO'] = REPO
        if variant == 'coverage':
            command = [
                'export GIT_CINNABAR_COVERAGE=1',
                'export COVERAGE_FILE=$PWD/repo/.coverage',
            ] + command

        if 'command' in kwargs:
            kwargs['command'] = command + kwargs['command']
        else:
            if commit:
                # Always use the current CI scripts
                command.append('git -C repo checkout {} CI'.format(TC_COMMIT))
            kwargs['command'] = command + [
                'make -C repo -f CI/tests.mk',
            ]

        if variant == 'coverage':
            kwargs['command'].extend([
                'shopt -s nullglob',
                'for f in repo/git-core/{{cinnabar,connect,hg}}*.gcda',
                'do mv $f repo/helper',
                'done',
                'cd repo',
                'zip $ARTIFACTS/coverage.zip .coverage'
                ' helper/{{cinnabar,connect,hg}}*.gcda',
                'cd ..',
                'shopt -u nullglob',
            ])
            artifact = kwargs.pop('artifact', None)
            artifacts = kwargs.setdefault('artifacts', [])
            assert not (artifacts and artifact)
            if artifact:
                artifacts.push(artifact)
            artifacts.append('coverage.zip')
            self.coverage.append(self)
        if not desc:
            desc = 'test w/ git-{} hg-{}'.format(
                git, 'r' + hg if len(hg) == 40 else hg)
            if variant and variant != 'coverage':
                desc = ' '.join((desc, variant))
        if extra_desc:
            desc = ' '.join((desc, extra_desc))
        if task_env != 'linux':
            desc = ' '.join((desc, env.os, env.cpu))
        kwargs['description'] = desc
        Task.__init__(self, task_env=env, **kwargs)
Exemple #2
0
def decision():
    TestTask(
        description='python lint & tests',
        variant='coverage',
        clone=False,
        command=[
            '(cd repo &&'
            ' nosetests --all-modules --with-coverage --cover-tests tests &&'
            ' nosetests3 --all-modules tests)',
            '(cd repo && python -m flake8 --ignore E402,F405'
            ' $(git ls-files \\*\\*.py git-cinnabar git-remote-hg'
            ' | grep -v ^CI/))',
            '(cd repo && flake8 --ignore E402,F405'
            ' $(git ls-files CI/\\*\\*.py)'
            ' $(git grep -l unicode_literals))',
        ],
    )

    for env in ('linux', 'mingw64', 'osx10_10'):
        # Can't spawn osx workers from pull requests.
        if env.startswith('osx') and not TC_IS_PUSH:
            continue

        TestTask(task_env=env)

        task_env = TaskEnvironment.by_name('{}.test'.format(env))
        Task(
            task_env=task_env,
            description='download helper {} {}'.format(task_env.os,
                                                       task_env.cpu),
            command=list(
                chain(
                    Git.install('{}.{}'.format(env, GIT_VERSION)),
                    Hg.install('{}.{}'.format(env, MERCURIAL_VERSION)),
                    Task.checkout(),
                    [
                        '(cd repo ; ./git-cinnabar download --dev)',
                        'rm -rf repo/.git',
                        '(cd repo ; ./git-cinnabar download --dev)',
                        '(cd repo ; ./git-cinnabar download)',
                    ],
                )),
            dependencies=[
                Helper.by_name(env),
            ],
            env={
                'GIT_CINNABAR_EXPERIMENTS': 'python3',
            } if env == 'linux' else {},
        )

    # Because nothing is using the x86 windows helper, we need to manually
    # touch it.
    Helper.by_name('mingw32')

    for upgrade in UPGRADE_FROM:
        TestTask(
            extra_desc='upgrade-from-{}'.format(upgrade),
            variant='coverage',
            clone=upgrade,
            env={
                'UPGRADE_FROM': upgrade,
            },
        )
        TestTask(
            extra_desc='upgrade-from-{}'.format(upgrade),
            clone=upgrade,
            env={
                'GIT_CINNABAR_EXPERIMENTS': 'python3',
                'GIT_CINNABAR_LOG': 'reexec:3',
                'UPGRADE_FROM': upgrade,
            },
            hg='{}.py3'.format(MERCURIAL_VERSION),
        )

    for git in ('1.8.5', '2.7.4'):
        TestTask(git=git)

    for hg in SOME_MERCURIAL_VERSIONS:
        if hg != MERCURIAL_VERSION:
            TestTask(hg=hg)

    TestTask(
        task_env='linux',
        variant='asan',
    )
    TestTask(
        task_env='linux',
        variant='asan',
        extra_desc='experiments',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
        },
    )

    TestTask(
        variant='coverage',
        extra_desc='graft',
        env={
            'GRAFT': '1',
        },
    )

    TestTask(
        variant='old',
        env={
            'GIT_CINNABAR_OLD_HELPER': '1',
        },
    )

    TestTask(
        variant='old',
        extra_desc='graft',
        env={
            'GIT_CINNABAR_OLD_HELPER': '1',
            'GRAFT': '1',
        },
    )

    rev = old_compatible_python()

    TestTask(
        commit=rev,
        clone=rev,
        extra_desc='old python',
        env={
            'GIT_CINNABAR_OLD': '1',
        },
    )

    TestTask(
        commit=rev,
        clone=rev,
        extra_desc='old python graft',
        env={
            'GIT_CINNABAR_OLD': '1',
            'GRAFT': '1',
        },
    )

    TestTask(
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'python3',
        },
        hg='{}.py3'.format(MERCURIAL_VERSION),
    )

    TestTask(
        extra_desc='graft',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'python3',
            'GRAFT': '1',
        },
        hg='{}.py3'.format(MERCURIAL_VERSION),
    )

    TestTask(
        extra_desc='experiments',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
        },
    )

    TestTask(
        variant='coverage',
        extra_desc='experiments graft',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
            'GRAFT': '1',
        },
    )

    TestTask(
        extra_desc='experiments',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'python3,true',
            'GIT_CINNABAR_LOG': 'reexec:3',
        },
        hg='{}.py3'.format(MERCURIAL_VERSION),
    )

    TestTask(
        extra_desc='experiments graft',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'python3,true',
            'GIT_CINNABAR_LOG': 'reexec:3',
            'GRAFT': '1',
        },
        hg='{}.py3'.format(MERCURIAL_VERSION),
    )

    for variant in ('coverage', 'old'):
        env = {
            'GIT_CINNABAR_CHECK': 'no-mercurial',
        }
        if variant == 'old':
            env['GIT_CINNABAR_OLD_HELPER'] = '1'
        TestTask(
            variant=variant,
            extra_desc='no-mercurial',
            pre_command=[
                'python -m virtualenv venv',
                '. venv/bin/activate',
            ],
            command=[
                'deactivate',
                # deactivate removes the git directory from $PATH.
                # Also add the virtualenv bin directory to $PATH for mercurial
                # to be found, but at the end for the system python to still
                # be picked.
                'export PATH=$PWD/git/bin:$PATH:$PWD/venv/bin',
                'make -C repo -f CI/tests.mk',
            ],
            env=env)

    for variant in ('coverage', 'asan'):
        for check in ([], ['no-mercurial']):
            TestTask(
                variant=variant,
                extra_desc=' '.join(['cram'] + check),
                clone=False,
                command=[
                    'repo/git-cinnabar --version',
                    'cram --verbose repo/tests',
                ],
                env={
                    'GIT_CINNABAR_CHECK':
                    ','.join(['no-version-check'] + check),
                },
            )

    for check in ([], ['no-mercurial']):
        TestTask(
            extra_desc=' '.join(['cram'] + check),
            clone=False,
            command=[
                'repo/git-cinnabar --version',
                'cram --verbose repo/tests',
            ],
            env={
                'GIT_CINNABAR_CHECK': ','.join(['no-version-check'] + check),
                'GIT_CINNABAR_EXPERIMENTS': 'python3,true',
            },
            hg='{}.py3'.format(MERCURIAL_VERSION),
        )
Exemple #3
0
def decision():
    TestTask(
        description='python lint & tests',
        variant='coverage',
        clone=False,
        command=[
            '(cd repo &&'
            ' nosetests --all-modules --with-coverage --cover-tests tests)',
            '(cd repo && flake8 --ignore E402 $(git ls-files \*\*.py'
            ' git-cinnabar git-remote-hg))',
        ],
    )

    for env in ('linux', 'mingw64', 'osx10_10'):
        TestTask(task_env=env)

    for env in ('linux', 'mingw64', 'osx10_11'):
        task_env = TaskEnvironment.by_name('{}.test'.format(env))
        Task(
            task_env=task_env,
            description='download helper {} {}'.format(task_env.os,
                                                       task_env.cpu),
            command=list(chain(
                Git.install('{}.{}'.format(env, GIT_VERSION)),
                Hg.install('{}.{}'.format(env, MERCURIAL_VERSION)),
                Task.checkout(),
                [
                    '(cd repo ; ./git-cinnabar download --dev)',
                    'rm -rf repo/.git',
                    '(cd repo ; ./git-cinnabar download --dev)',
                    '(cd repo ; ./git-cinnabar download)',
                ],
            )),
            dependencies=[
                Helper.by_name(env),
            ],
        )

    # Because nothing is using the x86 windows helper, we need to manually
    # touch it.
    Helper.by_name('mingw32')

    for upgrade in UPGRADE_FROM:
        TestTask(
            extra_desc='upgrade-from-{}'.format(upgrade),
            variant='coverage',
            clone=upgrade,
            env={
                'UPGRADE_FROM': upgrade,
            },
        )

    for git in ('1.8.5', '2.7.4'):
        TestTask(git=git)

    for hg in SOME_MERCURIAL_VERSIONS:
        if hg != MERCURIAL_VERSION:
            TestTask(hg=hg)

    for env in ('linux', 'osx10_11'):
        TestTask(
            task_env=env,
            variant='asan',
            env={
                'GIT_CINNABAR_EXPERIMENTS': 'true',
            },
        )

    TestTask(
        variant='coverage',
        extra_desc='graft',
        env={
            'GRAFT': '1',
        },
    )

    TestTask(
        variant='old',
        env={
            'GIT_CINNABAR_OLD_HELPER': '1',
        },
    )

    TestTask(
        variant='old',
        extra_desc='graft',
        env={
            'GIT_CINNABAR_OLD_HELPER': '1',
            'GRAFT': '1',
        },
    )

    rev = old_compatible_python()

    TestTask(
        commit=rev,
        clone=rev,
        extra_desc='old python',
    )

    TestTask(
        commit=rev,
        clone=rev,
        extra_desc='old python graft',
        env={
            'GRAFT': '1',
        },
    )

    TestTask(
        variant='coverage',
        extra_desc='experiments',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
        },
    )

    TestTask(
        variant='coverage',
        extra_desc='experiments graft',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
            'GRAFT': '1',
        },
    )
Exemple #4
0
 def __init__(self, **kwargs):
     git = kwargs.pop('git', GIT_VERSION)
     hg = kwargs.pop('hg', MERCURIAL_VERSION)
     commit = kwargs.pop('commit', None)
     task_env = kwargs.pop('task_env', 'linux')
     variant = kwargs.pop('variant', None)
     helper = kwargs.pop('helper', None)
     clone = kwargs.pop('clone', TC_COMMIT)
     desc = kwargs.pop('description', None)
     extra_desc = kwargs.pop('extra_desc', None)
     if helper is None:
         helper = '{}.{}'.format(task_env, variant) if variant else task_env
         helper = Helper.install(helper)
     if variant:
         kwargs.setdefault('env', {})['VARIANT'] = variant
     env = TaskEnvironment.by_name('{}.test'.format(task_env))
     command = []
     if hg:
         command.extend(Hg.install('{}.{}'.format(task_env, hg)))
         command.append('hg --version')
     if git:
         command.extend(Git.install('{}.{}'.format(task_env, git)))
         command.append('git --version')
     command.extend(Task.checkout(commit=commit))
     command.extend(helper)
     if clone:
         command.extend([
             'curl -L {{{}.artifact}} -o clone.tar.xz'.format(
                 Clone.by_name(clone)),
             'tar -C repo -Jxf clone.tar.xz',
         ])
     if 'command' in kwargs:
         kwargs['command'] = command + kwargs['command']
     else:
         if commit:
             # Always use the current CI scripts
             command.append('git -C repo checkout {} CI'.format(TC_COMMIT))
         kwargs['command'] = command + [
             'make -C repo -f CI/tests.mk',
         ]
     if variant == 'coverage':
         kwargs['command'].extend([
             'shopt -s nullglob',
             'for f in repo/git-core/{{cinnabar,connect,hg}}*.gcda',
             'do mv $f repo/helper',
             'done',
             'cd repo',
             'tar -Jcf $ARTIFACTS/coverage.tar.xz .coverage'
             ' helper/{{cinnabar,connect,hg}}*.gcda',
             'cd ..',
             'shopt -u nullglob',
         ])
         artifact = kwargs.pop('artifact', None)
         artifacts = kwargs.setdefault('artifacts', [])
         assert not (artifacts and artifact)
         if artifact:
             artifacts.push(artifact)
         artifacts.append('coverage.tar.xz')
         self.coverage.append(self)
     if not desc:
         desc = 'test w/ git-{} hg-{}'.format(
             git, 'r' + hg if len(hg) == 40 else hg)
         if variant and variant != 'coverage':
             desc = ' '.join((desc, variant))
     if extra_desc:
         desc = ' '.join((desc, extra_desc))
     if task_env != 'linux':
         desc = ' '.join((desc, env.os, env.cpu))
     kwargs['description'] = desc
     Task.__init__(self, task_env=env, **kwargs)
Exemple #5
0
 def __init__(self, **kwargs):
     git = kwargs.pop('git', GIT_VERSION)
     hg = kwargs.pop('hg', MERCURIAL_VERSION)
     commit = kwargs.pop('commit', None)
     task_env = kwargs.pop('task_env', 'linux')
     variant = kwargs.pop('variant', None)
     helper = kwargs.pop('helper', None)
     clone = kwargs.pop('clone', TC_COMMIT)
     desc = kwargs.pop('description', None)
     extra_desc = kwargs.pop('extra_desc', None)
     pre_command = kwargs.pop('pre_command', None)
     if helper is None:
         helper = '{}.{}'.format(task_env, variant) if variant else task_env
         helper = Helper.install(helper)
     if variant:
         kwargs.setdefault('env', {})['VARIANT'] = variant
     env = TaskEnvironment.by_name('{}.test'.format(task_env))
     command = []
     if pre_command:
         command.extend(pre_command)
     if hg:
         command.extend(Hg.install('{}.{}'.format(task_env, hg)))
         command.append('hg --version')
         if LooseVersion(hg) < '3.6':
             kwargs.setdefault('env', {})['NO_CLONEBUNDLES'] = '1'
     if git:
         command.extend(Git.install('{}.{}'.format(task_env, git)))
         command.append('git --version')
     command.extend(Task.checkout(commit=commit))
     command.extend(helper)
     if clone:
         command.extend([
             'curl -L {{{}.artifact}} -o repo/bundle.git'.format(
                 Clone.by_name(clone)),
             'git init repo/hg.old.git',
             'git -C repo/hg.old.git fetch ../bundle.git refs/*:refs/*',
             'git -C repo/hg.old.git remote add origin hg::$REPO',
             'git -C repo/hg.old.git symbolic-ref HEAD'
             ' refs/heads/branches/default/tip',
         ])
         kwargs.setdefault('env', {})['REPO'] = REPO
     if 'command' in kwargs:
         kwargs['command'] = command + kwargs['command']
     else:
         if commit:
             # Always use the current CI scripts
             command.append('git -C repo checkout {} CI'.format(TC_COMMIT))
         kwargs['command'] = command + [
             'make -C repo -f CI/tests.mk',
         ]
     if variant == 'coverage':
         kwargs['command'].extend([
             'shopt -s nullglob',
             'for f in repo/git-core/{{cinnabar,connect,hg}}*.gcda',
             'do mv $f repo/helper',
             'done',
             'cd repo',
             'tar -Jcf $ARTIFACTS/coverage.tar.xz .coverage'
             ' helper/{{cinnabar,connect,hg}}*.gcda',
             'cd ..',
             'shopt -u nullglob',
         ])
         artifact = kwargs.pop('artifact', None)
         artifacts = kwargs.setdefault('artifacts', [])
         assert not(artifacts and artifact)
         if artifact:
             artifacts.push(artifact)
         artifacts.append('coverage.tar.xz')
         self.coverage.append(self)
     if not desc:
         desc = 'test w/ git-{} hg-{}'.format(
             git, 'r' + hg if len(hg) == 40 else hg)
         if variant and variant != 'coverage':
             desc = ' '.join((desc, variant))
     if extra_desc:
         desc = ' '.join((desc, extra_desc))
     if task_env != 'linux':
         desc = ' '.join((desc, env.os, env.cpu))
     kwargs['description'] = desc
     Task.__init__(self, task_env=env, **kwargs)
Exemple #6
0
def decision():
    TestTask(
        description='python lint & tests',
        variant='coverage',
        clone=False,
        command=[
            '(cd repo &&'
            ' nosetests --all-modules --with-coverage --cover-tests tests)',
            '(cd repo && flake8 --ignore E402 $(git ls-files \\*\\*.py'
            ' git-cinnabar git-remote-hg | grep -v ^CI/))',
            '(cd repo && python3 -m flake8 --ignore E402 '
            '$(git ls-files CI/\\*\\*.py))',
        ],
    )

    TestTask(
        description='cram tests',
        variant='coverage',
        clone=False,
        command=[
            'cram --verbose repo/tests',
        ],
        env={
            'GIT_CINNABAR_CHECK': 'no-version-check',
        },
    )

    for env in ('linux', 'mingw64', 'osx10_10'):
        TestTask(task_env=env)

    for env in ('linux', 'mingw64', 'osx10_11'):
        task_env = TaskEnvironment.by_name('{}.test'.format(env))
        Task(
            task_env=task_env,
            description='download helper {} {}'.format(task_env.os,
                                                       task_env.cpu),
            command=list(chain(
                Git.install('{}.{}'.format(env, GIT_VERSION)),
                Hg.install('{}.{}'.format(env, MERCURIAL_VERSION)),
                Task.checkout(),
                [
                    '(cd repo ; ./git-cinnabar download --dev)',
                    'rm -rf repo/.git',
                    '(cd repo ; ./git-cinnabar download --dev)',
                    '(cd repo ; ./git-cinnabar download)',
                ],
            )),
            dependencies=[
                Helper.by_name(env),
            ],
        )

    # Because nothing is using the x86 windows helper, we need to manually
    # touch it.
    Helper.by_name('mingw32')

    for upgrade in UPGRADE_FROM:
        TestTask(
            extra_desc='upgrade-from-{}'.format(upgrade),
            variant='coverage',
            clone=upgrade,
            env={
                'UPGRADE_FROM': upgrade,
            },
        )

    for git in ('1.8.5', '2.7.4'):
        TestTask(git=git)

    for hg in SOME_MERCURIAL_VERSIONS:
        if hg != MERCURIAL_VERSION:
            TestTask(hg=hg)

    for env in ('linux', 'osx10_11'):
        TestTask(
            task_env=env,
            variant='asan',
            env={
                'GIT_CINNABAR_EXPERIMENTS': 'true',
            },
        )

    TestTask(
        variant='coverage',
        extra_desc='graft',
        env={
            'GRAFT': '1',
        },
    )

    TestTask(
        variant='old',
        env={
            'GIT_CINNABAR_OLD_HELPER': '1',
        },
    )

    TestTask(
        variant='old',
        extra_desc='graft',
        env={
            'GIT_CINNABAR_OLD_HELPER': '1',
            'GRAFT': '1',
        },
    )

    rev = old_compatible_python()

    TestTask(
        commit=rev,
        clone=rev,
        extra_desc='old python',
        env={
            'GIT_CINNABAR_OLD': '1',
        },
    )

    TestTask(
        commit=rev,
        clone=rev,
        extra_desc='old python graft',
        env={
            'GIT_CINNABAR_OLD': '1',
            'GRAFT': '1',
        },
    )

    TestTask(
        variant='coverage',
        extra_desc='experiments',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
        },
    )

    TestTask(
        variant='coverage',
        extra_desc='experiments graft',
        env={
            'GIT_CINNABAR_EXPERIMENTS': 'true',
            'GRAFT': '1',
        },
    )

    for variant in ('coverage', 'old'):
        env = {
            'GIT_CINNABAR_CHECK': 'no-mercurial',
        }
        if variant == 'old':
            env['GIT_CINNABAR_OLD_HELPER'] = '1'
        TestTask(
            variant=variant,
            extra_desc='no-mercurial',
            pre_command=[
                'python -m virtualenv venv',
                '. venv/bin/activate',
            ],
            command=[
                'deactivate',
                # deactivate removes the git directory from $PATH.
                # Also add the virtualenv bin directory to $PATH for mercurial
                # to be found, but at the end for the system python to still
                # be picked.
                'export PATH=$PWD/git/bin:$PATH:$PWD/venv/bin',
                'make -C repo -f CI/tests.mk',
            ],
            env=env
        )