def ethereumj_factory(branch='master'):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/ethereumj.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='ethereumj',
            retry=(5, 3)
        ),
        ShellCommand(
            logEnviron=False,
            flunkOnFailure=False,
            warnOnFailure=True,
            name="build",
            command=["./gradlew", "build", "--debug"],
            description="building",
            descriptionDone="gradlew"
        ),
        ShellCommand(
            logEnviron=False,
            flunkOnFailure=False,
            warnOnFailure=True,
            name="install",
            command=["./gradlew", "install", "--debug"],
            description="installing",
            descriptionDone="install"
        )
    ]: factory.addStep(step)

    return factory
def osx_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-version",
            command='gsed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-clean",
            description="cleaning up",
            descriptionDone="clean up",
            command=["make", "clean"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-all",
            description="installing",
            descriptionDone="install",
            command=["make", "all"]
        ),
        ShellCommand(
            haltOnFailure=True,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command=["make", "test"],
            maxTime=900
        )
    ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            Trigger(
                name='brew-el-capitan',
                schedulerNames=["go-ethereum-%s-el-capitan" % branch],
                waitForFinish=False,
                set_properties={
                    "version": Interpolate("%(prop:version)s")
                }
            )
        ]: factory.addStep(step)

    return factory
Exemple #3
0
def cpp_check_factory(branch='develop'):
    factory = BuildFactory()

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/cpp-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='cpp-ethereum',
                retry=(5, 3)),
            WarningCountingShellCommand(logEnviron=False,
                                        name="cppcheck",
                                        description="running cppcheck",
                                        descriptionDone="cppcheck",
                                        command=[
                                            "cppcheck", "--force",
                                            "--enable=all", "--template",
                                            "gcc", "."
                                        ])
    ]:
        factory.addStep(step)

    return factory
def osx_cpp_check_factory(branch='develop'):
    factory = BuildFactory()

    scan_build_path = "/usr/local/opt/llvm/share/clang/tools/scan-build"
    analyzer = "c++-analyzer"

    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method = 'copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        Configure(
            haltOnFailure = True,
            logEnviron = False,
            command=["cmake", ".", "-DCMAKE_CXX_COMPILER=%s/%s" % (scan_build_path, analyzer)]
        ),
        Compile(
            logEnviron = False,
            name = "scan-build",
            command = ["%s/scan-build" % scan_build_path, "--use-analyzer=%s/%s" % (scan_build_path, analyzer), "make", "-j", "6"]
        )
    ]: factory.addStep(step)

    return factory
Exemple #5
0
def osx_cpp_check_factory(branch='develop'):
    factory = BuildFactory()

    scan_build_path = "/usr/local/opt/llvm/share/clang/tools/scan-build"
    analyzer = "c++-analyzer"

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/cpp-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='cpp-ethereum',
                retry=(5, 3)),
            Configure(haltOnFailure=True,
                      logEnviron=False,
                      command=[
                          "cmake", ".",
                          "-DCMAKE_CXX_COMPILER=%s/%s" %
                          (scan_build_path, analyzer)
                      ]),
            Compile(logEnviron=False,
                    name="scan-build",
                    command=[
                        "%s/scan-build" % scan_build_path,
                        "--use-analyzer=%s/%s" % (scan_build_path, analyzer),
                        "make", "-j", "6"
                    ])
    ]:
        factory.addStep(step)

    return factory
Exemple #6
0
def ethereumj_factory(branch='master'):
    factory = BuildFactory()
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/ethereumj.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='ethereumj',
                retry=(5, 3)),
            ShellCommand(logEnviron=False,
                         flunkOnFailure=False,
                         warnOnFailure=True,
                         name="build",
                         command=["./gradlew", "build", "--debug"],
                         description="building",
                         descriptionDone="gradlew"),
            ShellCommand(logEnviron=False,
                         flunkOnFailure=False,
                         warnOnFailure=True,
                         name="install",
                         command=["./gradlew", "install", "--debug"],
                         description="installing",
                         descriptionDone="install")
    ]:
        factory.addStep(step)

    return factory
Exemple #7
0
def go_ethereum_factory(branch='master', deb=False):
    factory = BuildFactory()
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/go-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='go-ethereum',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                'sed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-clean",
                         command=["make", "clean"],
                         description="cleaning up",
                         descriptionDone="clean up"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-all",
                         description="installing",
                         descriptionDone="install",
                         command=["make", "all"]),
            ShellCommand(haltOnFailure=True,
                         name="go-test",
                         description="go testing",
                         descriptionDone="go test",
                         command=["make", "test"],
                         maxTime=900)
    ]:
        factory.addStep(step)

    if deb:
        for architecture in ['i386', 'amd64']:
            for distribution in distributions:
                for step in [
                        Trigger(schedulerNames=[
                            "go-ethereum-%s-%s-%s" %
                            (branch, architecture, distribution)
                        ],
                                waitForFinish=False,
                                set_properties={
                                    "version": Interpolate("%(prop:version)s")
                                })
                ]:
                    factory.addStep(step)

    return factory
Exemple #8
0
def pyethapp_factory(branch='master'):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/pyethapp.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='pyethapp',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/.*version=.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" setup.py',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="pip-requirements",
            description="installing requirements",
            descriptionDone="install requirements",
            command=["pip", "install", "-r", "requirements.txt"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="upgrade-requirements",
            description="upgrading test requirements",
            descriptionDone="upgrade test requirements",
            command=["pip", "install", "--upgrade", "--no-deps", "-r", "requirements.txt"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="pip-install",
            description="installing",
            descriptionDone="install",
            command=["pip", "install", "-e", "."]
        ),
        ShellCommand(
            logEnviron=False,
            description="running",
            descriptionDone="run",
            name="pyethapp",
            command=["pyethapp", "--help"]
        )
    ]: factory.addStep(step)

    return factory
Exemple #9
0
def osx_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/go-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='go-ethereum',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-version",
                command=
                'gsed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-clean",
                         description="cleaning up",
                         descriptionDone="clean up",
                         command=["make", "clean"]),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-all",
                         description="installing",
                         descriptionDone="install",
                         command=["make", "all"]),
            ShellCommand(haltOnFailure=True,
                         name="go-test",
                         description="go testing",
                         descriptionDone="go test",
                         command=["make", "test"],
                         maxTime=900)
    ]:
        factory.addStep(step)

    if not isPullRequest:
        for step in [
                Trigger(name='brew-el-capitan',
                        schedulerNames=["go-ethereum-%s-el-capitan" % branch],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s")
                        })
        ]:
            factory.addStep(step)

    return factory
def self_update_factory():
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            name='update',
            repourl='https://github.com/ethereum/ethereum-buildbot.git',
            mode='incremental',
            codebase='ethereum-buildbot',
            retry=(5, 3)
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name='copy-samples',
            description='copying samples',
            descriptionDone='copy samples',
            command='cp slaves.json.sample slaves.json && cp users.json.sample users.json && '
                    'cp ircbot.json.sample ircbot.json && cp tokens.json.sample tokens.json && '
                    'cp changehook.passwd.sample changehook.passwd'
        ),
        ShellCommand(
            logEnviron=False,
            name='check',
            description='running checkconfig',
            descriptionDone='checkconfig',
            command=['buildbot', 'checkconfig', '.'],
            flunkOnWarnings=True,
            flunkOnFailure=True,
            haltOnFailure=True,
            warnOnFailure=False,
            interruptSignal=15
        ),
        MasterShellCommand(
            haltOnFailure=True,
            name='live-update',
            description='updating',
            descriptionDone='update',
            command=['git', 'pull']
        ),
        MasterShellCommand(
            haltOnFailure=True,
            name='reload',
            description='reloading',
            descriptionDone='reload',
            command=['buildbot', 'reconfig', '.']
        )
    ]: factory.addStep(step)

    return factory
Exemple #11
0
def pyethapp_factory(branch='master'):
    factory = BuildFactory()
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/pyethapp.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='pyethapp',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                'sed -ne "s/.*version=.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" setup.py',
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="pip-requirements",
                         description="installing requirements",
                         descriptionDone="install requirements",
                         command=["pip", "install", "-r", "requirements.txt"]),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="upgrade-requirements",
                         description="upgrading test requirements",
                         descriptionDone="upgrade test requirements",
                         command=[
                             "pip", "install", "--upgrade", "--no-deps", "-r",
                             "requirements.txt"
                         ]),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="pip-install",
                         description="installing",
                         descriptionDone="install",
                         command=["pip", "install", "-e", "."]),
            ShellCommand(logEnviron=False,
                         description="running",
                         descriptionDone="run",
                         name="pyethapp",
                         command=["pyethapp", "--help"])
    ]:
        factory.addStep(step)

    return factory
def self_update_factory():
    factory = BuildFactory()
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                name='update',
                repourl='https://github.com/ethereum/ethereum-buildbot.git',
                mode='incremental',
                codebase='ethereum-buildbot',
                retry=(5, 3)),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name='copy-samples',
                description='copying samples',
                descriptionDone='copy samples',
                command=
                'cp slaves.json.sample slaves.json && cp users.json.sample users.json && '
                'cp ircbot.json.sample ircbot.json && cp tokens.json.sample tokens.json && '
                'cp changehook.passwd.sample changehook.passwd'),
            ShellCommand(logEnviron=False,
                         name='check',
                         description='running checkconfig',
                         descriptionDone='checkconfig',
                         command=['buildbot', 'checkconfig', '.'],
                         flunkOnWarnings=True,
                         flunkOnFailure=True,
                         haltOnFailure=True,
                         warnOnFailure=False,
                         interruptSignal=15),
            MasterShellCommand(haltOnFailure=True,
                               name='live-update',
                               description='updating',
                               descriptionDone='update',
                               command=['git', 'pull']),
            MasterShellCommand(haltOnFailure=True,
                               name='reload',
                               description='reloading',
                               descriptionDone='reload',
                               command=['buildbot', 'reconfig', '.'])
    ]:
        factory.addStep(step)

    return factory
def cpp_check_factory(branch='develop'):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        WarningCountingShellCommand(
            logEnviron=False,
            name="cppcheck",
            description="running cppcheck",
            descriptionDone="cppcheck",
            command=["cppcheck", "--force", "--enable=all", "--template", "gcc", "."]
        )
    ]: factory.addStep(step)

    return factory
def windows_go_factory(branch='develop', isPullRequest=False, headless=True):
    factory = BuildFactory()

    env = {
        "GOPATH": Interpolate("%(prop:workdir)s\\go;%(prop:workdir)s\\build\\Godeps\\_workspace"),
        "PKG_CONFIG_PATH": "C:\Qt\5.4\mingw491_32\lib\pkgconfig",
        "CGO_CPPFLAGS": "-IC:\Qt\5.4\mingw491_32\include\QtCore",
        "LD_LIBRARY_PATH": "C:\Qt\5.4\mingw491_32\lib",
        'PATH': [Interpolate("%(prop:workdir)s\\go\\bin"), "${PATH}"]
    }

    sed = '"C:\\Program Files (x86)\\GnuWin32\\bin\\sed.exe"'
    zip_ = '"C:\\Program Files (x86)\\GnuWin32\\bin\\zip.exe"'

    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl = 'https://github.com/ethereum/go-build.git',
            branch = 'master',
            mode = 'incremental',
            codebase = 'go-build',
            retry=(5, 3),
            workdir = 'go-build-%s' % branch
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "set-protocol",
            command = '%s -ne "s/.*ProtocolVersion    = \(.*\)/\\1/p" eth\protocol.go' % sed,
            property = "protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "update-p2p",
            command = '%s -ne "s/.*baseProtocolVersion.*= \(.*\)/\\1/p" p2p\peer.go' % sed,
            property="p2p"
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "set-version",
            command = '%s -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd\geth\main.go' % sed,
            property = "version"
        ),
        ShellCommand(
            haltOnFailure = True,
            logEnviron = False,
            name="go-cleanup",
            command=Interpolate("rd /s /q %(prop:workdir)s\\go && mkdir %(prop:workdir)s\\go"),
            description="cleaning up",
            descriptionDone="clean up"
        ),
        ShellCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "move-src",
            description="moving src",
            descriptionDone="move src",
            command=_go_cmds_win(branch=branch),
            env={"GOPATH": Interpolate("%(prop:workdir)s\go")}
        ),
        ShellCommand(
            haltOnFailure = True,
            logEnviron = False,
            name="build-geth",
            description="building geth",
            descriptionDone="build geth",
            command="go build -v github.com\ethereum\go-ethereum\cmd\geth",
            env=env
        )
    ]: factory.addStep(step)

    if not headless:
        for step in [
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name="install-mist",
                description="installing mist",
                descriptionDone="install mist",
                command="go install -v github.com\ethereum\go-ethereum\cmd\mist",
                env=env
            )
        ]: factory.addStep(step)

    for step in [
        ShellCommand(
            flunkOnFailure=False,
            warnOnFailure=True,
            logEnviron=False,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com\ethereum\go-ethereum\...",
            decodeRC={0:SUCCESS, -1:WARNINGS, 1:WARNINGS, 2:WARNINGS},
            env=env,
            maxTime=900
        )
    ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="zip",
                description='zipping',
                descriptionDone='zipped',
                command="%s geth.zip geth.exe" % zip_
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("Geth-Win64-%(kw:time_string)s-%(prop:version)s-%(prop:protocol)s-%(kw:short_revision)s.zip", time_string=get_time_string, short_revision=get_short_revision_go)
            ),
            FileUpload(
                haltOnFailure = True,
                name = 'upload',
                slavesrc="geth.zip",
                masterdest = Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url = Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name = "clean-latest-link",
                description = 'cleaning latest link',
                descriptionDone= 'clean latest link',
                command = ['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/Geth-Win64-latest.zip")]
            ),
            MasterShellCommand(
                haltOnFailure = True,
                name = "link-latest",
                description = 'linking latest',
                descriptionDone= 'link latest',
                command = ['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/Geth-Win64-latest.zip")]
            )
        ]: factory.addStep(step)

    if not isPullRequest and not headless:
        for step in [
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name = "go-build",
                description = 'go build',
                descriptionDone = 'go build',
                command = ['build.bat'],
                workdir = 'go-build-%s\windows' % branch,
                decodeRC = {0:SUCCESS,1:WARNINGS,2:WARNINGS},
                env={"GOPATH": Interpolate("%(prop:workdir)s\\go")}
            ),
            SetPropertyFromCommand(
                haltOnFailure = True,
                logEnviron = False,
                name = "set-sha1sum",
                command = Interpolate('sha1sum %(prop:workdir)s\\go\\pkg\\ethereum\\mist.exe | grep -o -w "\w\{40\}"'),
                property = 'sha1sum'
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("Mist-Windows-%(kw:time_string)s-%(prop:version)s-%(prop:protocol)s-%(kw:short_revision)s.exe", time_string=get_time_string, short_revision=get_short_revision_go)
            ),
            FileUpload(
                haltOnFailure = True,
                name = 'upload-mist',
                slavesrc=Interpolate("%(prop:workdir)s\\go\\pkg\\ethereum\\mist.exe"),
                masterdest = Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url = Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name = "clean-latest-link",
                description = 'cleaning latest link',
                descriptionDone= 'clean latest link',
                command = ['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/Mist-Windows-latest.exe")]
            ),
            MasterShellCommand(
                haltOnFailure = True,
                name = "link-latest",
                description = 'linking latest',
                descriptionDone= 'link latest',
                command = ['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/Mist-Windows-latest.exe")]
            )
        ]: factory.addStep(step)

    return factory
Exemple #15
0
def deb_factory(name=None,
                repourl=None,
                ppabranch=None,
                branch='master',
                distribution='trusty',
                architecture='i386',
                testdeb=False):
    factory = BuildFactory()

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl=repourl,
                branch=branch,
                mode='full',
                method='copy',
                retry=(5, 3)),

            # Set snapshot property for Launchpad versioning
            SetProperty(
                description="setting snapshot",
                descriptionDone="set snapshot",
                name="set-snapshot",
                property="snapshot",
                value=Interpolate(
                    "+%(prop:buildnumber)s%(kw:snapshot)s%(kw:distribution)s",
                    snapshot=(dev_snapshot
                              if branch == 'develop' or testdeb else ""),
                    distribution=distribution))
    ]:
        factory.addStep(step)

    # Run 'go get' for go-ethereum
    if name == 'ethereum':
        for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="move-src",
                    command=_go_cmds(branch=branch),
                    description="moving src",
                    descriptionDone="move src",
                    env={"GOPATH": Interpolate("%(prop:workdir)s/go")}),
                ShellCommand(
                    logEnviron=False,
                    name="source-tarball",
                    description="creating source tarball",
                    descriptionDone="create source tarball",
                    command=Interpolate(
                        "tar --exclude .git --exclude pkg --exclude bin -czf "
                        "../%(kw:name)s_%(prop:version)s%(prop:snapshot)s.orig.tar.gz .",
                        name=name),
                    workdir=Interpolate("%(prop:workdir)s/go")),
                # clean up the Git checkout for debuild
                ShellCommand(logEnviron=False,
                             name="clean-build",
                             command="rm -rf build && mkdir build",
                             description="cleaning build",
                             descriptionDone="clean build",
                             workdir=Interpolate("%(prop:workdir)s"))
        ]:
            factory.addStep(step)
    # Get qtwebengine-opensource-src tarball
    elif name == 'qtwebengine-opensource-src':
        for step in [
                ShellCommand(
                    logEnviron=False,
                    name="source-tarball",
                    description="getting source tarball",
                    descriptionDone="get source tarball",
                    command=Interpolate(
                        "wget -c https://download.qt.io/official_releases/qt/5.4/%(kw:version)s/submodules/"
                        "qtwebengine-opensource-src-%(kw:version)s.tar.xz "
                        "-O ../%(kw:name)s_%(prop:version)s%(prop:snapshot)s.orig.tar.xz",
                        name=name,
                        version=branch)),
                # clean up the Git checkout for debuild
                ShellCommand(logEnviron=False,
                             name="clean-build",
                             command="rm -rf build && mkdir build",
                             description="cleaning build",
                             descriptionDone="clean build",
                             workdir=Interpolate("%(prop:workdir)s"))
        ]:
            factory.addStep(step)
    # Just create the source tarball for others
    else:
        factory.addStep(
            ShellCommand(
                logEnviron=False,
                name="source-tarball",
                description="creating source tarball",
                descriptionDone="create source tarball",
                command=Interpolate(
                    "tar --exclude .git -czf "
                    "../%(kw:name)s_%(kw:version)s%(prop:snapshot)s.orig.tar.gz .",
                    name=name,
                    version=deb_version)))

    for step in [
            # Get debian/ directory
            ShellCommand(
                logEnviron=False,
                name="get-debian",
                description="getting debian folder",
                descriptionDone="get debian folder",
                command=Interpolate(
                    "wget https://github.com/ethereum/ethereum-ppa/archive/%(kw:ppabranch)s.tar.gz -O- |"
                    " tar -zx --exclude package.sh --exclude README.md --strip-components=1",
                    ppabranch=ppabranch)),

            # Bump version
            ShellCommand(
                logEnviron=False,
                name="bump-debian",
                description="bumping %s deb version" % distribution,
                descriptionDone="bump %s deb version" % distribution,
                command=Interpolate(
                    "EMAIL='caktux (Buildserver key) <*****@*****.**>' "
                    "dch -v %(prop:version)s%(prop:snapshot)s-0ubuntu1 "
                    "'git build of %(prop:got_revision)s'",
                    dist=distribution)),

            # Build a source package
            ShellCommand(logEnviron=False,
                         name="source-package",
                         description="debuilding %s" % distribution,
                         descriptionDone="debuild %s" % distribution,
                         command="debuild -S -sa -us -uc"),
    ]:
        factory.addStep(step)

    # Source only packages for dependencies, build local deb packages otherwise
    if name in ['ethereum', 'cpp-ethereum']:
        # Add pbuilderrc with ccache config
        # factory.addStep(FileDownload(
        #     mastersrc="pbuilderrc",
        #     slavedest="~/.pbuilderrc"
        # ))
        main_ppa = "http://ppa.launchpad.net/ethereum/ethereum/ubuntu"
        dev_ppa = "http://ppa.launchpad.net/ethereum/ethereum-dev/ubuntu"
        qt_ppa = "http://ppa.launchpad.net/ethereum/ethereum-qt/ubuntu"

        if name is not 'ethereum' or distribution is not 'wily':
            for step in [
                    # Set PPA dependencies for pbuilder
                    ShellCommand(
                        logEnviron=False,
                        name="pbuilder-opts",
                        description="setting pbuilderrc",
                        descriptionDone="set pbuilderrc",
                        command="echo 'OTHERMIRROR=\""
                        "deb [trusted=yes] {1} {0} main|deb-src [trusted=yes] {1} {0} main|"
                        "deb [trusted=yes] {2} {0} main|deb-src [trusted=yes] {2} {0} main|"
                        "deb [trusted=yes] {3} {0} main|deb-src [trusted=yes] {3} {0} main\"' > ~/.pbuilderrc"
                        .format(distribution, main_ppa, dev_ppa, qt_ppa))
            ]:
                factory.addStep(step)

        for step in [
                # Package that thing already
                UbuCowbuilder(
                    logEnviron=False,
                    architecture=architecture,
                    distribution=distribution,
                    basetgz="/var/cache/pbuilder/%s-%s-ethereum.cow" %
                    (distribution, architecture),
                    keyring="/usr/share/keyrings/ubuntu-archive-keyring.gpg")
        ]:
            factory.addStep(step)

    for step in [
            # Run Lintian
            # DebLintian(
            #     fileloc=Interpolate("%(prop:deb-changes)s")
            # ),
            # Prepare .changes file for Launchpad
            ShellCommand(name='prepare-changes',
                         description='preparing changes',
                         descriptionDone='prepare changes',
                         command=Interpolate(
                             "sed -i -e s/UNRELEASED/%(kw:dist)s/ "
                             "-e s/urgency=medium/urgency=low/ ../*.changes",
                             dist=distribution)),

            # Gather artefacts
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="move-packages",
                description='moving packages',
                descriptionDone='move packages',
                command=
                "mkdir result; mv %s../*.changes ../*.dsc ../*.gz %sresult/" %
                ("*.deb *.changes "
                 if name in ['ethereum', 'cpp-ethereum'] else "",
                 "../*.xz " if name == 'qtwebengine-opensource-src' else ""),
            ),

            # Upload result folder
            DirectoryUpload(
                slavesrc="result",
                masterdest=Interpolate(
                    "public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"
                ),
                url=Interpolate(
                    "/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
            ),

            # Clean latest link
            MasterShellCommand(
                name='clean-latest',
                description='cleaning latest link',
                descriptionDone='clean latest link',
                command=[
                    'rm', '-f',
                    Interpolate(
                        "public_html/builds/%(prop:buildername)s/latest")
                ]),

            # Link latest
            MasterShellCommand(
                name='link-latest',
                description='linking latest',
                descriptionDone='link latest',
                command=[
                    'ln', '-sf',
                    Interpolate("%(prop:buildnumber)s"),
                    Interpolate(
                        "public_html/builds/%(prop:buildername)s/latest")
                ]),

            # Create source changes folders
            MasterShellCommand(
                name='mkdir-changes',
                description='mkdir',
                descriptionDone='mkdir',
                command=[
                    'mkdir', '-p',
                    Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s",
                                dist=distribution,
                                arch=architecture,
                                name=name)
                ]),

            # Link source changes
            MasterShellCommand(
                name='link-changes',
                description='linking changes',
                descriptionDone='link changes',
                command=[
                    'ln', '-sf',
                    Interpolate(
                        "../../../../public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"
                    ),
                    Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s",
                                dist=distribution,
                                arch=architecture,
                                name=name)
                ])
    ]:
        factory.addStep(step)

    # Use ethereum-dev ppa for snapshots, only dput one source pkg
    ppa_suffix = ""
    if branch == 'develop' or (name == 'libjson-rpc-cpp'
                               and jsonrpc_for_develop):
        ppa_suffix = "-dev"
    elif name == 'qtwebengine-opensource-src':
        ppa_suffix = "-qt"

    if architecture == 'amd64':
        for step in [
                # debsign
                MasterShellCommand(
                    haltOnFailure=False,
                    flunkOnFailure=False,
                    name='debsign',
                    description='debsigning',
                    descriptionDone='debsign',
                    command=[
                        'debsign',
                        Interpolate(
                            "changes/%(kw:dist)s/%(kw:arch)s/"
                            "%(kw:name)s/%(prop:buildnumber)s/"
                            "%(kw:name)s_%(kw:version)s%(prop:snapshot)s-"
                            "0ubuntu1_source.changes",
                            dist=distribution,
                            arch=architecture,
                            name=name,
                            version=deb_version)
                    ]),
                # dput
                MasterShellCommand(
                    name='dput',
                    description='dputting',
                    descriptionDone='dput',
                    command=[
                        'dput',
                        'ppa:%s%s' %
                        ("caktux/ppa" if testdeb else "ethereum/ethereum",
                         ppa_suffix),
                        Interpolate(
                            "changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/"
                            "%(prop:buildnumber)s/%(kw:name)s_%(kw:version)s%(prop:snapshot)s-"
                            "0ubuntu1_source.changes",
                            dist=distribution,
                            arch=architecture,
                            name=name,
                            version=deb_version)
                    ])
        ]:
            factory.addStep(step)

    return factory
def arm_go_factory(branch="develop", isPullRequest=False):
    factory = BuildFactory()

    env = {
        "GOPATH": Interpolate("%(prop:workdir)s/go:%(prop:workdir)s/build/Godeps/_workspace"),
        "CC": "arm-linux-gnueabi-gcc",
        "GOOS": "linux",
        "GOARCH": "arm",
        "CGO_ENABLED": "1",
        "GOARM": "5",
        "PATH": [Interpolate("%(prop:workdir)s/go/bin"), "${PATH}"],
    }

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl="https://github.com/ethereum/go-ethereum.git",
            branch=branch,
            mode="full",
            method="copy",
            codebase="go-ethereum",
            retry=(5, 3),
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
            property="version",
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command=Interpolate("rm -rf %(prop:workdir)s/go"),
            description="cleaning up",
            descriptionDone="clean up",
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")},
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            command=_go_cmds(branch=branch),
            description="moving src",
            descriptionDone="move src",
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")},
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="build-geth",
            description="building geth",
            descriptionDone="build geth",
            command="go build -v github.com/ethereum/go-ethereum/cmd/geth",
            env=env,
        ),
    ]:
        factory.addStep(step)

    # for step in [
    #     ShellCommand(
    #         haltOnFailure=True,
    #         name="go-test",
    #         description="go testing",
    #         descriptionDone="go test",
    #         command="go test github.com/ethereum/go-ethereum/...",
    #         env=env,
    #         maxTime=900
    #     )
    # ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="tar-geth",
                description="packing",
                descriptionDone="pack",
                command=["tar", "-cjf", "geth.tar.bz2", "geth"],
            ),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-sha256sum",
                command=Interpolate('sha256sum geth.tar.bz2 | grep -o -w "\w\{64\}"'),
                property="sha256sum",
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate(
                    "geth-ARM-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.tar.bz2",
                    time_string=get_time_string,
                    short_revision=get_short_revision_go,
                ),
            ),
            FileUpload(
                haltOnFailure=True,
                name="upload-geth",
                slavesrc="geth.tar.bz2",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s"),
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description="cleaning latest link",
                descriptionDone="clean latest link",
                command=["rm", "-f", Interpolate("public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2")],
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description="linking latest",
                descriptionDone="link latest",
                command=[
                    "ln",
                    "-sf",
                    Interpolate("%(prop:filename)s"),
                    Interpolate("public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2"),
                ],
            ),
        ]:
            factory.addStep(step)

    return factory
Exemple #17
0
def go_ethereum_factory(branch='master', deb=False):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command="rm -rf $GOPATH",
            description="cleaning up",
            descriptionDone="clean up"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            command=_go_cmds(branch=branch),
            description="moving src",
            descriptionDone="move src"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="install-geth",
            description="installing geth",
            descriptionDone="install geth",
            command="go install -v github.com/ethereum/go-ethereum/cmd/geth",
            env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")}
        )
    ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com/ethereum/go-ethereum/...",
            env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")},
            maxTime=900
        )
    ]: factory.addStep(step)

    if deb:
        for architecture in ['i386', 'amd64']:
            for distribution in distributions:
                for step in [
                    Trigger(
                        schedulerNames=["go-ethereum-%s-%s-%s" % (branch, architecture, distribution)],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s")
                        }
                    )
                ]: factory.addStep(step)

    return factory
def brew_go_factory(branch='develop'):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/homebrew-ethereum.git',
            branch='master',
            mode='incremental',
            codebase='homebrew-ethereum',
            retry=(5, 3),
            workdir='brew'
        )
    ]: factory.addStep(step)

    if branch == 'master':
        factory.addStep(ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-version",
            descriptionDone='update go-ethereum version',
            command=Interpolate('sed -i "" "s/^  version \'\(.*\)\'/  version \'%(prop:version)s\'/" ethereum.rb'),
            workdir='brew',
        ))
    elif branch == 'develop':
        factory.addStep(ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-version",
            descriptionDone='update go-ethereum version',
            command=Interpolate('sed -i "" "s/^    version \'\(.*\)\'/    version \'%(prop:version)s\'/" ethereum.rb'),
            workdir='brew',
        ))

    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="cleanup",
            description='cleanup',
            descriptionDone='clean',
            command=["brew", "remove", "ethereum"],
            workdir='brew',
            decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
        ),
        Compile(
            haltOnFailure=True,
            logEnviron=False,
            name="brew",
            description='running brew',
            descriptionDone='brew',
            command=brew_install_cmd(cmd=['brew', 'install', 'ethereum.rb', '-v', '--build-bottle'], branch=branch),
            workdir='brew'
        )
    ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="bottle",
            command=brew_install_cmd(cmd=["brew", "bottle", "ethereum.rb", "-v"], branch=branch),
            description="bottling",
            descriptionDone="bottle",
            workdir='brew'
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-old-revision",
            command='sed -ne "s/^%s    revision \(.*\)/\\1/p" ethereum.rb' % ("" if branch == 'master' else "  "),
            property='old_revision',
            workdir='brew'
        ),
        SetProperty(
            name="set-bottle",
            description="setting bottle",
            descriptionDone="set bottle",
            property="bottle",
            value=Interpolate("ethereum-%(prop:version)s.yosemite.bottle.tar.gz")
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-sha1sum",
            command=Interpolate('sha1sum %(prop:bottle)s | grep -o -w "\w\{40\}"'),
            property='sha1sum',
            workdir='brew'
        ),
        FileUpload(
            haltOnFailure=True,
            name='upload-bottle',
            slavesrc=Interpolate("%(prop:bottle)s"),
            masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s/bottle/"
                                   "ethereum-%(prop:version)s.yosemite.bottle.%(prop:buildnumber)s.tar.gz"),
            url=Interpolate("/builds/%(prop:buildername)s/%(prop:buildnumber)s/bottle/"
                            "ethereum-%(prop:version)s.yosemite.bottle.%(prop:buildnumber)s.tar.gz"),
            workdir='brew'
        )
    ]: factory.addStep(step)

    if branch == 'master':
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-bottle-url",
                descriptionDone='update bottle url',
                command=Interpolate('sed -i "" "s/^    root_url \'\(.*\)\'/    root_url \'https:\/\/build.ethdev.com\/builds\/'
                                    '%(kw:urlbuildername)s\/%(prop:buildnumber)s\/bottle\'/" ethereum.rb', urlbuildername=urlbuildername),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-brew-revision",
                descriptionDone='update brew revision',
                command=Interpolate('sed -i "" "s/^    revision \(.*\)/    revision %(prop:buildnumber)s/" ethereum.rb'),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-sha1sum",
                descriptionDone='update sha1sum',
                command=Interpolate('sed -i "" "s/^    sha1 \'\(.*\)\' => :yosemite/    sha1 \'%(prop:sha1sum)s\' => :yosemite/" ethereum.rb'),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add ethereum.rb',
                workdir='brew'
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "bump ethereum to %(prop:version)s at ethereum/go-ethereum@%(kw:go_revision)s"',
                                    go_revision=get_short_revision_go),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            )
        ]: factory.addStep(step)

    elif branch == 'develop':
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-bottle-url",
                descriptionDone='update bottle url',
                command=Interpolate('sed -i "" "s/^      root_url \'\(.*\)\'/      root_url \'https:\/\/build.ethdev.com\/builds\/%(kw:urlbuildername)s\/'
                                    '%(prop:buildnumber)s\/bottle\'/" ethereum.rb', urlbuildername=urlbuildername),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-brew-revision",
                descriptionDone='update brew revision',
                command=Interpolate('sed -i "" "s/^      revision \(.*\)/      revision %(prop:buildnumber)s/" ethereum.rb'),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-sha1sum",
                descriptionDone='update sha1sum',
                command=Interpolate('sed -i "" "s/^      sha1 \'\(.*\)\' => :yosemite/      sha1 \'%(prop:sha1sum)s\' => :yosemite/" ethereum.rb'),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add ethereum.rb',
                workdir='brew'
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "bump ethereum to %(prop:version)s at ethereum/go-ethereum@%(kw:go_revision)s"',
                                    go_revision=get_short_revision_go),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            )
        ]: factory.addStep(step)

    return factory
def integration_factory():
    factory = BuildFactory()

    test_files = ['catalog', 'integration']
    user_test_files = ['integration-user']
    min_coverage = 80

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch='develop',
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/ethereum.js.git',
            branch='develop',
            mode='incremental',
            codebase='ethereumjs',
            retry=(5, 3),
            workdir="ethereumjs"
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/etherex/etherex.git',
            branch='master',
            mode='incremental',
            codebase='integration',
            retry=(5, 3),
            workdir="integration"
        ),
        Configure(
            haltOnFailure=True,
            logEnviron=False,
            command=["cmake", ".", "-DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++"],
            env={"PATH": "${QTDIR}/bin:${PATH}"}
        ),
        Compile(
            haltOnFailure=True,
            logEnviron=False,
            command="make -j $(cat /proc/cpuinfo | grep processor | wc -l)"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-install",
            description="installing",
            descriptionDone="install",
            command=["make", "install"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="ldconfig",
            description="running ldconfig",
            descriptionDone="ldconfig",
            command=["ldconfig"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="test-requirements",
            description="installing test requirements",
            descriptionDone="install test requirements",
            command=["pip", "install", "-r", "dev_requirements.txt"],
            workdir="integration"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="upgrade-requirements",
            description="upgrading test requirements",
            descriptionDone="upgrade test requirements",
            command=["pip", "install", "--upgrade", "--no-deps", "-r", "dev_requirements.txt"],
            workdir="integration"
        ),
        Test(
            flunkOnFailure=False,
            logEnviron=False,
            description="py.testing",
            descriptionDone="py.test",
            name="py.test",
            command=["py.test", "-vvrs"],
            workdir="integration"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="npm-install",
            description="npm installing",
            descriptionDone="npm install",
            command=["npm", "install"],
            workdir="ethereumjs"
        ),
        Test(
            flunkOnFailure=False,
            logEnviron=False,
            description="npm testing",
            descriptionDone="npm test",
            name="npm-test",
            command=["npm", "test"],
            workdir="ethereumjs"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="clean-chain",
            description="cleaning up",
            descriptionDone="clean chain",
            command=["rm", "-rf", ".ethereum_eth"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="clean-up",
            description="cleaning up",
            descriptionDone="clean up",
            command="rm -rf screenshots && rm -rf report && rm -f *.pyc",
            workdir="integration/tests"
        ),
        FileDownload(
            haltOnFailure=True,
            descriptionDone="download init script",
            mastersrc="startup/eth-supervisord-integration.conf",
            slavedest="eth-supervisord-integration.conf"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="start-eth",
            description="starting eth",
            descriptionDone="start eth",
            command="supervisord -c eth-supervisord-integration.conf && sleep 5",
            logfiles={
                "eth.log": "eth.log",
                "eth.err": "eth.err",
                "supervisord.log": "eth-supervisord.log"
            },
            lazylogfiles=True
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="pyepm-deploy",
            description="deploying",
            descriptionDone="deploy",
            command=["pyepm", "contracts/EtherEx.yaml"],
            workdir="integration",
            maxTime=1200
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="get-address",
            description="getting address",
            descriptionDone="get address",
            command="curl -X POST --data '{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":null,\"id\":2}' http://localhost:8080 > address.json"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="parse-address",
            description="parsing address",
            descriptionDone="parse address",
            command="sed -ne 's/.*result\":\"\(.*\)\"}/\\1/p' address.json",
            property="address"
        ),
        FileDownload(
            haltOnFailure=True,
            descriptionDone="download transfer definitions",
            mastersrc="integration-transfer.yaml",
            slavedest="integration-transfer.yaml"
        ),
        ShellCommand(
            logEnviron=False,
            name='prepare-transfer',
            description='preparing transfer',
            descriptionDone='prepare transfer',
            command=Interpolate('sed -i -e s/address/%(prop:address)s/ integration-transfer.yaml')
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="fill-address",
            description="filling address",
            descriptionDone="fill address",
            command=["pyepm", "integration-transfer.yaml"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="stop-eth",
            description="stopping",
            descriptionDone="stop",
            command="kill `ps aux | grep 'eth-supervisord-integration.conf' | grep -v grep | awk '{print $2}'` && kill `pidof eth` && sleep 5",
            decodeRC={-1: SUCCESS, 0: SUCCESS, 1: WARNINGS, 2: WARNINGS},
            alwaysRun=True
        ),
        FileDownload(
            haltOnFailure=True,
            descriptionDone="download init script",
            mastersrc="startup/eth-supervisord-integration-test.conf",
            slavedest="eth-supervisord-integration-test.conf"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="start-eth-test",
            description="starting eth",
            descriptionDone="start eth",
            command="supervisord -c eth-supervisord-integration-test.conf && sleep 5",
            logfiles={
                "eth.log": "eth.log",
                "eth.err": "eth.err",
                "supervisord.log": "eth-supervisord.log"
            },
            lazylogfiles=True
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="create-folders",
            description="creating folders",
            descriptionDone="create folders",
            command=["mkdir", "-p", "report", "screenshots"],
            workdir="integration/tests"
        ),
        FileDownload(
            haltOnFailure=True,
            descriptionDone="download catalog test",
            mastersrc="tests/catalog.py",
            slavedest="tests/catalog.py",
            workdir="integration"
        ),
        XvfbNoseTest(test_files, min_coverage),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="stop-eth",
            description="stopping",
            descriptionDone="stop",
            command="kill `ps aux | grep 'eth-supervisord-integration-test.conf' | grep -v grep | awk '{print $2}'` && kill `pidof eth` && sleep 5",
            decodeRC={-1: SUCCESS, 0: SUCCESS, 1: WARNINGS, 2: WARNINGS},
            alwaysRun=True
        ),
        FileDownload(
            haltOnFailure=True,
            descriptionDone="download init script",
            mastersrc="startup/eth-supervisord-integration-user.conf",
            slavedest="eth-supervisord-integration-user.conf"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="start-eth-user",
            description="starting eth",
            descriptionDone="start eth",
            command="supervisord -c eth-supervisord-integration-user.conf && sleep 5",
            logfiles={
                "eth.log": "eth.log",
                "eth.err": "eth.err",
                "supervisord.log": "eth-supervisord.log"
            },
            lazylogfiles=True
        ),
        XvfbNoseTest(user_test_files, min_coverage, reportdir="enduser"),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="stop-final",
            description="stopping",
            descriptionDone="stop",
            command="kill `ps aux | grep 'eth-supervisord-integration-user.conf' | grep -v grep | awk '{print $2}'` && kill `pidof eth` && sleep 5",
            decodeRC={-1: SUCCESS, 0: SUCCESS, 1: WARNINGS, 2: WARNINGS},
            alwaysRun=True
        ),
        ShellCommand(
            haltOnFailure=False,
            flunkOnFailure=False,
            warnOnFailure=True,
            logEnviron=False,
            name="move-screenshots",
            description="moving screenshots",
            descriptionDone="move screenshots",
            command="mv *.png screenshots/",
            workdir="integration/tests"
        ),
        # Upload screenshots
        DirectoryUpload(
            name='upload-screenshots',
            compress='gz',
            slavesrc="screenshots",
            masterdest=Interpolate("public_html/reports/%(prop:buildername)s/%(prop:buildnumber)s/screenshots"),
            url=Interpolate("/reports/%(prop:buildername)s/%(prop:buildnumber)s/screenshots/"),
            workdir="integration/tests"
        ),
        # Upload HTML and coverage report
        DirectoryUpload(
            name='upload-reports',
            compress='gz',
            slavesrc="report",
            masterdest=Interpolate("public_html/reports/%(prop:buildername)s/%(prop:buildnumber)s/report"),
            url=Interpolate("/reports/%(prop:buildername)s/%(prop:buildnumber)s/report/"),
            workdir="integration/tests"
        )
    ]: factory.addStep(step)

    return factory
def buildslave_factory(lang="cpp", client="cpp-ethereum"):
    factory = BuildFactory()

    # Build base image
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/ethereum-dockers.git',
            mode='incremental',
            codebase='ethereum-dockers',
            retry=(5, 3)
        ),
        ShellCommand(
            flunkOnFailure=False,
            logEnviron=False,
            name="cleanup-containers",
            description="cleaning up containers",
            descriptionDone="clean up containers",
            command="docker rm $(docker ps -a -q)",
            decodeRC={0: SUCCESS, 1: WARNINGS, 123: WARNINGS}
        ),
        ShellCommand(
            flunkOnFailure=False,
            logEnviron=False,
            name="cleanup-images",
            description="cleaning up images",
            descriptionDone="clean up images",
            command="docker rmi $(docker images -f 'dangling=true' -q)",
            decodeRC={0: SUCCESS, 1: WARNINGS, 123: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="docker-%s" % lang,
            description="building %s base" % lang,
            descriptionDone="build %s base" % lang,
            command=["docker", "build", "--no-cache", "-t", "cptobvious/%s-base" % client, "%s-base" % client],
            timeout=1800
        ),
        # ShellCommand(
        #     logEnviron=False,
        #     name="docker-%s-push" % lang,
        #     command=["docker", "push", "cptobvious/%s-base" % client],
        #     warnOnFailure=True,
        #     decodeRC={0: SUCCESS, 1: WARNINGS}
        # ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="last-container",
            command="docker ps -a | grep buildslave-%s | awk '{print $1}'" % lang,
            property="last-container"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="buildslave-%s" % lang,
            description="building %s buildslave" % lang,
            descriptionDone="build %s buildslave" % lang,
            command=["docker", "build", "--no-cache", "-t", "cptobvious/buildslave-%s" % lang, "%s-buildslave" % client],
            timeout=1800
        )
    ]: factory.addStep(step)

    # Build develop buildslave
    if lang in ['cpp', 'go']:
        for step in [
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-develop" % lang,
                description="building %s develop buildslave" % lang,
                descriptionDone="build %s develop buildslave" % lang,
                command=["docker", "build", "--no-cache", "-t", "cptobvious/buildslave-%s-develop" % lang, "%s-buildslave-develop" % client],
                timeout=1800
            )
        ]: factory.addStep(step)

    # Build deb packaging buildslave
    if lang in ['cpp', 'go']:
        factory.addStep(
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-deb" % lang,
                description="building %s deb buildslave" % lang,
                descriptionDone="build %s deb buildslave" % lang,
                command=["docker", "build", "--no-cache", "-t", "cptobvious/buildslave-%s-deb" % lang, "%s-buildslave-deb" % client]
            ))

    # Build integration buildslave
    if lang in ['cpp']:
        factory.addStep(
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-integration" % lang,
                description="building %s integration buildslave" % lang,
                descriptionDone="build %s integration buildslave" % lang,
                command=["docker", "build", "--no-cache", "-t", "cptobvious/buildslave-%s-integration" % lang, "%s-buildslave-integration" % client]
            ))

    # Build ARM buildslave
    if lang in ['go']:
        factory.addStep(
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-arm" % lang,
                description="building %s ARM buildslave" % lang,
                descriptionDone="build %s ARM buildslave" % lang,
                command=["docker", "build", "--no-cache", "-t", "cptobvious/buildslave-%s-arm" % lang, "%s-buildslave-arm" % client]
            ))

    # Build pull request buildslave
    for step in [
        ShellCommand(
            warnOnFailure=True,
            logEnviron=False,
            name="buildslave-%s-pr" % lang,
            description="building %s pr buildslave" % lang,
            descriptionDone="build %s pr buildslave" % lang,
            command=["docker", "build", "--no-cache", "-t", "cptobvious/buildslave-%s-pr" % lang, "%s-buildslave-pr" % client]
        )
    ]: factory.addStep(step)

    #
    # Stop containers and run new ones
    #
    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="buildslave-%s-stop" % lang,
            description="stopping %s buildslave" % lang,
            descriptionDone="stop %s buildslave" % lang,
            command=_buildslave_stop_cmd,
            decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="buildslave-%s-run" % lang,
            description="starting %s buildslave" % lang,
            descriptionDone="start %s buildslave" % lang,
            command=["docker", "run", "--restart", "always", "-d", "-t", "cptobvious/buildslave-%s" % lang]
        ),
        ShellCommand(
            warnOnFailure=True,
            logEnviron=False,
            name="buildslave-%s-pr-run" % lang,
            description="starting %s pr buildslave" % lang,
            descriptionDone="start %s pr buildslave" % lang,
            command=["docker", "run", "--restart", "always", "-d", "-t", "cptobvious/buildslave-%s-pr" % lang]
        )
    ]: factory.addStep(step)

    # Run develop buildslave
    if lang in ['cpp', 'go']:
        for step in [
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-develop-run" % lang,
                description="starting %s develop buildslave" % lang,
                descriptionDone="start %s develop buildslave" % lang,
                command=["docker", "run", "--restart", "always", "-d", "-t", "cptobvious/buildslave-%s-develop" % lang]
            )
        ]: factory.addStep(step)

    # Run deb packaging buildslave
    if lang in ['cpp', 'go']:
        for step in [
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-deb-run" % lang,
                description="starting %s deb buildslave" % lang,
                descriptionDone="start %s deb buildslave" % lang,
                command=["docker", "run", "--restart", "always", "-d", "--privileged=true", "-t", "cptobvious/buildslave-%s-deb" % lang]
            )
        ]: factory.addStep(step)

    # Run integration buildslave
    if lang in ['cpp']:
        for step in [
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-integration-run" % lang,
                description="starting %s integration buildslave" % lang,
                descriptionDone="start %s integration buildslave" % lang,
                command=["docker", "run", "--restart", "always", "-d", "-t", "cptobvious/buildslave-%s-integration" % lang]
            )
        ]: factory.addStep(step)

    # Run ARM buildslave
    if lang in ['go']:
        for step in [
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-arm-run" % lang,
                description="starting %s ARM buildslave" % lang,
                descriptionDone="start %s ARM buildslave" % lang,
                command=["docker", "run", "--restart", "always", "-d", "-t", "cptobvious/buildslave-%s-arm" % lang]
            )
        ]: factory.addStep(step)

    return factory
Exemple #21
0
def mist_factory(branch='master', isPullRequest=False):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/mist.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='mist',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/.*\\"version\\": \\"\([0-9]*\.[0-9]*\.[0-9]*\)\\".*/\\1/p" package.json',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="npm-install",
            command=["npm", "install"],
            description="npm installing",
            descriptionDone="npm install"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="gulp-mist",
            command=["gulp", "mist"],
            description="gulping mist",
            descriptionDone="gulp mist"
        )
    ]: factory.addStep(step)

    if not isPullRequest:
        for arch in osVersions:
            for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="pack-mist-%s" % arch,
                    description='packing %s' % arch,
                    descriptionDone='pack %s' % arch,
                    command=['zip' if arch.startswith('win') else 'tar',
                             '-r' if arch.startswith('win') else '-cjf',
                             Interpolate("Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                         arch=arch,
                                         short_revision=get_short_revision_mist,
                                         ext='zip' if arch.startswith('win') else 'tar.bz2'),
                             Interpolate('Mist-%(kw:arch)s-%(kw:folder_version)s',
                                         arch=arch,
                                         folder_version=folder_version)],
                    workdir='build/dist_mist'
                ),
                SetPropertyFromCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="sha256sum-%s" % arch,
                    command=Interpolate('sha256sum Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s | grep -o -w "\w\{64\}"',
                                        arch=arch,
                                        short_revision=get_short_revision_mist,
                                        ext='zip' if arch.startswith('win') else 'tar.bz2'),
                    property='sha256sum-%s' % arch,
                    workdir='build/dist_mist'
                ),
                FileUpload(
                    haltOnFailure=True,
                    name='upload-mist-%s' % arch,
                    slavesrc=Interpolate("dist_mist/Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                         arch=arch,
                                         short_revision=get_short_revision_mist,
                                         ext='zip' if arch.startswith('win') else 'tar.bz2'),
                    masterdest=Interpolate("public_html/builds/%(prop:buildername)s/Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                           arch=arch,
                                           short_revision=get_short_revision_mist,
                                           ext='zip' if arch.startswith('win') else 'tar.bz2'),
                    url=Interpolate("/builds/%(prop:buildername)s/Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                    arch=arch,
                                    short_revision=get_short_revision_mist,
                                    ext='zip' if arch.startswith('win') else 'tar.bz2')
                ),
                MasterShellCommand(
                    name="clean-latest-link-%s" % arch,
                    description='cleaning latest link %s' % arch,
                    descriptionDone='clean latest link %s' % arch,
                    command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/Mist-%(kw:arch)s-latest.%(kw:ext)s",
                                                     arch=arch,
                                                     ext='zip' if arch.startswith('win') else 'tar.bz2')]
                ),
                MasterShellCommand(
                    haltOnFailure=True,
                    name="link-latest-%s" % arch,
                    description='linking latest %s' % arch,
                    descriptionDone='link latest %s' % arch,
                    command=['ln', '-sf',
                             Interpolate("Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                         arch=arch,
                                         short_revision=get_short_revision_mist,
                                         ext='zip' if arch.startswith('win') else 'tar.bz2'),
                             Interpolate("public_html/builds/%(prop:buildername)s/Mist-%(kw:arch)s-latest.%(kw:ext)s",
                                         arch=arch,
                                         ext='zip' if arch.startswith('win') else 'tar.bz2')]
                )
            ]: factory.addStep(step)

    return factory
def backport_factory(name=None, distribution='trusty', architecture='amd64'):
    factory = BuildFactory()

    packages = [
        "harfbuzz",
        "qtbase-opensource-src",
        "qtxmlpatterns-opensource-src",
        "qtdeclarative-opensource-src",
        "qtscript-opensource-src",
        "qtwebsockets-opensource-src",
        "qtwebkit-opensource-src",
        "qttools-opensource-src",
        "qtquick1-opensource-src",
        "qtquickcontrols-opensource-src",
        "qtlocation-opensource-src"
    ]

    if distribution == 'trusty':
        packages.append("libinput")

    for package in packages:
        for step in [
            # Create backport
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="backport-%s" % package,
                description='backporting %s' % package,
                descriptionDone='backport %s' % package,
                command=["backportpackage", "--dont-sign", "-w", "result", "-d", distribution, package],
                env={
                    "DEBFULLNAME": "caktux (Buildserver key)",
                    "DEBEMAIL": "*****@*****.**",
                    "UBUMAIL": "*****@*****.**"
                }
            )
        ]: factory.addStep(step)

    for step in [
        # Prepare .changes file for Launchpad
        ShellCommand(
            name='prepare-changes',
            description='preparing changes',
            descriptionDone='prepare changes',
            command=Interpolate('sed -i -e s/%(kw:dist)s-backports/%(kw:dist)s/ -e s/urgency=medium/urgency=low/ *.changes', dist=distribution),
            workdir="build/result"
        ),
        # Upload result folder
        DirectoryUpload(
            slavesrc="result",
            masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
            url=Interpolate("/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
        ),
        # Clean latest link
        MasterShellCommand(
            name='clean-latest',
            description='cleaning latest link',
            descriptionDone='clean latest link',
            command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),
        # Link latest
        MasterShellCommand(
            name='link-latest',
            description='linking latest',
            descriptionDone='link latest',
            command=['ln', '-sf', Interpolate("%(prop:buildnumber)s"), Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),
        # Create source changes folders
        MasterShellCommand(
            name='mkdir-changes',
            description='mkdir',
            descriptionDone='mkdir',
            command=['mkdir', '-p', Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s", dist=distribution, arch=architecture, name=name)]
        ),
        # Link source changes
        MasterShellCommand(
            name='link-changes',
            description='linking changes',
            descriptionDone='link changes',
            command=['ln', '-sf', Interpolate("../../../../public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
                     Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s",
                     dist=distribution, arch=architecture, name=name)]
        ),
        # debsign
        MasterShellCommand(
            haltOnFailure=False,
            flunkOnFailure=False,
            name='debsign',
            description='debsigning',
            descriptionDone='debsign',
            command=Interpolate("debsign changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/*.changes",
                                dist=distribution, arch=architecture, name=name)
        ),
        # dput
        MasterShellCommand(
            name='dput',
            description='dputting',
            descriptionDone='dput',
            command=Interpolate("dput ppa:ethereum/ethereum-qt changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/*.changes",
                                dist=distribution, arch=architecture, name=name)
        )
    ]: factory.addStep(step)

    return factory
Exemple #23
0
def serpent_factory(branch='develop'):
    factory = BuildFactory()
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/serpent.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='serpent',
                retry=(5, 3)),
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/pyethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='pyethereum',
                retry=(5, 3),
                workdir='pyethereum'),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="pip-install",
                         description="installing",
                         descriptionDone="install",
                         command=["pip", "install", "-e", "."]),
            SetPropertyFromCommand(haltOnFailure=True,
                                   logEnviron=False,
                                   name="serpent-version",
                                   command=["serpent", "-v"],
                                   property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="install-pyethereum",
                         description="installing pyethereum",
                         descriptionDone="install pyethereum",
                         command=["pip", "install", "-e", "."],
                         workdir="pyethereum"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="pyethereum-requirements",
                         description="installing pyethereum requirements",
                         descriptionDone="install pyethereum requirements",
                         command=[
                             "pip", "install", "--upgrade", "--no-deps", "-r",
                             "requirements.txt"
                         ],
                         workdir="pyethereum"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="pyethereum-dev-requirements",
                         description="installing pyethereum dev_requirements",
                         descriptionDone="install pyethereum dev_requirements",
                         command=[
                             "pip", "install", "--upgrade", "--no-deps", "-r",
                             "dev_requirements.txt"
                         ],
                         workdir="pyethereum"),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="test-submodule",
                descriptionDone="update test submodule",
                command=
                "git submodule init && git submodule update --recursive",
                workdir="pyethereum"),
            ShellCommand(flunkOnFailure=False,
                         logEnviron=False,
                         description="testing",
                         descriptionDone="py.test",
                         name="py.test",
                         command=["py.test"],
                         workdir="pyethereum")
    ]:
        factory.addStep(step)
    return factory
def osx_cpp_factory(branch='develop', isPullRequest=False, evmjit=False, headless=True):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl = 'https://github.com/ethereum/cpp-ethereum.git',
            branch = branch,
            mode = 'full',
            method = 'copy',
            codebase = 'cpp-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/tests.git',
            branch=branch,
            mode='incremental',
            codebase='tests',
            retry=(5, 3),
            workdir='tests'
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "set-protocol",
            command='sed -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore/Common%s.cpp' % ("Eth" if branch == 'master' else ""),
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "set-version",
            command='sed -ne "s/.*Version = \\"\(.*\)\\";/\\1/p" libdevcore/Common.cpp',
            property="version"
        ),
        Configure(
            haltOnFailure = True,
            logEnviron = False,
            command = cmake_osx_cmd(['cmake', '.'], evmjit=evmjit, headless=headless)
        ),
        Compile(
            haltOnFailure = True,
            logEnviron = False,
            command = "make -j $(sysctl -n hw.ncpu)"
        )
    ]: factory.addStep(step)

    if not headless:
        for step in [
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name = "make-install",
                description = 'running make install',
                descriptionDone= 'make install',
                command = ['make', 'install'],
                workdir = 'build/alethzero'
            ),
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name = "make-install-mix",
                description = 'running mix make install',
                descriptionDone= 'make install mix',
                command = ['make', 'install'],
                workdir = 'build/mix'
            )
        ]: factory.addStep(step)

    for step in [
        Test(
            haltOnFailure = True,
            warnOnFailure = True,
            logEnviron = False,
            name="test-cpp-strict",
            description="strict testing",
            descriptionDone="strict test",
            command=testeth_cmd(["./testeth", "-t", "devcrypto,jsonrpc,Solidity*"], evmjit=evmjit),
            env={'CTEST_OUTPUT_ON_FAILURE': '1', 'ETHEREUM_TEST_PATH': Interpolate('%(prop:workdir)s/tests')},
            workdir="build/test"
        ),
    ]: factory.addStep(step)

    # Trigger check
    if not evmjit and not headless:
        for step in [
            Trigger(
                schedulerNames=["cpp-ethereum-%s-osx-check" % branch],
                waitForFinish=False,
                set_properties={
                    "protocol": Interpolate("%(prop:protocol)s"),
                    "version": Interpolate("%(prop:version)s")
                }
            )
        ]: factory.addStep(step)

    # Trigger deb builders
    if not evmjit and headless:
        if not isPullRequest:
            for step in [
                Trigger(
                    schedulerNames=["cpp-ethereum-%s-brew" % branch],
                    waitForFinish=False,
                    set_properties={
                        "protocol": Interpolate("%(prop:protocol)s"),
                        "version": Interpolate("%(prop:version)s")
                    }
                )
            ]: factory.addStep(step)

    # Run all tests, warnings let the build pass, failures marks the build with warnings
    for step in [
        ShellCommand(
            flunkOnFailure = False,
            warnOnFailure = True,
            logEnviron = False,
            name="test-cpp",
            description="testing",
            descriptionDone="test",
            command=testeth_cmd(["./testeth"], evmjit=evmjit),
            env={'CTEST_OUTPUT_ON_FAILURE': '1', 'ETHEREUM_TEST_PATH': Interpolate('%(prop:workdir)s/tests')},
            workdir="build/test",
            decodeRC={0:SUCCESS, -1:WARNINGS, 1:WARNINGS, 201:WARNINGS},
            maxTime=900
        )
    ]: factory.addStep(step)

    # Package AlethZero.app
    if not isPullRequest and not headless:
        for step in [
            Compile(
                haltOnFailure = True,
                logEnviron = False,
                command = "make -j $(sysctl -n hw.ncpu) appdmg"
            ),
            SetPropertyFromCommand(
                haltOnFailure = True,
                logEnviron = False,
                name = "set-sha1sum",
                command = Interpolate('sha1sum Ethereum.dmg | grep -o -w "\w\{40\}"'),
                property = 'sha1sum'
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("AlethZero-OSX-%(kw:time_string)s-%(prop:version)s-%(prop:protocol)s-%(kw:short_revision)s.dmg", time_string=get_time_string, short_revision=get_short_revision)
            ),
            FileUpload(
                haltOnFailure = True,
                name = 'upload-alethzero',
                slavesrc="Ethereum.dmg",
                masterdest = Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url = Interpolate("builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name = "clean-latest-link",
                description = 'cleaning latest link',
                descriptionDone= 'clean latest link',
                command = ['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/AlethZero-OSX-latest.dmg")]
            ),
            MasterShellCommand(
                haltOnFailure = True,
                name = "link-latest",
                description = 'linking latest',
                descriptionDone= 'link latest',
                command = ['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/AlethZero-OSX-latest.dmg")]
            )
        ]: factory.addStep(step)

    return factory
def brew_cpp_factory(branch='develop', headless=True):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/homebrew-ethereum.git',
            branch='master',
            mode='incremental',
            codebase='homebrew-ethereum',
            retry=(5, 3),
            workdir='brew'
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-old-version",
            descriptionDone='set old version',
            command='sed -ne "s/^%s  version \'\(.*\)\'/\\1/p" cpp-ethereum.rb' % ("" if branch == 'master' else "  "),
            property='old_version',
            workdir='brew',
        )
    ]: factory.addStep(step)

    if headless:
        if branch == 'master':
            for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-version",
                    descriptionDone='update version',
                    command=Interpolate('sed -i "" "s/^  version \'\(.*\)\'/  version \'%(prop:version)s\'/" cpp-ethereum.rb'),
                    workdir='brew',
                )
            ]: factory.addStep(step)

        if branch == 'develop':
            for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-version",
                    descriptionDone='update version',
                    command=Interpolate('sed -i "" "s/^    version \'\(.*\)\'/    version \'%(prop:version)s\'/" cpp-ethereum.rb'),
                    workdir='brew',
                )
            ]: factory.addStep(step)

        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add cpp-ethereum.rb',
                workdir='brew',
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "bump cpp-ethereum to %(prop:version)s on %(kw:branch)s"', branch=branch),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            )
        ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="clean-up",
            description='cleaning up',
            descriptionDone='clean up',
            command=["brew", "remove", "cpp-ethereum"],
            workdir='brew',
            decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="clean-up-bottles",
            description='cleaning up bottles',
            descriptionDone='clean up bottles',
            command="rm *.tar.gz",
            workdir='brew',
            decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="brew-update",
            description='brew updating',
            descriptionDone='brew update',
            command=["brew", "update"],
            workdir='brew'
        ),
        Compile(
            haltOnFailure=True,
            logEnviron=False,
            description='brewing',
            descriptionDone='brew',
            command=brew_install_cmd(cmd=['brew', 'install', 'cpp-ethereum.rb', '--with-evmjit', '-v', '--build-bottle'], branch=branch, headless=headless),
            workdir='brew'
        )
    ]: factory.addStep(step)

    if headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="bottle",
                command=brew_install_cmd(cmd=['brew', 'bottle', 'cpp-ethereum.rb', '--with-evmjit', '-v'], branch=branch, headless=headless),
                description="bottling",
                descriptionDone="bottle",
                workdir='brew'
            ),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-old-revision",
                command='sed -ne "s/^%s    revision \(.*\)/\\1/p" cpp-ethereum.rb' % ("" if branch == 'master' else "  "),
                property='old_revision',
                workdir='brew'
            ),
            SetProperty(
                name="set-bottle",
                description="setting bottle",
                descriptionDone="set bottle",
                property="bottle",
                value=Interpolate("cpp-ethereum-%(prop:version)s.yosemite.bottle%(kw:revision)s.tar.gz", revision=brew_revision_suffix)
            ),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="sha1sum",
                command=Interpolate('sha1sum %(prop:bottle)s | grep -o -w "\w\{40\}"'),
                property='sha1sum',
                workdir='brew'
            ),
            FileUpload(
                haltOnFailure=True,
                name='upload-bottle',
                slavesrc=Interpolate("%(prop:bottle)s"),
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s/bottle/"
                                       "cpp-ethereum-%(prop:version)s.yosemite.bottle.%(prop:buildnumber)s.tar.gz"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:buildnumber)s/bottle/"
                                "cpp-ethereum-%(prop:version)s.yosemite.bottle.%(prop:buildnumber)s.tar.gz"),
                workdir='brew'
            )
        ]: factory.addStep(step)

    if branch == 'master' and headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-bottle-url",
                descriptionDone='update bottle url',
                command=Interpolate('sed -i "" "s/^    root_url \'\(.*\)\'/    root_url \'https:\/\/build.ethdev.com\/builds\/'
                                    '%(kw:urlbuildername)s\/%(prop:buildnumber)s\/bottle\'/" cpp-ethereum.rb', urlbuildername=urlbuildername),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-brew-revision",
                descriptionDone='update brew revision',
                command=Interpolate('sed -i "" "s/^    revision \(.*\)/    revision %(prop:buildnumber)s/" cpp-ethereum.rb'),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-sha1sum",
                descriptionDone='update sha1sum',
                command=Interpolate('sed -i "" "s/^    sha1 \'\(.*\)\' => :yosemite/    sha1 \'%(prop:sha1sum)s\' => :yosemite/" cpp-ethereum.rb'),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add cpp-ethereum.rb',
                workdir='brew',
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "bump version to %(prop:version)s at ethereum/cpp-ethereum@%(kw:cpp_revision)s"',
                                    cpp_revision=get_short_revision),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            )
        ]: factory.addStep(step)

    if branch == 'develop' and headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-bottle-url",
                descriptionDone='update bottle url',
                command=Interpolate('sed -i "" "s/^      root_url \'\(.*\)\'/      root_url \'https:\/\/build.ethdev.com\/builds\/'
                                    '%(kw:urlbuildername)s\/%(prop:buildnumber)s\/bottle\'/" cpp-ethereum.rb', urlbuildername=urlbuildername),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-brew-revision",
                descriptionDone='update brew revision',
                command=Interpolate('sed -i "" "s/^      revision \(.*\)/      revision %(prop:buildnumber)s/" cpp-ethereum.rb'),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-sha1sum",
                descriptionDone='update sha1sum',
                command=Interpolate('sed -i "" "s/^      sha1 \'\(.*\)\' => :yosemite/      sha1 \'%(prop:sha1sum)s\' => :yosemite/" cpp-ethereum.rb'),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-successful-version",
                descriptionDone='update successful version',
                command=Interpolate('sed -i "" "s/^      version \'\(.*\)\'/      version \'%(prop:version)s\'/" cpp-ethereum.rb'),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-successful-revision",
                descriptionDone='update successful revision',
                command=Interpolate('sed -i "" "s/:revision => \'\(.*\)\'/:revision => \'%(kw:cpp_revision)s\'/" cpp-ethereum.rb',
                                    cpp_revision=get_cpp_revision),
                workdir='brew',
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add cpp-ethereum.rb',
                workdir='brew',
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "bump successful to %(prop:version)s at ethereum/cpp-ethereum@%(kw:cpp_revision)s"',
                                    cpp_revision=get_short_revision),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            )
        ]: factory.addStep(step)
    return factory
def osx_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "GOPATH": Interpolate("%(prop:workdir)s/go:%(prop:workdir)s/build/Godeps/_workspace"),
        'PATH': [Interpolate("%(prop:workdir)s/go/bin"), "${PATH}"]
    }

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/expanse-project/go-expanse.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-expanse',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-version",
            command='gsed -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd/gexp/main.go',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command=Interpolate("rm -rf %(prop:workdir)s/go"),
            description="cleaning up",
            descriptionDone="clean up",
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            description="moving src",
            descriptionDone="move src",
            command=_go_cmds(branch=branch),
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="install-gexp",
            description="installing gexp",
            descriptionDone="install gexp",
            command="go install -v github.com/expanse-project/go-expanse/cmd/gexp",
            env=env
        )
    ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com/expanse-project/go-expanse/...",
            env=env,
            maxTime=900
        )
    ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            Trigger(
                schedulerNames=["go-expanse-%s-brew" % branch],
                waitForFinish=False,
                set_properties={
                    "version": Interpolate("%(prop:version)s")
                }
            )
        ]: factory.addStep(step)

    return factory
def win_cpp_factory(branch='master', isPullRequest=False):
    factory = BuildFactory()

    sed = '"C:\\Program Files (x86)\\GnuWin32\\bin\\sed.exe"'

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-protocol",
            command='%s -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore\Common.cpp' % sed,
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='%s -ne "s/^set(PROJECT_VERSION \\"\(.*\)\\")$/\\1/p" CMakeLists.txt' % sed,
            property = "version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="dependencies",
            description='dependencies',
            descriptionDone='dependencies',
            command=['getstuff.bat'],
            workdir="build/extdep"
        ),
        Configure(
            haltOnFailure=True,
            logEnviron=False,
            command=["cmake", ".", "-G", "Visual Studio 12 Win64"]
        ),
        MsBuild12(
            haltOnFailure=True,
            logEnviron=False,
            projectfile="ethereum.sln",
            config="Release",
            platform="x64"
        )
    ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            MsBuild12(
                haltOnFailure=True,
                logEnviron=False,
                name="installer",
                projectfile="PACKAGE.vcxproj",
                config="Release",
                platform="x64"
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("Ethereum-%(prop:version)s-win64-%(kw:time_string)s-%(kw:short_revision)s.exe",
                                  time_string=get_time_string,
                                  short_revision=get_short_revision)
            ),
            FileUpload(
                name="upload",
                slavesrc=Interpolate("Ethereum-%(prop:version)s-win64.exe"),
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description='cleaning latest link',
                descriptionDone='clean latest link',
                command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/Ethereum-win64-latest.exe")]
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description='linking latest',
                descriptionDone='link latest',
                command=['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/Ethereum-win64-latest.exe")]
            )
        ]: factory.addStep(step)

    return factory
Exemple #28
0
def osx_cpp_factory(branch='develop',
                    isPullRequest=False,
                    evmjit=False,
                    headless=True):
    factory = BuildFactory()

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/cpp-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='cpp-ethereum',
                retry=(5, 3)),
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/tests.git',
                branch=branch,
                mode='incremental',
                codebase='tests',
                retry=(5, 3),
                workdir='tests'),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                'sed -ne "s/^set(PROJECT_VERSION \\"\(.*\)\\")$/\\1/p" CMakeLists.txt',
                property="version"),
            Configure(haltOnFailure=True,
                      logEnviron=False,
                      command=cmake_osx_cmd(['cmake', '.'],
                                            evmjit=evmjit,
                                            headless=headless)),
            Compile(haltOnFailure=True,
                    logEnviron=False,
                    command="make -j $(sysctl -n hw.ncpu)")
    ]:
        factory.addStep(step)

    if not headless:
        for step in [
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="make-install",
                             description='running make install',
                             descriptionDone='make install',
                             command=['make', 'install'],
                             workdir='build/alethzero'),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="make-install-mix",
                             description='running mix make install',
                             descriptionDone='make install mix',
                             command=['make', 'install'],
                             workdir='build/mix')
        ]:
            factory.addStep(step)

    for step in [
            Test(haltOnFailure=True,
                 warnOnFailure=True,
                 logEnviron=False,
                 name="test-cpp",
                 description="testing",
                 descriptionDone="test",
                 command=testeth_cmd(["./testeth"], evmjit=evmjit),
                 env={
                     'CTEST_OUTPUT_ON_FAILURE': '1',
                     'ETHEREUM_TEST_PATH':
                     Interpolate('%(prop:workdir)s/tests')
                 },
                 workdir="build/test",
                 maxTime=900),
    ]:
        factory.addStep(step)

    # Trigger check
    if not evmjit and not headless:
        for step in [
                Trigger(schedulerNames=["cpp-ethereum-%s-osx-check" % branch],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s")
                        })
        ]:
            factory.addStep(step)

    # Trigger deb builders
    if not evmjit and headless:
        if not isPullRequest:
            for step in [
                    Trigger(schedulerNames=["cpp-ethereum-%s-brew" % branch],
                            waitForFinish=False,
                            set_properties={
                                "version": Interpolate("%(prop:version)s")
                            })
            ]:
                factory.addStep(step)

    # Package AlethZero.app
    if not isPullRequest and not headless:
        for step in [
                Compile(haltOnFailure=True,
                        logEnviron=False,
                        command="make -j $(sysctl -n hw.ncpu) appdmg"),
                SetPropertyFromCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="set-sha1sum",
                    command=Interpolate(
                        'sha1sum Ethereum.dmg | grep -o -w "\w\{40\}"'),
                    property='sha1sum'),
                SetProperty(
                    description="setting filename",
                    descriptionDone="set filename",
                    name="set-filename",
                    property="filename",
                    value=Interpolate(
                        "AlethZero-OSX-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.dmg",
                        time_string=get_time_string,
                        short_revision=get_short_revision)),
                FileUpload(
                    haltOnFailure=True,
                    name='upload-alethzero',
                    slavesrc="Ethereum.dmg",
                    masterdest=Interpolate(
                        "public_html/builds/%(prop:buildername)s/%(prop:filename)s"
                    ),
                    url=Interpolate(
                        "builds/%(prop:buildername)s/%(prop:filename)s")),
                MasterShellCommand(
                    name="clean-latest-link",
                    description='cleaning latest link',
                    descriptionDone='clean latest link',
                    command=[
                        'rm', '-f',
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/AlethZero-OSX-latest.dmg"
                        )
                    ]),
                MasterShellCommand(
                    haltOnFailure=True,
                    name="link-latest",
                    description='linking latest',
                    descriptionDone='link latest',
                    command=[
                        'ln', '-sf',
                        Interpolate("%(prop:filename)s"),
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/AlethZero-OSX-latest.dmg"
                        )
                    ])
        ]:
            factory.addStep(step)

    return factory
def cpp_ethereum_factory(branch='master', deb=False, evmjit=False, headless=True):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/tests.git',
            branch=branch,
            mode='incremental',
            codebase='tests',
            retry=(5, 3),
            workdir='tests'
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-protocol",
            command='sed -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore/Common.cpp',
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/.*Version = \\"\(.*\)\\";/\\1/p" libdevcore/Common.cpp',
            property="version"
        ),
        Configure(
            haltOnFailure=True,
            logEnviron=False,
            command=cmake_cmd(["cmake", "."], evmjit=evmjit, headless=headless),
            env={"PATH": "${QTDIR}/bin:${PATH}"}
        ),
        Compile(
            haltOnFailure=True,
            logEnviron=False,
            command="make -j $(cat /proc/cpuinfo | grep processor | wc -l)"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-install",
            description="installing",
            descriptionDone="install",
            command=["make", "install"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="ldconfig",
            description="running ldconfig",
            descriptionDone="ldconfig",
            command=["ldconfig"]
        ),
        Test(
            haltOnFailure=True,
            warnOnFailure=True,
            logEnviron=False,
            name="test-cpp",
            description="testing",
            descriptionDone="test",
            command=testeth_cmd(["./testeth"], evmjit=evmjit),
            env={
                'CTEST_OUTPUT_ON_FAILURE': '1',
                'ETHEREUM_TEST_PATH': Interpolate('%(prop:workdir)s/tests'),
                'EVMJIT': '-cache=0'
            },
            workdir="build/test",
            maxTime=900
        )
    ]: factory.addStep(step)

    # Trigger check and integration builders
    if not evmjit and not headless:
        for step in [
            Trigger(
                schedulerNames=["cpp-ethereum-%s-check" % branch],
                waitForFinish=False,
                set_properties={
                    "protocol": Interpolate("%(prop:protocol)s"),
                    "version": Interpolate("%(prop:version)s")
                })
        ]: factory.addStep(step)

        # if branch is not 'master':
        #     for step in [
        #         Trigger(
        #             schedulerNames=["cpp-ethereum-integration"],
        #             waitForFinish=False,
        #             set_properties={
        #                 "database": Interpolate("%(prop:database)s"),
        #                 "protocol": Interpolate("%(prop:protocol)s"),
        #                 "version": Interpolate("%(prop:version)s")
        #             })
        #     ]: factory.addStep(step)

    # Trigger deb builders
    if not evmjit and headless:
        if deb:
            for architecture in ['i386', 'amd64']:
                for distribution in distributions:
                    for step in [
                        Trigger(
                            schedulerNames=["cpp-ethereum-%s-%s-%s" % (branch, architecture, distribution)],
                            waitForFinish=False,
                            set_properties={
                                "version": Interpolate("%(prop:version)s")
                            })
                    ]: factory.addStep(step)

    # Trigger PoC server buildslave
    if deb and not evmjit and headless:
        for step in [
            Trigger(
                schedulerNames=["cpp-ethereum-%s-server" % branch],
                waitForFinish=False,
                set_properties={
                    "protocol": Interpolate("%(prop:protocol)s"),
                    "version": Interpolate("%(prop:version)s")
                }
            )
        ]: factory.addStep(step)

    return factory
def win_cpp_factory(branch='master', isPullRequest=False):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-protocol",
            command=[r'C:\\Program Files (x86)\Git\bin\sh.exe', "--login", "-c", r'sed -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore/Common.cpp'],
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command=[r'C:\\Program Files (x86)\Git\bin\sh.exe', "--login", "-c", r'grep "Version" ./libdevcore/Common.cpp | sed "s/.*\"\(.*\)\".*/\1/"'],
            property = "version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="dependencies",
            description='dependencies',
            descriptionDone='dependencies',
            command=['getstuff.bat'],
            workdir="build/extdep"
        ),
        Configure(
            haltOnFailure=True,
            logEnviron=False,
            command=["cmake", "."]
        ),
        MsBuild12(
            haltOnFailure=True,
            logEnviron=False,
            projectfile="ethereum.sln",
            config="release",
            platform="Win32"
        )
    ]: factory.addStep(step)

    if isPullRequest is False:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="pack",
                description='pack',
                descriptionDone='packed',
                command=[
                    '7z',
                    'a',
                    'cpp-ethereum.7z',
                    './alethzero/Release/*',
                    './eth/Release/*'
                ]
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("AlethZero-Win32-%(kw:time_string)s-%(prop:version)s-%(prop:protocol)s-%(kw:short_revision)s.7z",
                                  time_string=get_time_string,
                                  short_revision=get_short_revision)
            ),
            FileUpload(
                haltOnFailure=True,
                name='upload',
                slavesrc="cpp-ethereum.7z",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description='cleaning latest link',
                descriptionDone='clean latest link',
                command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/AlethZero-Win32-latest.7z")]
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description='linking latest',
                descriptionDone='link latest',
                command=['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/AlethZero-Win32-latest.7z")]
            )
        ]: factory.addStep(step)

    return factory
def buildslave_factory(lang="cpp", client="cpp-ethereum"):
    factory = BuildFactory()

    # Build base image
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/ethereum-dockers.git',
                mode='incremental',
                codebase='ethereum-dockers',
                retry=(5, 3)),
            ShellCommand(flunkOnFailure=False,
                         logEnviron=False,
                         name="cleanup-containers",
                         description="cleaning up containers",
                         descriptionDone="clean up containers",
                         command="docker rm $(docker ps -a -q)",
                         decodeRC={
                             0: SUCCESS,
                             1: WARNINGS,
                             123: WARNINGS
                         }),
            ShellCommand(
                flunkOnFailure=False,
                logEnviron=False,
                name="cleanup-images",
                description="cleaning up images",
                descriptionDone="clean up images",
                command="docker rmi $(docker images -f 'dangling=true' -q)",
                decodeRC={
                    0: SUCCESS,
                    1: WARNINGS,
                    123: WARNINGS
                }),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="docker-%s" % lang,
                         description="building %s base" % lang,
                         descriptionDone="build %s base" % lang,
                         command=[
                             "docker", "build", "--no-cache", "-t",
                             "cptobvious/%s-base" % client,
                             "%s-base" % client
                         ],
                         timeout=1800),
            ShellCommand(
                logEnviron=False,
                name="docker-%s-push" % lang,
                command=["docker", "push",
                         "cptobvious/%s-base" % client],
                warnOnFailure=True,
                decodeRC={
                    0: SUCCESS,
                    1: WARNINGS
                }),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="last-container",
                command="docker ps -a | grep buildslave-%s | awk '{print $1}'"
                % lang,
                property="last-container"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s" % lang,
                         description="building %s buildslave" % lang,
                         descriptionDone="build %s buildslave" % lang,
                         command=[
                             "docker", "build", "--no-cache", "-t",
                             "cptobvious/buildslave-%s" % lang,
                             "%s-buildslave" % client
                         ],
                         timeout=1800)
    ]:
        factory.addStep(step)

    # Build develop buildslave
    if lang in ['cpp', 'go']:
        for step in [
                ShellCommand(
                    warnOnFailure=True,
                    logEnviron=False,
                    name="buildslave-%s-develop" % lang,
                    description="building %s develop buildslave" % lang,
                    descriptionDone="build %s develop buildslave" % lang,
                    command=[
                        "docker", "build", "--no-cache", "-t",
                        "cptobvious/buildslave-%s-develop" % lang,
                        "%s-buildslave-develop" % client
                    ],
                    timeout=1800)
        ]:
            factory.addStep(step)

    # Build deb packaging buildslave
    if lang in ['cpp', 'go']:
        factory.addStep(
            ShellCommand(warnOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s-deb" % lang,
                         description="building %s deb buildslave" % lang,
                         descriptionDone="build %s deb buildslave" % lang,
                         command=[
                             "docker", "build", "--no-cache", "-t",
                             "cptobvious/buildslave-%s-deb" % lang,
                             "%s-buildslave-deb" % client
                         ]))

    # Build integration buildslave
    if lang in ['cpp']:
        factory.addStep(
            ShellCommand(
                warnOnFailure=True,
                logEnviron=False,
                name="buildslave-%s-integration" % lang,
                description="building %s integration buildslave" % lang,
                descriptionDone="build %s integration buildslave" % lang,
                command=[
                    "docker", "build", "--no-cache", "-t",
                    "cptobvious/buildslave-%s-integration" % lang,
                    "%s-buildslave-integration" % client
                ]))

    # Build ARM buildslave
    if lang in ['go']:
        factory.addStep(
            ShellCommand(warnOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s-arm" % lang,
                         description="building %s ARM buildslave" % lang,
                         descriptionDone="build %s ARM buildslave" % lang,
                         command=[
                             "docker", "build", "--no-cache", "-t",
                             "cptobvious/buildslave-%s-arm" % lang,
                             "%s-buildslave-arm" % client
                         ]))

    # Build pull request buildslave
    for step in [
            ShellCommand(warnOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s-pr" % lang,
                         description="building %s pr buildslave" % lang,
                         descriptionDone="build %s pr buildslave" % lang,
                         command=[
                             "docker", "build", "--no-cache", "-t",
                             "cptobvious/buildslave-%s-pr" % lang,
                             "%s-buildslave-pr" % client
                         ])
    ]:
        factory.addStep(step)

    #
    # Stop containers and run new ones
    #
    for step in [
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s-stop" % lang,
                         description="stopping %s buildslave" % lang,
                         descriptionDone="stop %s buildslave" % lang,
                         command=_buildslave_stop_cmd,
                         decodeRC={
                             0: SUCCESS,
                             1: WARNINGS,
                             2: WARNINGS
                         }),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s-run" % lang,
                         description="starting %s buildslave" % lang,
                         descriptionDone="start %s buildslave" % lang,
                         command=[
                             "docker", "run", "--restart", "always", "-d",
                             "-t",
                             "cptobvious/buildslave-%s" % lang
                         ]),
            ShellCommand(warnOnFailure=True,
                         logEnviron=False,
                         name="buildslave-%s-pr-run" % lang,
                         description="starting %s pr buildslave" % lang,
                         descriptionDone="start %s pr buildslave" % lang,
                         command=[
                             "docker", "run", "--restart", "always", "-d",
                             "-t",
                             "cptobvious/buildslave-%s-pr" % lang
                         ])
    ]:
        factory.addStep(step)

    # Run develop buildslave
    if lang in ['cpp', 'go']:
        for step in [
                ShellCommand(
                    warnOnFailure=True,
                    logEnviron=False,
                    name="buildslave-%s-develop-run" % lang,
                    description="starting %s develop buildslave" % lang,
                    descriptionDone="start %s develop buildslave" % lang,
                    command=[
                        "docker", "run", "--restart", "always", "-d", "-t",
                        "cptobvious/buildslave-%s-develop" % lang
                    ])
        ]:
            factory.addStep(step)

    # Run deb packaging buildslave
    if lang in ['cpp', 'go']:
        for step in [
                ShellCommand(warnOnFailure=True,
                             logEnviron=False,
                             name="buildslave-%s-deb-run" % lang,
                             description="starting %s deb buildslave" % lang,
                             descriptionDone="start %s deb buildslave" % lang,
                             command=[
                                 "docker", "run", "--restart", "always", "-d",
                                 "--privileged=true", "-t",
                                 "cptobvious/buildslave-%s-deb" % lang
                             ])
        ]:
            factory.addStep(step)

    # Run integration buildslave
    if lang in ['cpp']:
        for step in [
                ShellCommand(
                    warnOnFailure=True,
                    logEnviron=False,
                    name="buildslave-%s-integration-run" % lang,
                    description="starting %s integration buildslave" % lang,
                    descriptionDone="start %s integration buildslave" % lang,
                    command=[
                        "docker", "run", "--restart", "always", "-d", "-t",
                        "cptobvious/buildslave-%s-integration" % lang
                    ])
        ]:
            factory.addStep(step)

    # Run ARM buildslave
    if lang in ['go']:
        for step in [
                ShellCommand(warnOnFailure=True,
                             logEnviron=False,
                             name="buildslave-%s-arm-run" % lang,
                             description="starting %s ARM buildslave" % lang,
                             descriptionDone="start %s ARM buildslave" % lang,
                             command=[
                                 "docker", "run", "--restart", "always", "-d",
                                 "-t",
                                 "cptobvious/buildslave-%s-arm" % lang
                             ])
        ]:
            factory.addStep(step)

    return factory
Exemple #32
0
def mist_factory(branch='master', isPullRequest=False):
    factory = BuildFactory()
    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/mist.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='mist',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                'sed -ne "s/.*\\"version\\": \\"\([0-9]*\.[0-9]*\.[0-9]*\)\\".*/\\1/p" package.json',
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="npm-install",
                         command=["npm", "install"],
                         description="npm installing",
                         descriptionDone="npm install"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="gulp-mist",
                         command=["gulp", "mist"],
                         description="gulping mist",
                         descriptionDone="gulp mist")
    ]:
        factory.addStep(step)

    if not isPullRequest:
        for arch in osVersions:
            for step in [
                    ShellCommand(
                        haltOnFailure=True,
                        logEnviron=False,
                        name="pack-mist-%s" % arch,
                        description='packing %s' % arch,
                        descriptionDone='pack %s' % arch,
                        command=[
                            'zip' if arch.startswith('win') else 'tar',
                            '-r' if arch.startswith('win') else '-cjf',
                            Interpolate(
                                "Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                arch=arch,
                                short_revision=get_short_revision_mist,
                                ext='zip'
                                if arch.startswith('win') else 'tar.bz2'),
                            Interpolate(
                                'Mist-%(kw:arch)s-%(kw:folder_version)s',
                                arch=arch,
                                folder_version=folder_version)
                        ],
                        workdir='build/dist_mist'),
                    SetPropertyFromCommand(
                        haltOnFailure=True,
                        logEnviron=False,
                        name="sha256sum-%s" % arch,
                        command=Interpolate(
                            'sha256sum Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s | grep -o -w "\w\{64\}"',
                            arch=arch,
                            short_revision=get_short_revision_mist,
                            ext='zip'
                            if arch.startswith('win') else 'tar.bz2'),
                        property='sha256sum-%s' % arch,
                        workdir='build/dist_mist'),
                    FileUpload(
                        haltOnFailure=True,
                        name='upload-mist-%s' % arch,
                        slavesrc=Interpolate(
                            "dist_mist/Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                            arch=arch,
                            short_revision=get_short_revision_mist,
                            ext='zip'
                            if arch.startswith('win') else 'tar.bz2'),
                        masterdest=Interpolate(
                            "public_html/builds/%(prop:buildername)s/Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                            arch=arch,
                            short_revision=get_short_revision_mist,
                            ext='zip'
                            if arch.startswith('win') else 'tar.bz2'),
                        url=Interpolate(
                            "/builds/%(prop:buildername)s/Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                            arch=arch,
                            short_revision=get_short_revision_mist,
                            ext='zip'
                            if arch.startswith('win') else 'tar.bz2')),
                    MasterShellCommand(
                        name="clean-latest-link-%s" % arch,
                        description='cleaning latest link %s' % arch,
                        descriptionDone='clean latest link %s' % arch,
                        command=[
                            'rm', '-f',
                            Interpolate(
                                "public_html/builds/%(prop:buildername)s/Mist-%(kw:arch)s-latest.%(kw:ext)s",
                                arch=arch,
                                ext='zip'
                                if arch.startswith('win') else 'tar.bz2')
                        ]),
                    MasterShellCommand(
                        haltOnFailure=True,
                        name="link-latest-%s" % arch,
                        description='linking latest %s' % arch,
                        descriptionDone='link latest %s' % arch,
                        command=[
                            'ln', '-sf',
                            Interpolate(
                                "Mist-%(prop:version)s-%(kw:arch)s-%(kw:short_revision)s.%(kw:ext)s",
                                arch=arch,
                                short_revision=get_short_revision_mist,
                                ext='zip'
                                if arch.startswith('win') else 'tar.bz2'),
                            Interpolate(
                                "public_html/builds/%(prop:buildername)s/Mist-%(kw:arch)s-latest.%(kw:ext)s",
                                arch=arch,
                                ext='zip'
                                if arch.startswith('win') else 'tar.bz2')
                        ])
            ]:
                factory.addStep(step)

    return factory
def arm_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "CC": "arm-linux-gnueabi-gcc-5",
        "GOOS": "linux",
        "GOARCH": "arm",
        "GOARM": "5",
        "CGO_ENABLED": "1"
    }

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-clean",
            command=["make", "clean"],
            description="cleaning up",
            descriptionDone="clean up"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-all",
            description="installing",
            descriptionDone="install",
            command=["make", "all"],
            env=env
        ),
        # ShellCommand(
        #     haltOnFailure=True,
        #     name="go-test",
        #     description="go testing",
        #     descriptionDone="go test",
        #     command=["make", "test"],
        #     maxTime=900,
        #     env=env
        # )
    ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="tar-geth",
                description='packing',
                descriptionDone='pack',
                command=['tar', '-cjf', 'geth.tar.bz2', 'build/bin/geth']
            ),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-sha256sum",
                command=Interpolate('sha256sum geth.tar.bz2 | grep -o -w "\w\{64\}"'),
                property='sha256sum'
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("geth-ARM-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.tar.bz2",
                                  time_string=get_time_string,
                                  short_revision=get_short_revision_go)
            ),
            FileUpload(
                haltOnFailure=True,
                name='upload-geth',
                slavesrc="geth.tar.bz2",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description='cleaning latest link',
                descriptionDone='clean latest link',
                command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2")]
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description='linking latest',
                descriptionDone='link latest',
                command=['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2")]
            )
        ]: factory.addStep(step)

    return factory
def cpp_ethereum_factory(branch='master', deb=False, evmjit=False, headless=True):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method = 'copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/tests.git',
            branch=branch,
            mode='incremental',
            codebase='tests',
            retry=(5, 3),
            workdir='tests'
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "set-protocol",
            command='sed -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore/Common%s.cpp' % ("Eth" if branch == 'master' else ""),
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "set-version",
            command='sed -ne "s/.*Version = \\"\(.*\)\\";/\\1/p" libdevcore/Common.cpp',
            property="version"
        ),
        Configure(
            haltOnFailure = True,
            logEnviron = False,
            command=cmake_cmd(["cmake", "."], evmjit=evmjit, headless=headless),
            env={"PATH": "${QTDIR}/bin:${PATH}"}
        ),
        Compile(
            haltOnFailure = True,
            logEnviron = False,
            command="make -j $(cat /proc/cpuinfo | grep processor | wc -l)"
        ),
        ShellCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "make-install",
            description="installing",
            descriptionDone="install",
            command=["make", "install"]
        ),
        ShellCommand(
            haltOnFailure = True,
            logEnviron = False,
            name = "ldconfig",
            description="running ldconfig",
            descriptionDone="ldconfig",
            command=["ldconfig"]
        ),
        Test(
            haltOnFailure = True,
            warnOnFailure = True,
            logEnviron = False,
            name="test-cpp-strict",
            description="strict testing",
            descriptionDone="strict test",
            command=testeth_cmd(["./testeth", "-t", "devcrypto,jsonrpc,Solidity*"], evmjit=evmjit),
            env={'CTEST_OUTPUT_ON_FAILURE': '1', 'ETHEREUM_TEST_PATH': Interpolate('%(prop:workdir)s/tests')},
            workdir="build/test"
        )
    ]: factory.addStep(step)

    # Trigger check and integration builders
    if not evmjit and not headless:
        for step in [
            Trigger(
                schedulerNames=["cpp-ethereum-%s-check" % branch],
                waitForFinish=False,
                set_properties={
                    "protocol": Interpolate("%(prop:protocol)s"),
                    "version": Interpolate("%(prop:version)s")
                })
        ]: factory.addStep(step)

        # if branch is not 'master':
        #     for step in [
        #         Trigger(
        #             schedulerNames=["cpp-ethereum-integration"],
        #             waitForFinish=False,
        #             set_properties={
        #                 "database": Interpolate("%(prop:database)s"),
        #                 "protocol": Interpolate("%(prop:protocol)s"),
        #                 "version": Interpolate("%(prop:version)s")
        #             })
        #     ]: factory.addStep(step)

    # Trigger deb builders
    if not evmjit and headless:
        if deb:
            for architecture in ['i386', 'amd64']:
                for distribution in distributions:
                    for step in [
                        Trigger(
                            schedulerNames=["cpp-ethereum-%s-%s-%s" % (branch, architecture, distribution)],
                            waitForFinish=False,
                            set_properties={
                                "version": Interpolate("%(prop:version)s")
                            })
                    ]: factory.addStep(step)

    # Run all tests, warnings let the build pass, failures marks the build with warnings
    for step in [
        ShellCommand(
            flunkOnFailure = False,
            warnOnFailure = True,
            logEnviron = False,
            name="test-cpp",
            description="testing",
            descriptionDone="test",
            command=testeth_cmd(["./testeth"], evmjit=evmjit),
            env={'CTEST_OUTPUT_ON_FAILURE': '1', 'ETHEREUM_TEST_PATH': Interpolate('%(prop:workdir)s/tests')},
            workdir="build/test",
            decodeRC={0:SUCCESS, -1:WARNINGS, 1:WARNINGS, 201:WARNINGS},
            maxTime=900
        )
    ]: factory.addStep(step)

    # Trigger PoC server buildslave and a test node
    if deb and not evmjit and headless:
        for step in [
            Trigger(
                schedulerNames=["cpp-ethereum-%s-server" % branch],
                waitForFinish=False,
                set_properties={
                    "protocol": Interpolate("%(prop:protocol)s"),
                    "version": Interpolate("%(prop:version)s")
                }
            ),
            FileDownload(
                haltOnFailure = True,
                descriptionDone="download init script",
                mastersrc="startup/eth-supervisord.conf",
                slavedest="eth-supervisord.conf"
            ),
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name="stop",
                description="stopping",
                descriptionDone="stop",
                command="kill `ps aux | grep 'supervisord -c eth-supervisord.conf' | grep -v grep | awk '{print $2}'` && kill `pidof eth` && sleep 5",
                decodeRC={-1: SUCCESS, 0:SUCCESS, 1:WARNINGS, 2:WARNINGS}
            ),
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name="start",
                description="starting",
                descriptionDone="start",
                command="supervisord -c eth-supervisord.conf && sleep 15",
                logfiles={
                    "eth.log": "eth.log",
                    "eth.err": "eth.err",
                    "supervisord.log": "eth-supervisord.log"
                },
                lazylogfiles=True
            )
        ]: factory.addStep(step)

    return factory
def arm_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "CC": "arm-linux-gnueabi-gcc-5",
        "GOOS": "linux",
        "GOARCH": "arm",
        "GOARM": "5",
        "CGO_ENABLED": "1"
    }

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/go-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='go-ethereum',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                'sed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-clean",
                         command=["make", "clean"],
                         description="cleaning up",
                         descriptionDone="clean up"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-all",
                         description="installing",
                         descriptionDone="install",
                         command=["make", "all"],
                         env=env),
            # ShellCommand(
            #     haltOnFailure=True,
            #     name="go-test",
            #     description="go testing",
            #     descriptionDone="go test",
            #     command=["make", "test"],
            #     maxTime=900,
            #     env=env
            # )
    ]:
        factory.addStep(step)

    if not isPullRequest:
        for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="tar-geth",
                    description='packing',
                    descriptionDone='pack',
                    command=['tar', '-cjf', 'geth.tar.bz2', 'build/bin/geth']),
                SetPropertyFromCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="set-sha256sum",
                    command=Interpolate(
                        'sha256sum geth.tar.bz2 | grep -o -w "\w\{64\}"'),
                    property='sha256sum'),
                SetProperty(
                    description="setting filename",
                    descriptionDone="set filename",
                    name="set-filename",
                    property="filename",
                    value=Interpolate(
                        "geth-ARM-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.tar.bz2",
                        time_string=get_time_string,
                        short_revision=get_short_revision_go)),
                FileUpload(
                    haltOnFailure=True,
                    name='upload-geth',
                    slavesrc="geth.tar.bz2",
                    masterdest=Interpolate(
                        "public_html/builds/%(prop:buildername)s/%(prop:filename)s"
                    ),
                    url=Interpolate(
                        "/builds/%(prop:buildername)s/%(prop:filename)s")),
                MasterShellCommand(
                    name="clean-latest-link",
                    description='cleaning latest link',
                    descriptionDone='clean latest link',
                    command=[
                        'rm', '-f',
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2"
                        )
                    ]),
                MasterShellCommand(
                    haltOnFailure=True,
                    name="link-latest",
                    description='linking latest',
                    descriptionDone='link latest',
                    command=[
                        'ln', '-sf',
                        Interpolate("%(prop:filename)s"),
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2"
                        )
                    ])
        ]:
            factory.addStep(step)

    return factory
def go_ethereum_factory(branch='master', deb=False, headless=True):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-protocol",
            command='sed -ne "s/.*ProtocolVersion    = \(.*\)/\\1/p" eth/protocol.go',
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-p2p",
            command='sed -ne "s/.*baseProtocolVersion.*= \(.*\)/\\1/p" p2p/peer.go',
            property="p2p"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd/geth/main.go',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command="rm -rf $GOPATH",
            description="cleaning up",
            descriptionDone="clean up"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            command=_go_cmds(branch=branch),
            description="moving src",
            descriptionDone="move src"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="install-geth",
            description="installing geth",
            descriptionDone="install geth",
            command="go install -v github.com/ethereum/go-ethereum/cmd/geth",
            env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")}
        )
    ]: factory.addStep(step)

    if not headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="install-mist",
                description="installing mist",
                descriptionDone="install mist",
                command="go install -v github.com/ethereum/go-ethereum/cmd/mist",
                env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")}
            )
        ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com/ethereum/go-ethereum/...",
            env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")},
            maxTime=900
        )
    ]: factory.addStep(step)

    if deb and headless:
        for architecture in ['i386', 'amd64']:
            for distribution in distributions:
                for step in [
                    Trigger(
                        schedulerNames=["go-ethereum-%s-%s-%s" % (branch, architecture, distribution)],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s")
                        }
                    )
                ]: factory.addStep(step)

    if headless:
        for step in [
            FileDownload(
                haltOnFailure=True,
                descriptionDone="download init script",
                mastersrc="startup/geth-supervisord.conf",
                slavedest="geth-supervisord.conf"
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="stop",
                description="stopping",
                descriptionDone="stop",
                command="kill `ps aux | grep 'supervisord -c geth-supervisord.conf' | grep -v grep | awk '{print $2}'` && kill `pidof geth` && sleep 5",
                decodeRC={-1: SUCCESS, 0:SUCCESS, 1:WARNINGS, 2:WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="start",
                description="starting",
                descriptionDone="start",
                command="supervisord -c geth-supervisord.conf && sleep 15",
                logfiles={
                    "geth.log": "geth.log",
                    "geth.err": "geth.err",
                    "supervisord.log": "geth-supervisord.log"
                },
                lazylogfiles=True
            )
        ]: factory.addStep(step)

    return factory
def cpp_ethereum_server_factory(branch='master'):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/cpp-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='cpp-ethereum',
            retry=(5, 3)
        ),
        Configure(
            haltOnFailure=True,
            logEnviron=False,
            command=["cmake", ".", "-DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++", "-DHEADLESS=1"]
        ),
        Compile(
            haltOnFailure=True,
            logEnviron=False,
            command="make -j $(cat /proc/cpuinfo | grep processor | wc -l)"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="make-install",
            description="installing",
            descriptionDone="install",
            command=["sudo", "make", "install"]
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="ldconfig",
            description="running ldconfig",
            descriptionDone="ldconfig",
            command=["sudo", "ldconfig"]
        ),
        FileDownload(
            haltOnFailure=True,
            descriptionDone="download init script",
            mastersrc="startup/eth-supervisord-%s.conf" % branch,
            slavedest="eth-supervisord-%s.conf" % branch
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="stop",
            description="stopping",
            descriptionDone="stop",
            command="kill `ps aux | grep 'eth-supervisord-%s.conf' | grep -v grep | awk '{print $2}'` && kill `pidof eth` && sleep 5" % branch,
            decodeRC={-1: SUCCESS, 0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="start",
            description="starting",
            descriptionDone="start",
            command="supervisord -c eth-supervisord-%s.conf && sleep 60" % branch,
            logfiles={
                "eth.log": "eth.log",
                "eth.err": "eth.err",
                "supervisord.log": "eth-supervisord.log"
            },
            lazylogfiles=True
        )
    ]: factory.addStep(step)

    return factory
def brew_go_factory(branch='develop', release='el_capitan'):
    factory = BuildFactory()

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/go-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='go-ethereum',
                retry=(5, 3)),
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/homebrew-ethereum.git',
                branch='master',
                mode='incremental',
                codebase='homebrew-ethereum',
                retry=(5, 3),
                workdir='brew')
    ]:
        factory.addStep(step)

    # Bump version and revision only once
    if release == 'el_capitan':
        if branch == 'master':
            for step in [
                    ShellCommand(
                        haltOnFailure=True,
                        logEnviron=False,
                        name="update-version",
                        descriptionDone='update go-ethereum version',
                        command=Interpolate(
                            'sed -i "" "s/^'
                            '  version \'\(.*\)\'/'
                            '  version \'%(prop:version)s\'/" ethereum.rb'),
                        workdir='brew',
                    )
            ]:
                factory.addStep(step)

        elif branch == 'develop':
            for step in [
                    ShellCommand(
                        haltOnFailure=True,
                        logEnviron=False,
                        name="update-version",
                        descriptionDone='update go-ethereum version',
                        command=Interpolate(
                            'sed -i "" "s/^'
                            '    version \'\(.*\)\'/'
                            '    version \'%(prop:version)s\'/" ethereum.rb'),
                        workdir='brew',
                    )
            ]:
                factory.addStep(step)

        for step in [
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-add",
                             descriptionDone='git add',
                             command='git add ethereum.rb',
                             workdir='brew'),
                ShellCommand(
                    logEnviron=False,
                    name="git-commit",
                    descriptionDone='git commit',
                    command=Interpolate(
                        'git commit -m "bump ethereum to %(prop:version)s on %(kw:branch)s"',
                        branch=branch),
                    workdir='brew',
                    decodeRC={
                        0: SUCCESS,
                        1: WARNINGS,
                        2: WARNINGS
                    }),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-push",
                             descriptionDone='git push',
                             command='git pull --no-edit && git push',
                             workdir='brew')
        ]:
            factory.addStep(step)
    else:
        for step in [
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-pull",
                             descriptionDone='git pull',
                             command='git pull --no-edit',
                             workdir='brew')
        ]:
            factory.addStep(step)

    for step in [
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="cleanup",
                         description='cleanup',
                         descriptionDone='clean',
                         command=["brew", "remove", "ethereum"],
                         workdir='brew',
                         decodeRC={
                             0: SUCCESS,
                             1: SUCCESS,
                             2: WARNINGS
                         }),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="clean-up-bottles",
                         description='cleaning up bottles',
                         descriptionDone='clean up bottles',
                         command="rm *.tar.gz",
                         workdir='brew',
                         decodeRC={
                             0: SUCCESS,
                             1: SUCCESS,
                             2: WARNINGS
                         }),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="brew-update",
                         description='brew updating',
                         descriptionDone='brew update',
                         command=["brew", "update"],
                         workdir='brew'),
            Compile(haltOnFailure=True,
                    logEnviron=False,
                    name="brew",
                    description='running brew',
                    descriptionDone='brew',
                    command=brew_install_cmd(cmd=[
                        'brew', 'install', 'ethereum.rb', '-v',
                        '--build-bottle'
                    ],
                                             branch=branch),
                    workdir='brew'),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="bottle",
                         command="brew bottle ethereum.rb -v%s > bottle.log" %
                         (" --devel" if branch is "develop" else ""),
                         logfiles={"bottle.log": "bottle.log"},
                         lazylogfiles=True,
                         description="bottling",
                         descriptionDone="bottle",
                         workdir='brew'),
            SetPropertyFromCommand(
                name="set-bottle",
                command='sed -ne "s/.*Bottling \(.*\).../\\1/p" bottle.log',
                description="setting bottle",
                descriptionDone="set bottle",
                property="bottle",
                workdir="brew"),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-sha256sum",
                command='sed -ne "s/.*sha256 \\"\(.*\)\\".*/\\1/p" bottle.log',
                property='sha256sum',
                workdir='brew'),
            FileUpload(
                haltOnFailure=True,
                name='upload-bottle',
                slavesrc=Interpolate("%(prop:bottle)s"),
                masterdest=Interpolate((
                    "public_html/builds/bottles%(kw:dev)s/"
                    "ethereum-%(prop:version)s.%(kw:release)s.bottle.%(kw:revision)s.tar.gz"
                ),
                                       dev="-dev"
                                       if branch == 'develop' else "",
                                       release=release,
                                       revision=revision_or_buildnumber),
                url=Interpolate(
                    "/builds/bottles%(kw:dev)s/"
                    "ethereum-%(prop:version)s.%(kw:release)s.bottle.%(kw:revision)s.tar.gz",
                    dev="-dev" if branch == 'develop' else "",
                    release=release,
                    revision=revision_or_buildnumber),
                workdir='brew')
    ]:
        factory.addStep(step)

    if branch == 'master':
        for step in [
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-pull",
                             descriptionDone='git pull',
                             command='git pull --no-edit',
                             workdir='brew'),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="update-brew-revision",
                             descriptionDone='update brew revision',
                             command=Interpolate(
                                 'sed -i "" "s/^'
                                 '    revision \(.*\)/'
                                 '    revision %(kw:revision)s/" ethereum.rb',
                                 revision=revision_or_buildnumber),
                             workdir='brew'),
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-sha256sum",
                    descriptionDone='update sha256sum',
                    command=Interpolate(
                        'sed -i "" "s/^'
                        '    sha256 \'\(.*\)\' => :%(kw:release)s/'
                        '    sha256 \'%(prop:sha256sum)s\' => :%(kw:release)s/" ethereum.rb',
                        release=release),
                    workdir='brew'),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-add",
                             descriptionDone='git add',
                             command='git add ethereum.rb',
                             workdir='brew'),
                ShellCommand(
                    logEnviron=False,
                    name="git-commit",
                    descriptionDone='git commit',
                    command=Interpolate(
                        'git commit -m "ethereum %(prop:version)s on %(kw:branch)s at ethereum/go-ethereum@%(kw:go_revision)s for %(kw:release)s"',
                        branch=branch,
                        go_revision=get_short_revision_go,
                        release=release_name(release)),
                    workdir='brew',
                    decodeRC={
                        0: SUCCESS,
                        1: WARNINGS,
                        2: WARNINGS
                    }),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-push",
                             descriptionDone='git push',
                             command='git pull --no-edit && git push',
                             workdir='brew')
        ]:
            factory.addStep(step)

    elif branch == 'develop':
        for step in [
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-pull",
                             descriptionDone='git pull',
                             command='git pull --no-edit',
                             workdir='brew'),
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-brew-revision",
                    descriptionDone='update brew revision',
                    command=Interpolate(
                        'sed -i "" "s/^'
                        '      revision \(.*\)/'
                        '      revision %(kw:revision)s/" ethereum.rb',
                        revision=revision_or_buildnumber),
                    workdir='brew'),
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-sha256sum",
                    descriptionDone='update sha256sum',
                    command=Interpolate(
                        'sed -i "" "s/^'
                        '      sha256 \'\(.*\)\' => :%(kw:release)s/'
                        '      sha256 \'%(prop:sha256sum)s\' => :%(kw:release)s/" ethereum.rb',
                        release=release),
                    workdir='brew'),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-add",
                             descriptionDone='git add',
                             command='git add ethereum.rb',
                             workdir='brew'),
                ShellCommand(
                    logEnviron=False,
                    name="git-commit",
                    descriptionDone='git commit',
                    command=Interpolate(
                        'git commit -m "ethereum %(prop:version)s on %(kw:branch)s at ethereum/go-ethereum@%(kw:go_revision)s for %(kw:release)s"',
                        branch=branch,
                        go_revision=get_short_revision_go,
                        release=release_name(release)),
                    workdir='brew',
                    decodeRC={
                        0: SUCCESS,
                        1: WARNINGS,
                        2: WARNINGS
                    }),
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="git-push",
                             descriptionDone='git push',
                             command='git pull --no-edit && git push',
                             workdir='brew')
        ]:
            factory.addStep(step)

    # Trigger Yosemite build
    if release == 'el_capitan':
        for step in [
                Trigger(name='brew-yosemite',
                        schedulerNames=["go-ethereum-%s-yosemite" % branch],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s"),
                            "revision": Interpolate("%(prop:buildnumber)s")
                        })
        ]:
            factory.addStep(step)

    return factory
Exemple #39
0
def cpp_ethereum_factory(branch='master',
                         deb=False,
                         evmjit=False,
                         headless=True):
    factory = BuildFactory()

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/cpp-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='cpp-ethereum',
                retry=(5, 3)),
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/tests.git',
                branch=branch,
                mode='incremental',
                codebase='tests',
                retry=(5, 3),
                workdir='tests'),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-protocol",
                command=
                'sed -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore/Common.cpp',
                property="protocol"),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                'sed -ne "s/^set(PROJECT_VERSION \\"\(.*\)\\")$/\\1/p" CMakeLists.txt',
                property="version"),
            Configure(haltOnFailure=True,
                      logEnviron=False,
                      command=cmake_cmd(["cmake", "."],
                                        evmjit=evmjit,
                                        headless=headless),
                      env={"PATH": "${QTDIR}/bin:${PATH}"}),
            Compile(
                haltOnFailure=True,
                logEnviron=False,
                command="make -j $(cat /proc/cpuinfo | grep processor | wc -l)"
            ),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="make-install",
                         description="installing",
                         descriptionDone="install",
                         command=["make", "install"]),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="ldconfig",
                         description="running ldconfig",
                         descriptionDone="ldconfig",
                         command=["ldconfig"]),
            Test(haltOnFailure=True,
                 warnOnFailure=True,
                 logEnviron=False,
                 name="test-cpp",
                 description="testing",
                 descriptionDone="test",
                 command=testeth_cmd(["./testeth"], evmjit=evmjit),
                 env={
                     'CTEST_OUTPUT_ON_FAILURE': '1',
                     'ETHEREUM_TEST_PATH':
                     Interpolate('%(prop:workdir)s/tests'),
                     'EVMJIT': '-cache=0'
                 },
                 workdir="build/test",
                 maxTime=900)
    ]:
        factory.addStep(step)

    # Trigger check and integration builders
    if not evmjit and not headless:
        for step in [
                Trigger(schedulerNames=["cpp-ethereum-%s-check" % branch],
                        waitForFinish=False,
                        set_properties={
                            "protocol": Interpolate("%(prop:protocol)s"),
                            "version": Interpolate("%(prop:version)s")
                        })
        ]:
            factory.addStep(step)

        # if branch is not 'master':
        #     for step in [
        #         Trigger(
        #             schedulerNames=["cpp-ethereum-integration"],
        #             waitForFinish=False,
        #             set_properties={
        #                 "database": Interpolate("%(prop:database)s"),
        #                 "protocol": Interpolate("%(prop:protocol)s"),
        #                 "version": Interpolate("%(prop:version)s")
        #             })
        #     ]: factory.addStep(step)

    # Trigger deb builders
    if not evmjit and headless:
        if deb:
            for architecture in ['i386', 'amd64']:
                for distribution in distributions:
                    for step in [
                            Trigger(schedulerNames=[
                                "cpp-ethereum-%s-%s-%s" %
                                (branch, architecture, distribution)
                            ],
                                    waitForFinish=False,
                                    set_properties={
                                        "version":
                                        Interpolate("%(prop:version)s")
                                    })
                    ]:
                        factory.addStep(step)

    # Trigger PoC server buildslave
    if deb and not evmjit and headless:
        for step in [
                Trigger(schedulerNames=["cpp-ethereum-%s-server" % branch],
                        waitForFinish=False,
                        set_properties={
                            "protocol": Interpolate("%(prop:protocol)s"),
                            "version": Interpolate("%(prop:version)s")
                        })
        ]:
            factory.addStep(step)

    return factory
def osx_go_factory(branch='develop', isPullRequest=False, headless=True):
    factory = BuildFactory()

    env = {
        "GOPATH": Interpolate("%(prop:workdir)s/go:%(prop:workdir)s/build/Godeps/_workspace"),
        "PKG_CONFIG_PATH": "/usr/local/opt/qt5/lib/pkgconfig",
        "CGO_CPPFLAGS": "-I/usr/local/opt/qt5/include/QtCore",
        "LD_LIBRARY_PATH": "/usr/local/opt/qt5/lib",
        'PATH': [Interpolate("%(prop:workdir)s/go/bin"), "${PATH}"]
    }

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-build.git',
            branch='master',
            mode='incremental',
            codebase='go-build',
            retry=(5, 3),
            workdir='go-build-%s' % branch
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-protocol",
            command='gsed -ne "s/.*ProtocolVersion    = \(.*\)/\\1/p" eth/protocol.go',
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-p2p",
            command='gsed -ne "s/.*baseProtocolVersion.*= \(.*\)/\\1/p" p2p/peer.go',
            property="p2p"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="update-version",
            command='gsed -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd/geth/main.go',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command=Interpolate("rm -rf %(prop:workdir)s/go"),
            description="cleaning up",
            descriptionDone="clean up",
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            description="moving src",
            descriptionDone="move src",
            command=_go_cmds(branch=branch),
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="install-geth",
            description="installing geth",
            descriptionDone="install geth",
            command="go install -v github.com/ethereum/go-ethereum/cmd/geth",
            env=env
        )
    ]: factory.addStep(step)

    if not headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="install-mist",
                description="installing mist",
                descriptionDone="install mist",
                command="go install -v github.com/ethereum/go-ethereum/cmd/mist",
                env=env
            )
        ]: factory.addStep(step)

    if not isPullRequest and headless:
        for step in [
            Trigger(
                schedulerNames=["go-ethereum-%s-brew" % branch],
                waitForFinish=False,
                set_properties={
                    "p2p": Interpolate("%(prop:p2p)s"),
                    "protocol": Interpolate("%(prop:protocol)s"),
                    "version": Interpolate("%(prop:version)s")
                }
            )
        ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com/ethereum/go-ethereum/...",
            env=env,
            maxTime=900
        )
    ]: factory.addStep(step)

    if not isPullRequest and not headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="go-build",
                description='go build',
                descriptionDone='go build',
                command=['python', 'build.py'],
                workdir='go-build-%s/osx' % branch,
                decodeRC={0:SUCCESS,1:WARNINGS,2:WARNINGS},
                env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
            ),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-sha1sum",
                command=Interpolate('sha1sum osx/Mist.dmg | grep -o -w "\w\{40\}"'),
                property='sha1sum',
                workdir='go-build-%s' % branch
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("Mist-OSX-%(kw:time_string)s-%(prop:version)s-%(prop:protocol)s-%(kw:short_revision)s.dmg", time_string=get_time_string, short_revision=get_short_revision_go)
            ),
            FileUpload(
                haltOnFailure=True,
                name='upload-mist',
                slavesrc="osx/Mist.dmg",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s"),
                workdir='go-build-%s' % branch
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description='cleaning latest link',
                descriptionDone= 'clean latest link',
                command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/Mist-OSX-latest.dmg")]
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description='linking latest',
                descriptionDone='link latest',
                command=['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/Mist-OSX-latest.dmg")]
            )
        ]: factory.addStep(step)

    return factory
def brew_go_factory(branch='develop', release='el_capitan'):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/homebrew-ethereum.git',
            branch='master',
            mode='incremental',
            codebase='homebrew-ethereum',
            retry=(5, 3),
            workdir='brew'
        )
    ]: factory.addStep(step)

    # Bump version and revision only once
    if release == 'el_capitan':
        if branch == 'master':
            for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-version",
                    descriptionDone='update go-ethereum version',
                    command=Interpolate('sed -i "" "s/^'
                                        '  version \'\(.*\)\'/'
                                        '  version \'%(prop:version)s\'/" ethereum.rb'),
                    workdir='brew',
                )
            ]: factory.addStep(step)

        elif branch == 'develop':
            for step in [
                ShellCommand(
                    haltOnFailure=True,
                    logEnviron=False,
                    name="update-version",
                    descriptionDone='update go-ethereum version',
                    command=Interpolate('sed -i "" "s/^'
                                        '    version \'\(.*\)\'/'
                                        '    version \'%(prop:version)s\'/" ethereum.rb'),
                    workdir='brew',
                )
            ]: factory.addStep(step)

        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add ethereum.rb',
                workdir='brew'
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "bump ethereum to %(prop:version)s on %(kw:branch)s"', branch=branch),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew'
            )
        ]: factory.addStep(step)
    else:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-pull",
                descriptionDone='git pull',
                command='git pull --no-edit',
                workdir='brew'
            )
        ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="cleanup",
            description='cleanup',
            descriptionDone='clean',
            command=["brew", "remove", "ethereum"],
            workdir='brew',
            decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="clean-up-bottles",
            description='cleaning up bottles',
            descriptionDone='clean up bottles',
            command="rm *.tar.gz",
            workdir='brew',
            decodeRC={0: SUCCESS, 1: SUCCESS, 2: WARNINGS}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="brew-update",
            description='brew updating',
            descriptionDone='brew update',
            command=["brew", "update"],
            workdir='brew'
        ),
        Compile(
            haltOnFailure=True,
            logEnviron=False,
            name="brew",
            description='running brew',
            descriptionDone='brew',
            command=brew_install_cmd(cmd=['brew', 'install', 'ethereum.rb', '-v', '--build-bottle'], branch=branch),
            workdir='brew'
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="bottle",
            command="brew bottle ethereum.rb -v%s > bottle.log" % (" --devel" if branch is "develop" else ""),
            logfiles={"bottle.log": "bottle.log"},
            lazylogfiles=True,
            description="bottling",
            descriptionDone="bottle",
            workdir='brew'
        ),
        SetPropertyFromCommand(
            name="set-bottle",
            command='sed -ne "s/.*Bottling \(.*\).../\\1/p" bottle.log',
            description="setting bottle",
            descriptionDone="set bottle",
            property="bottle",
            workdir="brew"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-sha256sum",
            command='sed -ne "s/.*sha256 \\"\(.*\)\\".*/\\1/p" bottle.log',
            property='sha256sum',
            workdir='brew'
        ),
        FileUpload(
            haltOnFailure=True,
            name='upload-bottle',
            slavesrc=Interpolate("%(prop:bottle)s"),
            masterdest=Interpolate(("public_html/builds/bottles%(kw:dev)s/"
                                   "ethereum-%(prop:version)s.%(kw:release)s.bottle.%(kw:revision)s.tar.gz"),
                                   dev="-dev" if branch == 'develop' else "",
                                   release=release,
                                   revision=revision_or_buildnumber),
            url=Interpolate("/builds/bottles%(kw:dev)s/"
                            "ethereum-%(prop:version)s.%(kw:release)s.bottle.%(kw:revision)s.tar.gz",
                            dev="-dev" if branch == 'develop' else "",
                            release=release,
                            revision=revision_or_buildnumber),
            workdir='brew'
        )
    ]: factory.addStep(step)

    if branch == 'master':
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-pull",
                descriptionDone='git pull',
                command='git pull --no-edit',
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-brew-revision",
                descriptionDone='update brew revision',
                command=Interpolate('sed -i "" "s/^'
                                    '    revision \(.*\)/'
                                    '    revision %(kw:revision)s/" ethereum.rb',
                                    revision=revision_or_buildnumber),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-sha256sum",
                descriptionDone='update sha256sum',
                command=Interpolate('sed -i "" "s/^'
                                    '    sha256 \'\(.*\)\' => :%(kw:release)s/'
                                    '    sha256 \'%(prop:sha256sum)s\' => :%(kw:release)s/" ethereum.rb', release=release),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add ethereum.rb',
                workdir='brew'
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "ethereum %(prop:version)s on %(kw:branch)s at ethereum/go-ethereum@%(kw:go_revision)s for %(kw:release)s"',
                                    branch=branch,
                                    go_revision=get_short_revision_go,
                                    release=release_name(release)),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew'
            )
        ]: factory.addStep(step)

    elif branch == 'develop':
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-pull",
                descriptionDone='git pull',
                command='git pull --no-edit',
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-brew-revision",
                descriptionDone='update brew revision',
                command=Interpolate('sed -i "" "s/^'
                                    '      revision \(.*\)/'
                                    '      revision %(kw:revision)s/" ethereum.rb',
                                    revision=revision_or_buildnumber),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-sha256sum",
                descriptionDone='update sha256sum',
                command=Interpolate('sed -i "" "s/^'
                                    '      sha256 \'\(.*\)\' => :%(kw:release)s/'
                                    '      sha256 \'%(prop:sha256sum)s\' => :%(kw:release)s/" ethereum.rb', release=release),
                workdir='brew'
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-add",
                descriptionDone='git add',
                command='git add ethereum.rb',
                workdir='brew'
            ),
            ShellCommand(
                logEnviron=False,
                name="git-commit",
                descriptionDone='git commit',
                command=Interpolate('git commit -m "ethereum %(prop:version)s on %(kw:branch)s at ethereum/go-ethereum@%(kw:go_revision)s for %(kw:release)s"',
                                    branch=branch,
                                    go_revision=get_short_revision_go,
                                    release=release_name(release)),
                workdir='brew',
                decodeRC={0: SUCCESS, 1: WARNINGS, 2: WARNINGS}
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="git-push",
                descriptionDone='git push',
                command='git pull --no-edit && git push',
                workdir='brew'
            )
        ]: factory.addStep(step)

    # Trigger Yosemite build
    if release == 'el_capitan':
        for step in [
            Trigger(
                name='brew-yosemite',
                schedulerNames=["go-ethereum-%s-yosemite" % branch],
                waitForFinish=False,
                set_properties={
                    "version": Interpolate("%(prop:version)s"),
                    "revision": Interpolate("%(prop:buildnumber)s")
                }
            )
        ]: factory.addStep(step)

    return factory
def osx_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "GOPATH":
        Interpolate(
            "%(prop:workdir)s/go:%(prop:workdir)s/build/Godeps/_workspace"),
        'PATH': [Interpolate("%(prop:workdir)s/go/bin"), "${PATH}"]
    }

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/go-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='go-ethereum',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="update-version",
                command=
                'gsed -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION',
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="go-cleanup",
                         command=Interpolate("rm -rf %(prop:workdir)s/go"),
                         description="cleaning up",
                         descriptionDone="clean up",
                         env={"GOPATH": Interpolate("%(prop:workdir)s/go")}),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="move-src",
                         description="moving src",
                         descriptionDone="move src",
                         command=_go_cmds(branch=branch),
                         env={"GOPATH": Interpolate("%(prop:workdir)s/go")}),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="install-geth",
                description="installing geth",
                descriptionDone="install geth",
                command=
                "go install -v github.com/ethereum/go-ethereum/cmd/geth",
                env=env)
    ]:
        factory.addStep(step)

    for step in [
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="go-test",
                         description="go testing",
                         descriptionDone="go test",
                         command="go test github.com/ethereum/go-ethereum/...",
                         env=env,
                         maxTime=900)
    ]:
        factory.addStep(step)

    if not isPullRequest:
        for step in [
                Trigger(name='brew-el-capitan',
                        schedulerNames=["go-ethereum-%s-el-capitan" % branch],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s")
                        })
        ]:
            factory.addStep(step)

    return factory
def windows_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "GOPATH":
        Interpolate(
            "%(prop:workdir)s\\go;%(prop:workdir)s\\build\\Godeps\\_workspace"
        ),
        'PATH': [Interpolate("%(prop:workdir)s\\go\\bin"), "${PATH}"]
    }

    sed = '"C:\\Program Files (x86)\\GnuWin32\\bin\\sed.exe"'
    zip_ = '"C:\\Program Files (x86)\\GnuWin32\\bin\\zip.exe"'

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/go-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='go-ethereum',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command='%s -ne "s/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" VERSION'
                % sed,
                property="version"),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="go-cleanup",
                command=Interpolate(
                    "rd /s /q %(prop:workdir)s\\go && mkdir %(prop:workdir)s\\go"
                ),
                description="cleaning up",
                descriptionDone="clean up"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="move-src",
                         description="moving src",
                         descriptionDone="move src",
                         command=_go_cmds_win(branch=branch),
                         env={"GOPATH": Interpolate("%(prop:workdir)s\go")}),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="build-geth",
                description="building geth",
                descriptionDone="build geth",
                command="go build -v github.com\ethereum\go-ethereum\cmd\geth",
                env=env)
    ]:
        factory.addStep(step)

    for step in [
            ShellCommand(flunkOnFailure=False,
                         warnOnFailure=True,
                         logEnviron=False,
                         name="go-test",
                         description="go testing",
                         descriptionDone="go test",
                         command="go test github.com\ethereum\go-ethereum\...",
                         env=env,
                         maxTime=900)
    ]:
        factory.addStep(step)

    if not isPullRequest:
        for step in [
                ShellCommand(haltOnFailure=True,
                             logEnviron=False,
                             name="zip",
                             description='zipping',
                             descriptionDone='zipped',
                             command="%s geth.zip geth.exe" % zip_),
                SetProperty(
                    description="setting filename",
                    descriptionDone="set filename",
                    name="set-filename",
                    property="filename",
                    value=Interpolate(
                        "Geth-Win64-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.zip",
                        time_string=get_time_string,
                        short_revision=get_short_revision_go)),
                FileUpload(
                    haltOnFailure=True,
                    name='upload',
                    slavesrc="geth.zip",
                    masterdest=Interpolate(
                        "public_html/builds/%(prop:buildername)s/%(prop:filename)s"
                    ),
                    url=Interpolate(
                        "/builds/%(prop:buildername)s/%(prop:filename)s")),
                MasterShellCommand(
                    name="clean-latest-link",
                    description='cleaning latest link',
                    descriptionDone='clean latest link',
                    command=[
                        'rm', '-f',
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/Geth-Win64-latest.zip"
                        )
                    ]),
                MasterShellCommand(
                    haltOnFailure=True,
                    name="link-latest",
                    description='linking latest',
                    descriptionDone='link latest',
                    command=[
                        'ln', '-sf',
                        Interpolate("%(prop:filename)s"),
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/Geth-Win64-latest.zip"
                        )
                    ])
        ]:
            factory.addStep(step)

    return factory
Exemple #44
0
def win_cpp_factory(branch='master', isPullRequest=False):
    factory = BuildFactory()

    sed = '"C:\\Program Files (x86)\\GnuWin32\\bin\\sed.exe"'

    for step in [
            Git(haltOnFailure=True,
                logEnviron=False,
                repourl='https://github.com/ethereum/cpp-ethereum.git',
                branch=branch,
                mode='full',
                method='copy',
                codebase='cpp-ethereum',
                retry=(5, 3)),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-protocol",
                command=
                '%s -ne "s/.*c_protocolVersion = \(.*\);/\\1/p" libethcore\Common.cpp'
                % sed,
                property="protocol"),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-version",
                command=
                '%s -ne "s/^set(PROJECT_VERSION \\"\(.*\)\\")$/\\1/p" CMakeLists.txt'
                % sed,
                property="version"),
            ShellCommand(haltOnFailure=True,
                         logEnviron=False,
                         name="dependencies",
                         description='dependencies',
                         descriptionDone='dependencies',
                         command=['getstuff.bat'],
                         workdir="build/extdep"),
            Configure(haltOnFailure=True,
                      logEnviron=False,
                      command=["cmake", ".", "-G", "Visual Studio 12 Win64"]),
            MsBuild12(haltOnFailure=True,
                      logEnviron=False,
                      projectfile="ethereum.sln",
                      config="Release",
                      platform="x64")
    ]:
        factory.addStep(step)

    if not isPullRequest:
        for step in [
                MsBuild12(haltOnFailure=True,
                          logEnviron=False,
                          name="installer",
                          projectfile="PACKAGE.vcxproj",
                          config="Release",
                          platform="x64"),
                SetProperty(
                    description="setting filename",
                    descriptionDone="set filename",
                    name="set-filename",
                    property="filename",
                    value=Interpolate(
                        "Ethereum-%(prop:version)s-win64-%(kw:time_string)s-%(kw:short_revision)s.exe",
                        time_string=get_time_string,
                        short_revision=get_short_revision)),
                FileUpload(
                    name="upload",
                    slavesrc=Interpolate(
                        "Ethereum-%(prop:version)s-win64.exe"),
                    masterdest=Interpolate(
                        "public_html/builds/%(prop:buildername)s/%(prop:filename)s"
                    ),
                    url=Interpolate(
                        "/builds/%(prop:buildername)s/%(prop:filename)s")),
                MasterShellCommand(
                    name="clean-latest-link",
                    description='cleaning latest link',
                    descriptionDone='clean latest link',
                    command=[
                        'rm', '-f',
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/Ethereum-win64-latest.exe"
                        )
                    ]),
                MasterShellCommand(
                    haltOnFailure=True,
                    name="link-latest",
                    description='linking latest',
                    descriptionDone='link latest',
                    command=[
                        'ln', '-sf',
                        Interpolate("%(prop:filename)s"),
                        Interpolate(
                            "public_html/builds/%(prop:buildername)s/Ethereum-win64-latest.exe"
                        )
                    ])
        ]:
            factory.addStep(step)

    return factory
def backport_factory(name=None, setVersion=False, repo='expanse-qt', distribution='trusty', architecture='amd64', packages=[]):
    factory = BuildFactory()

    for package in packages:
        cmd = ["backportpackage", "--dont-sign", "-w", "result", "-d", distribution]
        if setVersion:
            cmd.extend(["-v", Interpolate("%(prop:version)s")])
        cmd.append(package)

        for step in [
            # Create backport
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="backport-%s" % package,
                description='backporting %s' % package,
                descriptionDone='backport %s' % package,
                command=cmd,
                env={
                    "DEBFULLNAME": "caktux (Buildserver key)",
                    "DEBEMAIL": "*****@*****.**",
                    "UBUMAIL": "*****@*****.**"
                }
            )
        ]: factory.addStep(step)

    for step in [
        # Prepare .changes file for Launchpad
        ShellCommand(
            name='prepare-changes',
            description='preparing changes',
            descriptionDone='prepare changes',
            command=Interpolate('sed -i -e s/%(kw:dist)s-backports/%(kw:dist)s/ -e s/urgency=medium/urgency=low/ *.changes', dist=distribution),
            workdir="build/result"
        ),
        # Upload result folder
        DirectoryUpload(
            slavesrc="result",
            masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
            url=Interpolate("/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
        ),
        # Clean latest link
        MasterShellCommand(
            name='clean-latest',
            description='cleaning latest link',
            descriptionDone='clean latest link',
            command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),
        # Link latest
        MasterShellCommand(
            name='link-latest',
            description='linking latest',
            descriptionDone='link latest',
            command=['ln', '-sf', Interpolate("%(prop:buildnumber)s"), Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),
        # Create source changes folders
        MasterShellCommand(
            name='mkdir-changes',
            description='mkdir',
            descriptionDone='mkdir',
            command=['mkdir', '-p', Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s", dist=distribution, arch=architecture, name=name)]
        ),
        # Link source changes
        MasterShellCommand(
            name='link-changes',
            description='linking changes',
            descriptionDone='link changes',
            command=['ln', '-sf', Interpolate("../../../../public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
                     Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s",
                     dist=distribution, arch=architecture, name=name)]
        ),
        # debsign
        MasterShellCommand(
            haltOnFailure=False,
            flunkOnFailure=False,
            name='debsign',
            description='debsigning',
            descriptionDone='debsign',
            command=Interpolate("debsign changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/*.changes",
                                dist=distribution, arch=architecture, name=name)
        ),
        # dput
        MasterShellCommand(
            name='dput',
            description='dputting',
            descriptionDone='dput',
            command=Interpolate("dput ppa:expanse/%(kw:repo)s changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/*.changes",
                                repo=repo, dist=distribution, arch=architecture, name=name)
        )
    ]: factory.addStep(step)

    return factory
def go_ethereum_factory(branch='master', deb=False):
    factory = BuildFactory()
    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd/geth/main.go',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command="rm -rf $GOPATH",
            description="cleaning up",
            descriptionDone="clean up"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            command=_go_cmds(branch=branch),
            description="moving src",
            descriptionDone="move src"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="install-geth",
            description="installing geth",
            descriptionDone="install geth",
            command="go install -v github.com/ethereum/go-ethereum/cmd/geth",
            env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")}
        )
    ]: factory.addStep(step)

    for step in [
        ShellCommand(
            haltOnFailure=True,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com/ethereum/go-ethereum/...",
            env={"GOPATH": Interpolate("${GOPATH}:%(prop:workdir)s/build/Godeps/_workspace")},
            maxTime=900
        )
    ]: factory.addStep(step)

    if deb:
        for architecture in ['i386', 'amd64']:
            for distribution in distributions:
                for step in [
                    Trigger(
                        schedulerNames=["go-ethereum-%s-%s-%s" % (branch, architecture, distribution)],
                        waitForFinish=False,
                        set_properties={
                            "version": Interpolate("%(prop:version)s")
                        }
                    )
                ]: factory.addStep(step)

    return factory
def osx_cpp_factory(branch="develop", isPullRequest=False, evmjit=False, headless=True):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl="https://github.com/ethereum/cpp-ethereum.git",
            branch=branch,
            mode="full",
            method="copy",
            codebase="cpp-ethereum",
            retry=(5, 3),
        ),
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl="https://github.com/ethereum/tests.git",
            branch=branch,
            mode="incremental",
            codebase="tests",
            retry=(5, 3),
            workdir="tests",
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/^set(PROJECT_VERSION \\"\(.*\)\\")$/\\1/p" CMakeLists.txt',
            property="version",
        ),
        Configure(
            haltOnFailure=True,
            logEnviron=False,
            command=cmake_osx_cmd(["cmake", "."], evmjit=evmjit, headless=headless),
        ),
        Compile(haltOnFailure=True, logEnviron=False, command="make -j $(sysctl -n hw.ncpu)"),
    ]:
        factory.addStep(step)

    if not headless:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="make-install",
                description="running make install",
                descriptionDone="make install",
                command=["make", "install"],
                workdir="build/alethzero",
            ),
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="make-install-mix",
                description="running mix make install",
                descriptionDone="make install mix",
                command=["make", "install"],
                workdir="build/mix",
            ),
        ]:
            factory.addStep(step)

    for step in [
        Test(
            haltOnFailure=True,
            warnOnFailure=True,
            logEnviron=False,
            name="test-cpp",
            description="testing",
            descriptionDone="test",
            command=testeth_cmd(["./testeth"], evmjit=evmjit),
            env={"CTEST_OUTPUT_ON_FAILURE": "1", "ETHEREUM_TEST_PATH": Interpolate("%(prop:workdir)s/tests")},
            workdir="build/test",
            maxTime=900,
        )
    ]:
        factory.addStep(step)

    # Trigger check
    if not evmjit and not headless:
        for step in [
            Trigger(
                schedulerNames=["cpp-ethereum-%s-osx-check" % branch],
                waitForFinish=False,
                set_properties={"version": Interpolate("%(prop:version)s")},
            )
        ]:
            factory.addStep(step)

    # Trigger deb builders
    if not evmjit and headless:
        if not isPullRequest:
            for step in [
                Trigger(
                    schedulerNames=["cpp-ethereum-%s-brew" % branch],
                    waitForFinish=False,
                    set_properties={"version": Interpolate("%(prop:version)s")},
                )
            ]:
                factory.addStep(step)

    # Package AlethZero.app
    if not isPullRequest and not headless:
        for step in [
            Compile(haltOnFailure=True, logEnviron=False, command="make -j $(sysctl -n hw.ncpu) appdmg"),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-sha1sum",
                command=Interpolate('sha1sum Ethereum.dmg | grep -o -w "\w\{40\}"'),
                property="sha1sum",
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate(
                    "AlethZero-OSX-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.dmg",
                    time_string=get_time_string,
                    short_revision=get_short_revision,
                ),
            ),
            FileUpload(
                haltOnFailure=True,
                name="upload-alethzero",
                slavesrc="Ethereum.dmg",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("builds/%(prop:buildername)s/%(prop:filename)s"),
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description="cleaning latest link",
                descriptionDone="clean latest link",
                command=["rm", "-f", Interpolate("public_html/builds/%(prop:buildername)s/AlethZero-OSX-latest.dmg")],
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description="linking latest",
                descriptionDone="link latest",
                command=[
                    "ln",
                    "-sf",
                    Interpolate("%(prop:filename)s"),
                    Interpolate("public_html/builds/%(prop:buildername)s/AlethZero-OSX-latest.dmg"),
                ],
            ),
        ]:
            factory.addStep(step)

    return factory
Exemple #48
0
def deb_factory(name=None, repourl=None, ppabranch=None, branch='master', distribution='trusty', architecture='i386'):
    factory = BuildFactory()

    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl=repourl,
            branch=branch,
            mode='full',
            method='copy',
            retry=(5, 3)
        ),

        # Set snapshot property for Launchpad versioning
        SetProperty(
            description="setting snapshot",
            descriptionDone="set snapshot",
            name="set-snapshot",
            property="snapshot",
            value=Interpolate("+%(prop:buildnumber)s%(kw:snapshot)s%(kw:distribution)s", snapshot=(dev_snapshot if branch=='develop' else ""), distribution=distribution)
        )
    ]: factory.addStep(step)

    # Run 'go get' for go-ethereum
    if name == 'ethereum':
        for step in [
            ShellCommand(
                haltOnFailure = True,
                logEnviron = False,
                name = "move-src",
                command=_go_cmds(branch=branch),
                description="moving src",
                descriptionDone="move src",
                env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
            ),
            ShellCommand(
                logEnviron = False,
                name="source-tarball",
                description="creating source tarball",
                descriptionDone="create source tarball",
                command=Interpolate("tar --exclude .git --exclude pkg --exclude bin -czf ../%(kw:name)s_%(prop:version)s%(prop:snapshot)s.orig.tar.gz .", name=name),
                workdir=Interpolate("%(prop:workdir)s/go")
            ),
            # clean up the Git checkout for debuild
            ShellCommand(
                logEnviron = False,
                name = "clean-build",
                command="rm -rf build && mkdir build",
                description="cleaning build",
                descriptionDone="clean build",
                workdir=Interpolate("%(prop:workdir)s")
            )
        ]: factory.addStep(step)
    # Get qtwebengine-opensource-src tarball
    elif name == 'qtwebengine-opensource-src':
        for step in [
            ShellCommand(
                logEnviron = False,
                name="source-tarball",
                description="getting source tarball",
                descriptionDone="get source tarball",
                command=Interpolate("wget -c https://download.qt.io/official_releases/qt/5.4/%(kw:version)s/submodules/qtwebengine-opensource-src-%(kw:version)s.tar.xz -O ../%(kw:name)s_%(prop:version)s%(prop:snapshot)s.orig.tar.xz", name=name, version=branch)
            ),
            # clean up the Git checkout for debuild
            ShellCommand(
                logEnviron = False,
                name = "clean-build",
                command="rm -rf build && mkdir build",
                description="cleaning build",
                descriptionDone="clean build",
                workdir=Interpolate("%(prop:workdir)s")
            )
        ]: factory.addStep(step)
    # Just create the source tarball for others
    else:
        factory.addStep(ShellCommand(
            logEnviron = False,
            name="source-tarball",
            description="creating source tarball",
            descriptionDone="create source tarball",
            command=Interpolate("tar --exclude .git -czf ../%(kw:name)s_%(kw:version)s%(prop:snapshot)s.orig.tar.gz .", name=name, version=deb_version)
        ))

    for step in [
        # Get debian/ directory
        ShellCommand(
            logEnviron = False,
            name="get-debian",
            description="getting debian folder",
            descriptionDone="get debian folder",
            command=Interpolate("wget https://github.com/ethereum/ethereum-ppa/archive/%(kw:ppabranch)s.tar.gz -O- | tar -zx --exclude package.sh --exclude README.md --strip-components=1", ppabranch=ppabranch)
        ),

        # Bump version
        ShellCommand(
            logEnviron = False,
            name="bump-debian",
            description="bumping %s deb version" % distribution,
            descriptionDone="bump %s deb version" % distribution,
            command=Interpolate("EMAIL='caktux (Buildserver key) <*****@*****.**>' dch -v %(prop:version)s%(prop:snapshot)s-0ubuntu1 'git build of %(prop:got_revision)s'", dist=distribution)
        ),

        # Build a source package
        ShellCommand(
            logEnviron = False,
            name="source-package",
            description="debuilding %s" % distribution,
            descriptionDone="debuild %s" % distribution,
            command="debuild -S -sa -us -uc"
        ),
    ]: factory.addStep(step)

    # Source only packages for dependencies, build local deb packages otherwise
    if name in ['ethereum', 'cpp-ethereum']:
        # Add pbuilderrc with ccache config
        # factory.addStep(FileDownload(
        #     mastersrc="pbuilderrc",
        #     slavedest="~/.pbuilderrc"
        # ))
        main_ppa = "http://ppa.launchpad.net/ethereum/ethereum/ubuntu"
        dev_ppa = "http://ppa.launchpad.net/ethereum/ethereum-dev/ubuntu"
        qt_ppa = "http://ppa.launchpad.net/ethereum/ethereum-qt/ubuntu"

        # Set othermirror for pbuilder
        if name == 'ethereum':
            factory.addStep(ShellCommand(
                logEnviron = False,
                name="pbuilder-opts",
                description="setting pbuilderrc",
                descriptionDone="set pbuilderrc",
                command="echo 'OTHERMIRROR=\"deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main|deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main\"' > ~/.pbuilderrc" % (
                        main_ppa, distribution,
                        main_ppa, distribution,
                        qt_ppa, distribution,
                        qt_ppa, distribution),
            ))
        elif name == 'cpp-ethereum':
            if branch == 'develop':
                factory.addStep(ShellCommand(
                    logEnviron = False,
                    name="pbuilder-opts",
                    description="setting pbuilderrc",
                    descriptionDone="set pbuilderrc",
                    command="echo 'OTHERMIRROR=\"deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main|deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main|deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main\"' > ~/.pbuilderrc" % (
                            main_ppa, distribution,
                            main_ppa, distribution,
                            dev_ppa, distribution,
                            dev_ppa, distribution,
                            qt_ppa, distribution,
                            qt_ppa, distribution),
                ))
            else:
                factory.addStep(ShellCommand(
                    logEnviron = False,
                    name="pbuilder-opts",
                    description="setting pbuilderrc",
                    descriptionDone="set pbuilderrc",
                    command="echo 'OTHERMIRROR=\"deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main|deb [trusted=yes] %s %s main|deb-src [trusted=yes] %s %s main\"' > ~/.pbuilderrc" % (
                            main_ppa, distribution,
                            main_ppa, distribution,
                            qt_ppa, distribution,
                            qt_ppa, distribution),
                ))

        for step in [
            # Package that thing already
            UbuCowbuilder(
                logEnviron = False,
                architecture=architecture,
                distribution=distribution,
                basetgz="/var/cache/pbuilder/%s-%s-ethereum.cow" % (distribution, architecture),
                keyring="/usr/share/keyrings/ubuntu-archive-keyring.gpg"
            )
        ]: factory.addStep(step)

    for step in [
        # Run Lintian
        # DebLintian(
        #     fileloc=Interpolate("%(prop:deb-changes)s")
        # ),
        # Prepare .changes file for Launchpad
        ShellCommand(
            name='prepare-changes',
            description='preparing changes',
            descriptionDone='prepare changes',
            command=Interpolate('sed -i -e s/UNRELEASED/%(kw:dist)s/ -e s/urgency=medium/urgency=low/ ../*.changes', dist=distribution)
        ),

        # Gather artefacts
        ShellCommand(
            haltOnFailure=True,
            logEnviron = False,
            name="move-packages",
            description='moving packages',
            descriptionDone='move packages',
            command="mkdir result; mv %s../*.changes ../*.dsc ../*.gz %sresult/" % ("*.deb *.changes " if name in ['ethereum', 'cpp-ethereum'] else "", "../*.xz " if name == 'qtwebengine-opensource-src' else ""),
        ),

        # Upload result folder
        DirectoryUpload(
            slavesrc="result",
            masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
            url=Interpolate("/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
        ),

        # Clean latest link
        MasterShellCommand(
            name='clean-latest',
            description='cleaning latest link',
            descriptionDone='clean latest link',
            command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),

        # Link latest
        MasterShellCommand(
            name='link-latest',
            description='linking latest',
            descriptionDone='link latest',
            command=['ln', '-sf', Interpolate("%(prop:buildnumber)s"), Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),

        # Create source changes folders
        MasterShellCommand(
            name='mkdir-changes',
            description='mkdir',
            descriptionDone='mkdir',
            command=['mkdir', '-p', Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s", dist=distribution, arch=architecture, name=name)]
        ),

        # Link source changes
        MasterShellCommand(
            name='link-changes',
            description='linking changes',
            descriptionDone='link changes',
            command=['ln', '-sf', Interpolate("../../../../public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"), Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s", dist=distribution, arch=architecture, name=name)]
        )
    ]: factory.addStep(step)

    # Use ethereum-dev ppa for snapshots, only dput one source pkg
    if architecture == 'amd64':
        for step in [
            # debsign
            MasterShellCommand(
                haltOnFailure=False,
                flunkOnFailure=False,
                name='debsign',
                description='debsigning',
                descriptionDone='debsign',
                command=['debsign', Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/%(kw:name)s_%(kw:version)s%(prop:snapshot)s-0ubuntu1_source.changes", dist=distribution, arch=architecture, name=name, version=deb_version)]
            ),
            # dput
            MasterShellCommand(
                name='dput',
                description='dputting',
                descriptionDone='dput',
                command=['dput', 'ppa:ethereum/ethereum%s' % ("-dev" if branch=='develop' or (name == 'libjson-rpc-cpp' and jsonrpc_for_develop) else ("-qt" if name == 'qtwebengine-opensource-src' else "")), Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/%(kw:name)s_%(kw:version)s%(prop:snapshot)s-0ubuntu1_source.changes", dist=distribution, arch=architecture, name=name, version=deb_version)]
            )
        ]: factory.addStep(step)

    return factory
def arm_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "GOPATH": Interpolate("%(prop:workdir)s/go:%(prop:workdir)s/build/Godeps/_workspace"),
        "CC": "arm-linux-gnueabi-gcc",
        "GOOS": "linux",
        "GOARCH": "arm",
        "CGO_ENABLED": "1",
        "GOARM": "5",
        'PATH': [Interpolate("%(prop:workdir)s/go/bin"), "${PATH}"]
    }

    for step in [
        Git(
            haltOnFailure = True,
            logEnviron = False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-protocol",
            command='sed -ne "s/.*ProtocolVersion    = \(.*\)/\\1/p" eth/protocol.go',
            property="protocol"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-p2p",
            command='sed -ne "s/.*baseProtocolVersion.*= \(.*\)/\\1/p" p2p/peer.go',
            property="p2p"
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='sed -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd/geth/main.go',
            property="version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command=Interpolate("rm -rf %(prop:workdir)s/go"),
            description="cleaning up",
            descriptionDone="clean up",
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            command=_go_cmds(branch=branch),
            description="moving src",
            descriptionDone="move src",
            env={"GOPATH": Interpolate("%(prop:workdir)s/go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="build-geth",
            description="building geth",
            descriptionDone="build geth",
            command="go build -v github.com/ethereum/go-ethereum/cmd/geth",
            env=env
        )
    ]: factory.addStep(step)

    # for step in [
    #     ShellCommand(
    #         haltOnFailure=True,
    #         name="go-test",
    #         description="go testing",
    #         descriptionDone="go test",
    #         command="go test github.com/ethereum/go-ethereum/...",
    #         env=env,
    #         maxTime=900
    #     )
    # ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="tar-geth",
                description='packing',
                descriptionDone='pack',
                command=['tar', '-cjf', 'geth.tar.bz2', 'geth']
            ),
            SetPropertyFromCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="set-sha256sum",
                command=Interpolate('sha256sum geth.tar.bz2 | grep -o -w "\w\{64\}"'),
                property='sha256sum'
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("geth-ARM-%(kw:time_string)s-%(prop:version)s-%(prop:protocol)s-%(kw:short_revision)s.tar.bz2", time_string=get_time_string, short_revision=get_short_revision_go)
            ),
            FileUpload(
                haltOnFailure=True,
                name='upload-geth',
                slavesrc="geth.tar.bz2",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description='cleaning latest link',
                descriptionDone= 'clean latest link',
                command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2")]
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description='linking latest',
                descriptionDone='link latest',
                command=['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/geth-ARM-latest.tar.bz2")]
            )
        ]: factory.addStep(step)

    return factory
def windows_go_factory(branch='develop', isPullRequest=False):
    factory = BuildFactory()

    env = {
        "GOPATH": Interpolate("%(prop:workdir)s\\go;%(prop:workdir)s\\build\\Godeps\\_workspace"),
        'PATH': [Interpolate("%(prop:workdir)s\\go\\bin"), "${PATH}"]
    }

    sed = '"C:\\Program Files (x86)\\GnuWin32\\bin\\sed.exe"'
    zip_ = '"C:\\Program Files (x86)\\GnuWin32\\bin\\zip.exe"'

    for step in [
        Git(
            haltOnFailure=True,
            logEnviron=False,
            repourl='https://github.com/ethereum/go-ethereum.git',
            branch=branch,
            mode='full',
            method='copy',
            codebase='go-ethereum',
            retry=(5, 3)
        ),
        SetPropertyFromCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="set-version",
            command='%s -ne "s/.*Version.*=\s*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*/\\1/p" cmd\geth\main.go' % sed,
            property = "version"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="go-cleanup",
            command=Interpolate("rd /s /q %(prop:workdir)s\\go && mkdir %(prop:workdir)s\\go"),
            description="cleaning up",
            descriptionDone="clean up"
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="move-src",
            description="moving src",
            descriptionDone="move src",
            command=_go_cmds_win(branch=branch),
            env={"GOPATH": Interpolate("%(prop:workdir)s\go")}
        ),
        ShellCommand(
            haltOnFailure=True,
            logEnviron=False,
            name="build-geth",
            description="building geth",
            descriptionDone="build geth",
            command="go build -v github.com\ethereum\go-ethereum\cmd\geth",
            env=env
        )
    ]: factory.addStep(step)

    for step in [
        ShellCommand(
            flunkOnFailure=False,
            warnOnFailure=True,
            logEnviron=False,
            name="go-test",
            description="go testing",
            descriptionDone="go test",
            command="go test github.com\ethereum\go-ethereum\...",
            decodeRC={0: SUCCESS, -1: WARNINGS, 1: WARNINGS, 2: WARNINGS},
            env=env,
            maxTime=900
        )
    ]: factory.addStep(step)

    if not isPullRequest:
        for step in [
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="zip",
                description='zipping',
                descriptionDone='zipped',
                command="%s geth.zip geth.exe" % zip_
            ),
            SetProperty(
                description="setting filename",
                descriptionDone="set filename",
                name="set-filename",
                property="filename",
                value=Interpolate("Geth-Win64-%(kw:time_string)s-%(prop:version)s-%(kw:short_revision)s.zip",
                                  time_string=get_time_string,
                                  short_revision=get_short_revision_go)
            ),
            FileUpload(
                haltOnFailure=True,
                name='upload',
                slavesrc="geth.zip",
                masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:filename)s"),
                url=Interpolate("/builds/%(prop:buildername)s/%(prop:filename)s")
            ),
            MasterShellCommand(
                name="clean-latest-link",
                description='cleaning latest link',
                descriptionDone='clean latest link',
                command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/Geth-Win64-latest.zip")]
            ),
            MasterShellCommand(
                haltOnFailure=True,
                name="link-latest",
                description='linking latest',
                descriptionDone='link latest',
                command=['ln', '-sf', Interpolate("%(prop:filename)s"), Interpolate("public_html/builds/%(prop:buildername)s/Geth-Win64-latest.zip")]
            )
        ]: factory.addStep(step)

    return factory
Exemple #51
0
def backport_factory(name=None, setVersion=False, repo='ethereum-qt', distribution='trusty', architecture='amd64', packages=[]):
    factory = BuildFactory()

    for package in packages:
        cmd = ["backportpackage", "--dont-sign", "-w", "result", "-d", distribution]
        if setVersion:
            cmd.extend(["-v", Interpolate("%(prop:version)s")])
        cmd.append(package)

        for step in [
            # Create backport
            ShellCommand(
                haltOnFailure=True,
                logEnviron=False,
                name="backport-%s" % package,
                description='backporting %s' % package,
                descriptionDone='backport %s' % package,
                command=cmd,
                env={
                    "DEBFULLNAME": "caktux (Buildserver key)",
                    "DEBEMAIL": "*****@*****.**",
                    "UBUMAIL": "*****@*****.**"
                }
            )
        ]: factory.addStep(step)

    for step in [
        # Prepare .changes file for Launchpad
        ShellCommand(
            name='prepare-changes',
            description='preparing changes',
            descriptionDone='prepare changes',
            command=Interpolate('sed -i -e s/%(kw:dist)s-backports/%(kw:dist)s/ -e s/urgency=medium/urgency=low/ *.changes', dist=distribution),
            workdir="build/result"
        ),
        # Upload result folder
        DirectoryUpload(
            slavesrc="result",
            masterdest=Interpolate("public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
            url=Interpolate("/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
        ),
        # Clean latest link
        MasterShellCommand(
            name='clean-latest',
            description='cleaning latest link',
            descriptionDone='clean latest link',
            command=['rm', '-f', Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),
        # Link latest
        MasterShellCommand(
            name='link-latest',
            description='linking latest',
            descriptionDone='link latest',
            command=['ln', '-sf', Interpolate("%(prop:buildnumber)s"), Interpolate("public_html/builds/%(prop:buildername)s/latest")]
        ),
        # Create source changes folders
        MasterShellCommand(
            name='mkdir-changes',
            description='mkdir',
            descriptionDone='mkdir',
            command=['mkdir', '-p', Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s", dist=distribution, arch=architecture, name=name)]
        ),
        # Link source changes
        MasterShellCommand(
            name='link-changes',
            description='linking changes',
            descriptionDone='link changes',
            command=['ln', '-sf', Interpolate("../../../../public_html/builds/%(prop:buildername)s/%(prop:buildnumber)s"),
                     Interpolate("changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s",
                     dist=distribution, arch=architecture, name=name)]
        ),
        # debsign
        MasterShellCommand(
            haltOnFailure=False,
            flunkOnFailure=False,
            name='debsign',
            description='debsigning',
            descriptionDone='debsign',
            command=Interpolate("debsign changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/*.changes",
                                dist=distribution, arch=architecture, name=name)
        ),
        # dput
        MasterShellCommand(
            name='dput',
            description='dputting',
            descriptionDone='dput',
            command=Interpolate("dput ppa:ethereum/%(kw:repo)s changes/%(kw:dist)s/%(kw:arch)s/%(kw:name)s/%(prop:buildnumber)s/*.changes",
                                repo=repo, dist=distribution, arch=architecture, name=name)
        )
    ]: factory.addStep(step)

    return factory