Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate python path for pytest is not empty as well #7

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading