From 9693c6fbad05fec9309095f661c37c3d7eadfe46 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Wed, 19 Jun 2024 15:54:12 -0600 Subject: [PATCH] Validate python path for pytest is not empty as well (#7) * Validate python path for pytest is not empty as well * Update ci.yml * Update ci.yml * Update ci.yml --- .github/workflows/ci.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0198be..1d0594f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,13 +75,24 @@ jobs: .filter(x => x.length > 0 && !x.startsWith('.'))); const pytestPaths = new Set() + const pytestArgs = new Set() for (const rootPath of paths) - { - getPytestPaths(rootPath, x => pytestPaths.add(x)) + { + let subFoldersWithPythonFiles = 0; + getPytestPaths(rootPath, x => + { + pytestPaths.add(x); + subFoldersWithPythonFiles++ + }) + + if (subFoldersWithPythonFiles > 0) + { + pytestArgs.add(rootPath) + } } core.setOutput('pytestPaths', [...pytestPaths].join(' ')); - core.setOutput('pytestArgs', [...paths].join(' ')); + core.setOutput('pytestArgs', [...pytestArgs].join(' ')); - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 @@ -94,7 +105,8 @@ jobs: - name: Run tests run: | args=${{ steps.tests_to_run.outputs.pytestArgs }} - if [ -z "${args}" ]; then + pythonpath=${{ steps.tests_to_run.outputs.pytestPaths }} + if [ -z "${args}" ] || [ -z "${pythonpath}" ]; then echo “Nothing to test” else pytest $args