CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
86 lines
2.6 KiB
Python
86 lines
2.6 KiB
Python
# Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""Developer task runner for GEKO.
|
|
|
|
Run ``invoke --list`` to see available tasks. Common usage:
|
|
|
|
invoke install # editable install (pip install -e .)
|
|
invoke test # run the test suite
|
|
invoke test --skip-slow # quick run, forwards args to pytest
|
|
invoke lint # flake8
|
|
invoke format # black + isort
|
|
invoke build # build sdist + wheel
|
|
invoke clean # remove build/test artifacts
|
|
"""
|
|
|
|
import shutil
|
|
import sys
|
|
|
|
from pathlib import Path
|
|
from invoke.tasks import task
|
|
|
|
GEKO_DIRS = "geko scripts tests"
|
|
|
|
|
|
@task(help={"editable": "Install in editable mode (pip install -e)."})
|
|
def install(c, editable=True):
|
|
"""Install geko (and the ``geko`` console script) into the active environment."""
|
|
flag = "-e " if editable else ""
|
|
c.run(f"pip install {flag}.")
|
|
|
|
|
|
@task(
|
|
help={
|
|
"skip_slow": "Skip @pytest.mark.slow tests.",
|
|
"skip_geko_bin": "Skip @pytest.mark.geko_bin subprocess tests.",
|
|
"args": "Extra arguments forwarded to pytest (quote them).",
|
|
}
|
|
)
|
|
def test(c, skip_slow=False, skip_geko_bin=False, args=""):
|
|
"""Run the pytest suite under tests/."""
|
|
extra = []
|
|
if skip_slow:
|
|
extra.append("--skip-slow")
|
|
if skip_geko_bin:
|
|
extra.append("--skip-geko-bin")
|
|
if args:
|
|
extra.append(args)
|
|
c.run(f"{sys.executable} -m pytest tests/ {' '.join(extra)}".rstrip())
|
|
|
|
|
|
@task
|
|
def lint(c):
|
|
"""Run flake8 over the geko package."""
|
|
c.run("flake8 geko")
|
|
|
|
|
|
@task(help={"check": "Only check formatting; do not modify files."})
|
|
def format(c, check=False):
|
|
"""Format code with black and sort imports with isort."""
|
|
chk = " --check" if check else ""
|
|
c.run(f"black --line-length=100{chk} {GEKO_DIRS}")
|
|
c.run(f"isort --profile=black{' --check-only' if check else ''} {GEKO_DIRS}")
|
|
|
|
|
|
@task
|
|
def build(c):
|
|
"""Build an sdist and wheel into dist/."""
|
|
c.run(f"{sys.executable} -m build")
|
|
|
|
|
|
@task
|
|
def clean(c):
|
|
"""Remove build, packaging, and test caches."""
|
|
root = Path(".")
|
|
dirs = ["build", "dist", "geko.egg-info", ".pytest_cache", ".tox", "htmlcov"]
|
|
files = [".coverage", "coverage.xml", "coverage.json"]
|
|
for name in dirs:
|
|
shutil.rmtree(root / name, ignore_errors=True)
|
|
for p in root.glob("*.egg-info"):
|
|
shutil.rmtree(p, ignore_errors=True)
|
|
for name in files:
|
|
(root / name).unlink(missing_ok=True)
|
|
for pycache in root.rglob("__pycache__"):
|
|
shutil.rmtree(pycache, ignore_errors=True)
|