schema: 1

bugzilla:
  product: Core
  component: "Graphics: WebGPU"

origin:
  name: WebGPU CTS
  description: WebGPU Compliance Test Suite
  url: https://gpuweb.github.io/cts/
  release: b128863553525c1aa5a36c79744476f245e97655 (2026-06-24T02:22:30Z).
  revision: b128863553525c1aa5a36c79744476f245e97655
  license: ['BSD-3-Clause']

updatebot:
    maintainer-phab: '#webgpu-reviewers!'
    maintainer-bz: egubler@mozilla.com
    try-preset: webgpu
    tasks:
      - type: vendoring
        enabled: true
        frequency: 1 week
        blocking: 1863146  # webgpu-update-cts

vendoring:
  url: https://github.com/gpuweb/cts
  source-hosting: github
  vendor-directory: dom/webgpu/tests/cts/checkout/
  skip-vendoring-steps:
    - update-moz-build
  include:
    - .gitattributes
    - .gitignore  # Avoids re-formatting of generated files.
  update-actions:
    # Use the version from `mach vendor`, instead of a script that consults Git. This is wrong,
    # because (1) it would use a Git checkout of _Gecko_ rather than CTS, and (2) we might not even
    # have a Git checkout if we're using Mercurial.
    - action: replace-in-file
      file: '{yaml_dir}/checkout/tools/gen_version'
      pattern: "const { version } = require('../src/common/tools/version.ts');"
      with: "const version = '{revision}';"

    # Apply patches from patch files.
    #
    # These must be applied prior to the `cargo run` step below, as it patches the original
    # TypeScript sources. If we used `moz.yaml`'s `patches` mechanism, it would apply the patch to
    # the TypeScript sources _after_ we have already processed them and written our tests to their
    # final location.

    # Patch the `baseResourcePath` used by the CTS so that the tests we
    # generate are able to load resources correctly.
    - action: run-command
      cwd: '{yaml_dir}/checkout/'
      command: patch
      args:
        - -p1
        - -i
        - ../patches/0001-base-resource-path.patch

    # Patch the `serviceWorkerURL` used by the CTS so that the tests we generate are able to load
    # resources correctly.
    - action: run-command
      cwd: '{yaml_dir}/checkout/'
      command: patch
      args:
        - -p1
        - -i
        - ../patches/0002-service-worker-url.patch

    - action: run-command
      cwd: '{yaml_dir}/vendor/'
      command: cargo
      args:
        - run
        - --no-default-features
        - --
        - '../checkout/'

    - action: delete-path
      path: '{topsrcdir}/testing/web-platform/mozilla/tests/webgpu/'
    - action: move-dir
      from: '{yaml_dir}/checkout/out-wpt/'
      to: '{topsrcdir}/testing/web-platform/mozilla/tests/webgpu/'

    - action: delete-path
      path: '{yaml_dir}/checkout/node_modules/'
    - action: delete-path
      path: '{yaml_dir}/checkout/gen/'
    - action: delete-path
      path: '{yaml_dir}/checkout/out/'
    - action: delete-path
      path: '{yaml_dir}/checkout/deploy_key.enc'
    - action: vcs-add-remove-files
      path: '{topsrcdir}/testing/web-platform/mozilla/tests/webgpu/'
