Skip to content

Commit

Permalink
Add GHA step to check for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaponte committed Nov 12, 2024
1 parent bec62bd commit 6d5a236
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@ jobs:
# - name: Fix Conda permissions on macOS
# run: sudo chown -R $UID $CONDA
# if: runner.os == 'macOS'

- name: Install IC
run: |
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
- name: Run tests
run: |
set -o pipefail
source $CONDA/etc/profile.d/conda.sh
source manage.sh work_in_python_version_no_tests ${{ matrix.python-version }}
PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests_par
PYTEST_ADDOPTS=--color=yes HYPOTHESIS_PROFILE=travis-ci bash manage.sh run_tests_par | tee pytest_output.txt
- name: Warning summary
continue-on-error: true
run: |
./scripts/check_warnings pytest_output.txt
if [ $? ]; then
echo "::warning ::There are warnings raised in the test suite"
fi
19 changes: 19 additions & 0 deletions scripts/check_warnings
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
import sys
import re

header = "(.*)(=+) warnings summary (=+)(.*)" # <color> === title === <color>
footer = "(.*)(=+) (.+) warnings (.+) (=+)(.*)" # <color> === x passed y warnings in z seconds === <color>

found = False
doit = False
for line in map(str.strip, open(sys.argv[1])):
if re.match(header, line): doit=True

if doit:
found = True
print(line)

if re.match(footer, line): doit=False

sys.exit(found)

0 comments on commit 6d5a236

Please sign in to comment.