From b3efd59ca880c6da19fa9155fc0d19e5eb0e9c18 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Tue, 6 Feb 2024 10:58:13 -0600 Subject: [PATCH] Support building colcon extensions with no setup.py This change separates the installation of the package being tested from the installation of its dependencies. After initial installation, the package's name is found using `pip list` and excluded from the org-level constraints file that's used to ensure that HEAD is used for each of those repositories. The package name must be removed from constraints.txt or pip will fail to install the package and its dependencies due to the conflict. Note that pytest-cov still requires a setup.cfg to be present - storing coverage information in pyproject.toml is not yet supported by this action. --- action.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index c7c9d93..2eb4ced 100644 --- a/action.yaml +++ b/action.yaml @@ -17,9 +17,14 @@ runs: python -m pip install -U pip setuptools echo ::endgroup:: + echo ::group::Install package + python -m pip install -U -e .[test] --no-deps + echo ::endgroup:: + echo ::group::Install dependencies # Remove this package from constraints - grep -v "^$(python setup.py --name)@" ${GITHUB_ACTION_PATH}/constraints.txt > constraints.txt + PKG_NAME=$(pip list --local --editable --format json | jq '.[0].name' -r) + grep -v "^${PKG_NAME}@" ${GITHUB_ACTION_PATH}/constraints.txt > constraints.txt # Install dependencies, including any 'test' extras, as well as pytest-cov python -m pip install -U -e .[test] pytest-cov -c constraints.txt echo ::endgroup::