GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

target_tasks.py 3.78 KB
Newer Older
1 2 3 4 5 6
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from __future__ import absolute_import, print_function, unicode_literals

7 8 9
from taskgraph.target_tasks import _target_task, filter_for_tasks_for


10 11 12 13 14
@_target_task('default')
def target_tasks_default(full_task_graph, parameters, graph_config):
    """Target the tasks which have indicated they should be run on this project
    via the `run_on_projects` attributes."""

15
    filter = filter_for_tasks_for
16 17 18 19 20 21
    return [l for l, t in full_task_graph.tasks.iteritems() if filter_for_tasks_for(t, parameters)]


@_target_task('release')
def target_tasks_default(full_task_graph, parameters, graph_config):

22
    # TODO Use shipping-phase once we retire github-releases
23
    def filter(task, parameters):
24 25 26 27 28 29
        # Mark-as-shipped is always red on github-release and it confuses people.
        # This task cannot be green if we kick off a release through github-releases, so
        # let's exlude that task there.
        if task.kind == "mark-as-shipped" and parameters["tasks_for"] == "github-release":
            return False

30
        return task.attributes.get("release-type", "") == parameters["release_type"]
31

32
    return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
33 34


35 36 37 38
@_target_task("nightly")
def target_tasks_nightly(full_task_graph, parameters, graph_config):
    """Select the set of tasks required for a nightly build."""

39 40 41
    def filter(task, parameters):
        # We don't want to ship nightly while Google Play is still behind manual review.
        # See bug 1628413 for more context.
42
        return task.attributes.get("nightly", False) and task.kind != "push-apk"
43 44 45 46 47 48 49 50

    return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]


@_target_task("nightly-on-google-play")
def target_tasks_nightly_on_google_play(full_task_graph, parameters, graph_config):
    """Select the set of tasks required for a nightly build that goes on Google Play."""

51
    def filter(task, parameters):
52 53 54 55 56 57 58
        return (
            task.attributes.get("nightly", False) and
            # This target_task is temporary while Google Play processes APKs slower than usually
            # (bug 1628413). So we want this target task to be only about shipping APKs to GP and
            # not doing any other miscellaneous tasks like performance testing
            task.kind not in ("browsertime", "visual-metrics", "raptor")
        )
59 60

    return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
61

62 63 64 65

def _filter_fennec(fennec_type, task, parameters):
    return task.attributes.get("build-type", "") == "fennec-{}".format(fennec_type)

66

67
@_target_task("fennec-production")
68
def target_tasks_fennec_nightly(full_task_graph, parameters, graph_config):
69
    """Select the set of tasks required for a production build signed with the fennec key."""
70

71
    return [l for l, t in full_task_graph.tasks.iteritems() if _filter_fennec("production", t, parameters)]
72

73

74 75 76 77 78 79 80 81
@_target_task("bump_android_components")
def target_tasks_bump_android_components(full_task_graph, parameters, graph_config):
    """Select the set of tasks required to update android components."""

    def filter(task, parameters):
        return task.attributes.get("bump-type", "") == "android-components"

    return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
isabelrios's avatar
isabelrios committed
82 83 84 85 86 87 88 89 90 91


@_target_task("screenshots")
def target_tasks_screnshots(full_task_graph, parameters, graph_config):
    """Select the set of tasks required to generate screenshots on a real device."""

    def filter(task, parameters):
        return task.attributes.get("screenshots", False)

    return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]