From 0ef7938123aff0e3fdf1bf3ba876fae0ef609da3 Mon Sep 17 00:00:00 2001 From: Najib Ishaq Date: Thu, 25 Jul 2024 12:11:31 -0400 Subject: [PATCH] ci: find all tools now specifically looks for specified dep --- .github/workflows/find-all-tools.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/find-all-tools.yml b/.github/workflows/find-all-tools.yml index e3d2194..064bf43 100644 --- a/.github/workflows/find-all-tools.yml +++ b/.github/workflows/find-all-tools.yml @@ -2,6 +2,11 @@ name: Find All Tools on: workflow_call: + inputs: + dependency_name: + description: 'Name of the package which must be a dependency of the tools to return' + type: string + required: true outputs: matrix: description: 'Matrix of tools to test' @@ -25,8 +30,11 @@ jobs: - name: Find tools id: set-matrix run: | + echo "Looking for tools that depend on ${{ inputs.dependency_name }}" + # List of directories to ignore ignored_dirs="polus-python-template ftl-label .venv" + # List of tools that are broken for known reasons broken_tools="" @@ -35,7 +43,7 @@ jobs: ignored_dirs=$(echo $ignored_dirs | xargs) tool_dirs="" - # Get all directories in the current directory + # Get all sub-directories in the current directory dirs=$(find $(pwd) -type d) # Get all directories that have a "pyproject.toml" file @@ -52,8 +60,16 @@ jobs: done # If the directory contains a "pyproject.toml" file, then add it to the list of tools if [ -f "$dir/pyproject.toml" ]; then + # Check if the pyproject.toml file contains the dependency + dep_line=$(cat $dir/pyproject.toml | grep "${{ inputs.dependency_name }}") + # If the dependency is not found, then skip this tool + if [ -z "$dep_line" ]; then + continue + fi + # Since we found the dependency, add the tool to the list tool_dirs="$tool_dirs $dir" fi + done # Remove leading and trailing spaces tool_dirs=$(echo $tool_dirs | xargs)