From 6d5a236c1246fdb7d7000dc4c5af0ad7e5e3a3db Mon Sep 17 00:00:00 2001 From: Gonzalo Martinez Lema Date: Tue, 12 Nov 2024 13:49:50 +0100 Subject: [PATCH] Add GHA step to check for warnings --- .github/workflows/test_suite.yml | 14 +++++++++++++- scripts/check_warnings | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100755 scripts/check_warnings diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml index 01e7991b2..ce0a9aeac 100644 --- a/.github/workflows/test_suite.yml +++ b/.github/workflows/test_suite.yml @@ -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 diff --git a/scripts/check_warnings b/scripts/check_warnings new file mode 100755 index 000000000..76d16e4bf --- /dev/null +++ b/scripts/check_warnings @@ -0,0 +1,19 @@ +#!/usr/bin/env python +import sys +import re + +header = "(.*)(=+) warnings summary (=+)(.*)" # === title === +footer = "(.*)(=+) (.+) warnings (.+) (=+)(.*)" # === x passed y warnings in z seconds === + +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)