#! /usr/bin/env python
"""Rectangle compression workflow

Requires the following ``SConscript(..., exports={})``

* ``env`` - The SCons construction environment with the following required keys

  * ``regression_alias`` - String for the alias collecting the regression test suite targets
"""

import pathlib

# Inherit the parent construction environment
Import("env")

# Set unit test workflow variables
build_directory = pathlib.Path(Dir(".").abspath)
workflow_name = build_directory.name

# Collect the target nodes to build a concise alias for all targets
workflow = []

# Unit test target
workflow.extend(
    env.Command(
        target=[f"{workflow_name}_results.xml"],
        source=["#/modsim_package/python/tests/test_regression.py"],
        action="pytest --junitxml=${TARGETS[0]}",
    )
)

env.Alias(workflow_name, workflow)
env.Alias(env["regression_alias"], workflow)
