# 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

only-for-attributes:
    - build_platform

transforms:
    - taskgraph.transforms.from_deps
    - gecko_taskgraph.transforms.job
    - gecko_taskgraph.transforms.task
    - gecko_taskgraph.transforms.snap_test

kind-dependencies:
    - snap-upstream-build

task-defaults:
    attributes:
        retrigger: true
        cron: true
    treeherder:
        kind: test
        tier: 2
    run:
        using: run-task
        checkout: false
    worker:
        max-run-time: 900
        env:
            WAYLAND_DISPLAY: 'wayland-0'
        artifacts:
            - name: public/build
              type: directory
              path: builds/worker/artifacts/

tasks:
    basic:
        from-deps:
            group-by: single-with-filters
        description: Runs basic tests on a Firefox Snap package
        worker-type: t-linux-wayland-vm
        run:
            command: >-
              export TASKCLUSTER_ROOT_DIR=$PWD && cd $MOZ_FETCHES_DIR/ && ./tests.sh --basic
        fetches:
            snap-upstream-build:
                - firefox.snap
                - snap-tests.zip
        treeherder:
            platform: linux64/opt
            symbol: Sel(basic)
        attributes:
            snap_test_type: basic

    qa:
        from-deps:
            group-by: single-with-filters
        description: Runs some QA tests on a Firefox Snap package
        worker-type: t-linux-wayland-vm
        run:
            command: >-
              export TASKCLUSTER_ROOT_DIR=$PWD && cd $MOZ_FETCHES_DIR/ && ./tests.sh --qa
        fetches:
            snap-upstream-build:
                - firefox.snap
                - snap-tests.zip
        treeherder:
            platform: linux64/opt
            symbol: Sel(QA)
        attributes:
            snap_test_type: qa
