# 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/.

# NOTE: please write a description of this kind in taskcluster/docs/kinds.rst

implementation: taskgraph.task.transform:TransformTask

transforms:
   - taskgraph.transforms.marionette_harness:transforms
   - taskgraph.transforms.task:transforms

# NOTE: this task should be refactored so that it is invoked as a job either
# with a run.using of "mozharness", and combined with the source-check kind.

jobs:
    marionette-harness/opt:
        description: "Marionette harness unit test"
        attributes:
            build_platform: marionette-harness
            build_type: opt
        treeherder:
            platform: linux64/opt
            kind: test
            tier: 2
            symbol: tc(Mn-h)
        worker-type: aws-provisioner-v1/gecko-t-linux-xlarge
        worker:
            implementation: docker-worker
            docker-image: {in-tree: desktop-build}  # NOTE: better to use the lint image
            env:
                JOB_SCRIPT: "taskcluster/scripts/tester/harness-test-linux.sh"
                MOZHARNESS_SCRIPT: "testing/mozharness/scripts/marionette_harness_tests.py"
                TOOLS_DISABLE: "true"
                TOOLTOOL_REPO: "https://github.com/mozilla/build-tooltool"
                TOOLTOOL_REV: "master"
            artifacts:
              - name: public/logs/
                path: /home/worker/workspace/mozharness_workspace/upload/logs/
                type: directory
            command:
              - "bash"
              - "/home/worker/bin/build.sh"
              - "--tests=testing/marionette/harness/marionette_harness/tests/harness_unit"
              - "--work-dir=mozharness_workspace"
            max-run-time: 1800
        when:
            files-changed:
              - "testing/marionette/harness/**"
              - "testing/mozharness/scripts/marionette_harness_tests.py"
              - "testing/config/marionette_harness_test_requirements.txt"