# 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:
    - fenix_taskgraph.transforms.test:transforms
    - taskgraph.transforms.job:transforms
    - taskgraph.transforms.task:transforms

kind-dependencies:
    - toolchain


task-defaults:
    attributes:
        retrigger: true
    description: Test Fenix
    extra:
        notify:
            slackBlocks: |
                [
                  {
                    "type": "header",
                    "text": {
                      "type": "plain_text",
                      "text": "Fenix :firefox: ${task.metadata.name} :x:\n "
                    }
                  },
                  {
                    "type": "divider"
                  },
                  {
                     "type": "section",
                     "text": {
                         "type": "mrkdwn",
                         "text": "*Task*: <https://firefox-ci-tc.services.mozilla.com/tasks/${status.taskId}|Taskcluster>"
                    }
                  },
                  {
                    "type": "section",
                    "text": {
                      "type": "mrkdwn",
                      "text": "*Owner*: ${task.metadata.owner}"
                    }
                  },
                  {
                    "type": "section",
                    "text": {
                      "type": "mrkdwn",
                      "text": "*Source*: <${task.payload.env.MOBILE_BASE_REPOSITORY}/commit/${task.payload.env.MOBILE_HEAD_REV}|Commit> :github:"
                    }
                  },
                  {
                    "type": "section",
                    "text": {
                      "type": "mrkdwn",
                      "text": "*Test Summary*: <https://firefoxci.taskcluster-artifacts.net/${status.taskId}/0/public/reports/test/testDebugUnitTest/index.html|Results> :debug:"
                    }
                  },
                  {
                    "type": "divider"
                  },
                  {
                    "type": "context",
                    "elements": [
                        {
                            "type": "mrkdwn",
                            "text": ":testops-notify: created by <https://mana.mozilla.org/wiki/x/P_zNBw|Mobile Test Engineering>"
                        }
                    ]
                  }
                ]
    fetches:
        toolchain:
            - android-sdk-linux
            - android-gradle-dependencies
    include-pull-request-number: false
    run:
        using: gradlew
        use-caches: false
    routes:
        - notify.slack-channel.G016BC5FUHJ.on-failed
    scopes:
        - queue:route:notify.slack-channel.G016BC5FUHJ.on-failed
        - notify:slack-channel:G016BC5FUHJ
    treeherder:
        kind: test
        tier: 2
    worker-type: b-android
    worker:
        docker-image: {in-tree: base}
        max-run-time: 7200

tasks:
    debug:
        attributes:
            build-type: debug
            code-review: true
        run:
            pre-gradlew:
                - ['java', '-version']
            gradlew:
                - 'clean'
                - 'testDebugUnitTest'
                - 'githubTestDetails'
        treeherder:
            platform: 'android-all/opt'
            symbol: debug(T)
            tier: 1
        worker:
            artifacts:
                - name: public/reports/index.html
                  path: /builds/worker/checkouts/vcs/app/build/reports/tests/testDebugUnitTest/index.html
                  type: file
                - name: public/reports/test
                  path: /builds/worker/checkouts/vcs/app/build/reports/tests
                  type: directory
                - name: public/github
                  path: /builds/worker/github
                  type: directory
