diff --git a/taskcluster/kinds/codecov/kind.yml b/taskcluster/kinds/codecov/kind.yml index 0dee7c29..972f5c44 100644 --- a/taskcluster/kinds/codecov/kind.yml +++ b/taskcluster/kinds/codecov/kind.yml @@ -23,7 +23,7 @@ tasks: set-name: null fetches: test: - - artifact: coverage.{python_version} + - artifact: coverage.{matrix[python]} worker-type: t-linux worker: docker-image: {in-tree: python} diff --git a/taskcluster/kinds/test/kind.yml b/taskcluster/kinds/test/kind.yml index 7cfce2db..c0206afc 100644 --- a/taskcluster/kinds/test/kind.yml +++ b/taskcluster/kinds/test/kind.yml @@ -6,7 +6,7 @@ loader: taskgraph.loader.transform:loader transforms: - - self_taskgraph.transforms.test + - taskgraph.transforms.matrix - taskgraph.transforms.run - taskgraph.transforms.task @@ -15,6 +15,7 @@ kind-dependencies: task-defaults: attributes: + artifact_prefix: public retrigger: true code-review: true worker-type: t-linux @@ -37,10 +38,20 @@ task-defaults: tasks: unit: - description: "Run `unit tests` to validate the latest changes" - attributes: - artifact_prefix: public - python-versions: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"] + description: "Run unit tests with py{matrix[python]}" + matrix: + set-name: "unit-py{matrix[python]}" + substitution-fields: [description, run.command, treeherder, worker] + python: ["313", "312", "311", "310", "39", "38"] + worker: + artifacts: + - type: file + path: "/builds/worker/artifacts/coverage" + name: "public/coverage.py{matrix[python]}" + env: + UV_PYTHON: "{matrix[python]}" + treeherder: + symbol: unit(py{matrix[python]}) run: command: >- - uv run coverage run --data-file $MOZ_ARTIFACT_DIR/coverage --context=$PYTHON_VERSION -m pytest -vv + uv run coverage run --data-file /builds/worker/artifacts/coverage --context=py{matrix[python]} -m pytest -vv diff --git a/taskcluster/self_taskgraph/transforms/test.py b/taskcluster/self_taskgraph/transforms/test.py deleted file mode 100644 index cf9002eb..00000000 --- a/taskcluster/self_taskgraph/transforms/test.py +++ /dev/null @@ -1,34 +0,0 @@ -from taskgraph.transforms.base import TransformSequence -from taskgraph.util.copy import deepcopy - -transforms = TransformSequence() - - -@transforms.add -def split_by_python_version(config, tasks): - artifact_dir = "/builds/worker/artifacts" - for task in tasks: - for python_version in task.pop("python-versions"): - py_name = f"py{python_version.replace('.', '')}" - new_task = deepcopy(task) - new_task["name"] = f"{task['name']}-{py_name}" - - attributes = new_task.setdefault("attributes", {}) - attributes["python_version"] = py_name - - worker = new_task.setdefault("worker", {}) - worker.setdefault("artifacts", []).append( - { - "type": "file", - "path": f"{artifact_dir}/coverage", - "name": f"public/coverage.{py_name}", - } - ) - env = worker.setdefault("env", {}) - env["MOZ_ARTIFACT_DIR"] = artifact_dir - env["UV_PYTHON"] = python_version - - treeherder = new_task.setdefault("treeherder", {}) - treeherder["symbol"] = f"unit({py_name})" - - yield new_task