From 50269a11659fd34a0e594d644ccc9b9c9710c427 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 24 Jun 2024 13:01:08 -0600 Subject: [PATCH] Update ci.yml --- .github/workflows/ci.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2046fb7..80c19a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: const { MODIFIED_APPS } = process.env; const fs = require('fs'); const path = require('path'); + var has_tests = false; function getPytestPaths(dir, callback) { @@ -59,13 +60,18 @@ jobs: if (extension == '.py') { + if (file.name.startsWith('test')) + { + has_tests = true + } + callback(dir); } } } } - const paths = MODIFIED_APPS.split(",") + const paths = MODIFIED_APPS.length > 0 ? MODIFIED_APPS.split(",") : [] const pytestPaths = new Set() const pytestArgs = new Set() @@ -84,8 +90,8 @@ jobs: } } - core.setOutput('pytestPaths', [...pytestPaths].join(' ')); - core.setOutput('pytestArgs', [...pytestArgs].join(' ')); + core.setOutput('pytestPaths', has_tests ? [...pytestPaths].join(' ') : ""); + core.setOutput('pytestArgs', has_tests ? [...pytestArgs].join(' ') : ""); - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 @@ -98,8 +104,9 @@ jobs: python -m pip install pytest - name: Run tests run: | - args=${{ steps.tests_to_run.outputs.pytestArgs }} - pythonpath=${{ steps.tests_to_run.outputs.pytestPaths }} + args="${{ steps.tests_to_run.outputs.pytestArgs }}" + pythonpath="${{ steps.tests_to_run.outputs.pytestPaths }}" + if [ -z "${args}" ] || [ -z "${pythonpath}" ]; then echo “Nothing to test” else