Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Bug 1545730 - Enable raptor tests on Fenix #1774

Merged
merged 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ task printBuildVariants {
}
}

task printGeckoviewVersions {
doLast {
println "nightly: " + groovy.json.JsonOutput.toJson(GeckoVersions.nightly_version)
}
}

// Normally this should use the same version as the glean dependency. But since we are currently using AC snapshots we
// can't reference a git tag with a specific version here. So we are just using "master" and hoping for the best.
apply from: 'https://github.com/mozilla-mobile/android-components/raw/master/components/service/glean/scripts/sdk_generator.gradle'
45 changes: 34 additions & 11 deletions automation/taskcluster/decision_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
import os
import taskcluster

from lib import build_variants
from lib.tasks import TaskBuilder, schedule_task_graph, get_architecture_and_build_type_from_variant
from lib.gradle import get_build_variants, get_geckoview_versions
from lib.tasks import (
fetch_mozharness_task_id,
get_architecture_and_build_type_from_variant,
schedule_task_graph,
TaskBuilder,
)
from lib.chain_of_trust import (
populate_chain_of_trust_task_graph,
populate_chain_of_trust_required_but_unused_files
Expand All @@ -22,6 +27,7 @@
REPO_URL = os.environ.get('MOBILE_HEAD_REPOSITORY')
COMMIT = os.environ.get('MOBILE_HEAD_REV')
PR_TITLE = os.environ.get('GITHUB_PULL_TITLE', '')
SHORT_HEAD_BRANCH = os.environ.get('SHORT_HEAD_BRANCH')

# If we see this text inside a pull request title then we will not execute any tasks for this PR.
SKIP_TASKS_TRIGGER = '[ci skip]'
Expand All @@ -31,7 +37,7 @@
task_id=os.environ.get('TASK_ID'),
repo_url=REPO_URL,
git_ref=os.environ.get('MOBILE_HEAD_BRANCH'),
short_head_branch=os.environ.get('SHORT_HEAD_BRANCH'),
short_head_branch=SHORT_HEAD_BRANCH,
commit=COMMIT,
owner="fenix-eng-notifications@mozilla.com",
source='{}/raw/{}/.taskcluster.yml'.format(REPO_URL, COMMIT),
Expand All @@ -42,30 +48,47 @@
)


def pr_or_push(is_master_push):
if not is_master_push and SKIP_TASKS_TRIGGER in PR_TITLE:
def pr_or_push(is_push):
if not is_push and SKIP_TASKS_TRIGGER in PR_TITLE:
print("Pull request title contains", SKIP_TASKS_TRIGGER)
print("Exit")
return {}

variants = get_build_variants()
geckoview_nightly_version = get_geckoview_versions()['nightly']
mozharness_task_id = fetch_mozharness_task_id(geckoview_nightly_version)
gecko_revision = taskcluster.Queue().task(mozharness_task_id)['payload']['env']['GECKO_HEAD_REV']

build_tasks = {}
signing_tasks = {}
other_tasks = {}

for variant in build_variants.from_gradle():
for variant in variants:
assemble_task_id = taskcluster.slugId()
build_tasks[assemble_task_id] = BUILDER.craft_assemble_task(variant)
build_tasks[taskcluster.slugId()] = BUILDER.craft_test_task(variant)

arch, build_type = get_architecture_and_build_type_from_variant(variant)
architecture, build_type = get_architecture_and_build_type_from_variant(variant)
# autophone only supports arm and aarch64, so only sign/perftest those builds
if (
is_push and
build_type == 'releaseRaptor' and
arch in ('arm', 'aarch64') and
is_master_push
architecture in ('arm', 'aarch64') and
SHORT_HEAD_BRANCH == 'master'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need both is_master_push and SHORT_HEAD_BRANCH == 'master'? Aren't they confirming the same underlying fact?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. is_master_push is misleading. I just renamed it into is_push

):
signing_tasks[taskcluster.slugId()] = BUILDER.craft_master_commit_signing_task(assemble_task_id, variant)
# raptor task will be added in follow-up
signing_task_id = taskcluster.slugId()
signing_tasks[signing_task_id] = BUILDER.craft_master_commit_signing_task(assemble_task_id, variant)

ALL_RAPTOR_CRAFT_FUNCTIONS = [
BUILDER.craft_raptor_tp6m_cold_task(for_suite=i)
for i in range(1, 11)
]
for craft_function in ALL_RAPTOR_CRAFT_FUNCTIONS:
args = (signing_task_id, mozharness_task_id, variant, gecko_revision)
other_tasks[taskcluster.slugId()] = craft_function(*args)
# we also want the arm APK to be tested on 64-bit-devices
if architecture == 'arm':
other_tasks[taskcluster.slugId()] = craft_function(*args, force_run_on_64_bit_device=True)

for craft_function in (
BUILDER.craft_detekt_task,
Expand Down
29 changes: 0 additions & 29 deletions automation/taskcluster/lib/build_variants.py

This file was deleted.

51 changes: 51 additions & 0 deletions automation/taskcluster/lib/gradle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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 print_function
import json
import subprocess


def get_build_variants():
print("Fetching build variants from gradle")
output = _run_gradle_process('printBuildVariants')
content = _extract_content_from_command_output(output, prefix='variants: ')
variants = json.loads(content)

if len(variants) == 0:
raise ValueError("Could not get build variants from gradle")

print("Got variants: {}".format(' '.join(variants)))

return variants


def get_geckoview_versions():
print("Fetching geckoview version from gradle")
output = _run_gradle_process('printGeckoviewVersions')

versions = {}
for version_type in ('nightly',):
version = _extract_content_from_command_output(output, prefix='{}: '.format(version_type))
version = version.strip('"')
versions[version_type] = version
print('Got {} version: "{}"'.format(version_type, version))

return versions


def _run_gradle_process(gradle_command):
process = subprocess.Popen(["./gradlew", "--no-daemon", "--quiet", gradle_command], stdout=subprocess.PIPE)
output, err = process.communicate()
exit_code = process.wait()

if exit_code is not 0:
print("Gradle command returned error: {}".format(exit_code))

return output


def _extract_content_from_command_output(output, prefix):
variants_line = [line for line in output.split('\n') if line.startswith(prefix)][0]
return variants_line.split(' ', 1)[1]
Loading