Bug 1455570 - Build and publish TPS add-on; r?dustin, ted draft
authorDave Hunt <dhunt@mozilla.com>
Mon, 23 Apr 2018 14:32:05 +0100
changeset 791458 8a807cd85aee7aac0dc8f770c9dba604a44d11e7
parent 790721 f877359308b17e691209e1afb7193b8e86f175ce
push id108822
push userbmo:dave.hunt@gmail.com
push dateFri, 04 May 2018 13:26:31 +0000
reviewersdustin, ted
bugs1455570
milestone61.0a1
Bug 1455570 - Build and publish TPS add-on; r?dustin, ted MozReview-Commit-ID: HOsTcmg1m7e
build/mach_bootstrap.py
build/sparse-profiles/tps
taskcluster/ci/addon/kind.yml
taskcluster/ci/config.yml
taskcluster/docs/kinds.rst
testing/tps/mach_commands.py
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -50,16 +50,17 @@ MACH_MODULES = [
     'testing/awsy/mach_commands.py',
     'testing/firefox-ui/mach_commands.py',
     'testing/geckodriver/mach_commands.py',
     'testing/mach_commands.py',
     'testing/marionette/mach_commands.py',
     'testing/mochitest/mach_commands.py',
     'testing/mozharness/mach_commands.py',
     'testing/raptor/mach_commands.py',
+    'testing/tps/mach_commands.py',
     'testing/talos/mach_commands.py',
     'testing/web-platform/mach_commands.py',
     'testing/xpcshell/mach_commands.py',
     'tools/compare-locales/mach_commands.py',
     'tools/docs/mach_commands.py',
     'tools/lint/mach_commands.py',
     'tools/mach_commands.py',
     'tools/power/mach_commands.py',
new file mode 100644
--- /dev/null
+++ b/build/sparse-profiles/tps
@@ -0,0 +1,5 @@
+%include build/sparse-profiles/mach
+
+[include]
+path:services/sync/tps/
+path:testing/tps/
new file mode 100644
--- /dev/null
+++ b/taskcluster/ci/addon/kind.yml
@@ -0,0 +1,39 @@
+# 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/.
+
+loader: taskgraph.loader.transform:loader
+
+transforms:
+    - taskgraph.transforms.job:transforms
+    - taskgraph.transforms.task:transforms
+
+jobs:
+    tps-xpi:
+        description: Build the TPS add-on
+        index:
+            product: firefox
+            job-name: addons.tps
+        treeherder:
+            platform: linux64/opt
+            symbol: TPS(addon)
+            kind: build
+            tier: 1
+        run-on-projects: [mozilla-central]
+        worker-type: aws-provisioner-v1/gecko-{level}-b-linux
+        worker:
+            docker-image: {in-tree: debian7-amd64-build}
+            max-run-time: 1800
+            artifacts:
+                - type: file
+                  name: public/tps.xpi
+                  path: /builds/worker/checkouts/gecko/tps-out/tps.xpi
+        run:
+            using: run-task
+            command: >
+                cd /builds/worker/checkouts/gecko &&
+                ./mach tps-build --dest tps-out
+            sparse-profile: tps
+        when:
+            files-changed:
+                - 'services/sync/tps/extensions/tps/**'
--- a/taskcluster/ci/config.yml
+++ b/taskcluster/ci/config.yml
@@ -55,16 +55,17 @@ treeherder:
         'Searchfox': 'Searchfox builds'
         'SM': 'Spidermonkey builds'
         'pub': 'APK publishing'
         'p': 'Partial generation'
         'ps': 'Partials signing'
         'Rel': 'Release promotion'
         'Snap': 'Snap image generation'
         'langpack': 'Langpack sigatures and uploads'
+        'TPS': 'Sync tests'
 
 index:
     products:
         - 'firefox'
         - 'fennec'
         - 'mobile'
         - 'static-analysis'
         - 'devedition'
--- a/taskcluster/docs/kinds.rst
+++ b/taskcluster/docs/kinds.rst
@@ -445,8 +445,12 @@ packages
 --------
 Tasks used to build packages for use in docker images.
 
 diffoscope
 ----------
 Tasks used to compare pairs of Firefox builds using https://diffoscope.org/.
 As of writing, this is mainly meant to be used in try builds, by editing
 taskcluster/ci/diffoscope/kind.yml for your needs.
+
+addon
+-----
+Tasks used to build/package add-ons.
new file mode 100644
--- /dev/null
+++ b/testing/tps/mach_commands.py
@@ -0,0 +1,32 @@
+# 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
+import os
+
+from mach.decorators import Command, CommandArgument, CommandProvider
+from mozbuild.base import MachCommandBase
+from mozpack.copier import Jarrer
+from mozpack.files import FileFinder
+
+
+@CommandProvider
+class MachCommands(MachCommandBase):
+    """TPS tests for Sync."""
+
+    @Command('tps-build', category='testing', description='Build TPS add-on.')
+    @CommandArgument('--dest', default=None, help='Where to write add-on.')
+    def build(self, dest):
+        src = os.path.join(self.topsrcdir, 'services', 'sync', 'tps', 'extensions', 'tps')
+        dest = os.path.join(dest or os.path.join(self.topobjdir, 'services', 'sync'), 'tps.xpi')
+
+        if not os.path.exists(os.path.dirname(dest)):
+            os.makedirs(os.path.dirname(dest))
+
+        jarrer = Jarrer(optimize=False)
+        for p, f in FileFinder(src).find('*'):
+            jarrer.add(p, f)
+        jarrer.copy(dest)
+
+        print('Built TPS add-on as %s' % dest)