Skip to content

Commit

Permalink
updated github action: if no tests are found, skip.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcorusc committed Aug 21, 2024
1 parent f07127e commit c35290f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,36 @@ jobs:
pip install .[dev,test]
pip install pytest pytest-cov codecov
- name: Check for test files
id: check_tests
run: |
if ls tests/*_test.py 1> /dev/null 2>&1; then
echo "Tests found."
echo "tests-found=true" >> $GITHUB_ENV
else
echo "No tests found. Skipping pytest."
echo "tests-found=false" >> $GITHUB_ENV
fi
- name: Run tests
if: env.tests-found == 'true'
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
run: |
pytest -v --cov=./ --cov-report=xml
- name: Check for coverage report
if: env.tests-found == 'true'
run: |
if [ -f ./coverage.xml ]; then
echo "coverage-found=true" >> $GITHUB_ENV
else
echo "coverage-found=false" >> $GITHUB_ENV
fi
- name: Upload coverage to Codecov
if: env.coverage-found == 'true'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
Expand Down

0 comments on commit c35290f

Please sign in to comment.