cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-112301: Compiler warning management tooling

Open nohlson opened this issue 1 year ago • 1 comments

#112301: This is the first version of compiler warning check tooling integrated into the Ubuntu build ant test GitHub action job.

The tool parses compiler output and checks against an ignore file, which is a list of files for which warnings should be ignored. The script includes options to fail on regression, or fail on improvement (if a file is in the ignore list but the compiler emitted no warnings).

A more detailed writeup about the idea behind the tool can be found here

The current configuration in reusable-ubuntu.yml does not include flags to --fail-on-regression or --fail-on-improvement and simply writes to the log warnings that were emitted but not ignored, or file names that were unexpectedly missing warnings but will not fail the step in the job. Per discussion in the issue we can eventually enable those options.

Future improvements would include removal of duplicate warnings, warning count per file tracking, and adding GitHub Actions annotations.

  • Issue: gh-112301

nohlson avatar Jul 13 '24 21:07 nohlson

(I updated the branch from main to fix the unrelated docs error: Error: new NEWS nits: /home/runner/work/cpython/cpython/build/NEWS:72: WARNING: py:func reference target not found: warnings.filterswarnings.)

hugovk avatar Jul 14 '24 09:07 hugovk

I have made the requested changes; please review again

nohlson avatar Jul 17 '24 03:07 nohlson

Thanks for making the requested changes!

: please review the changes made to this pull request.

bedevere-app[bot] avatar Jul 17 '24 03:07 bedevere-app[bot]

Hmm, there's a build failure, please can you check it?

configure: loading cache config.cache
configure: error: `CFLAGS' was not set in the previous run
configure: error: in `/home/runner/work/cpython/cpython-builddir':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm config.cache'
	    and start over

https://github.com/python/cpython/actions/runs/10066126406/job/27873774117?pr=121730

hugovk avatar Jul 24 '24 17:07 hugovk

Hmm, there's a build failure, please can you check it?

configure: loading cache config.cache
configure: error: `CFLAGS' was not set in the previous run
configure: error: in `/home/runner/work/cpython/cpython-builddir':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm config.cache'
	    and start over

https://github.com/python/cpython/actions/runs/10066126406/job/27873774117?pr=121730

It looks like for caching reasons I need to include the compiler option to output to json for the build_ubuntu_ssltests as well

nohlson avatar Jul 25 '24 01:07 nohlson

I have made the requested changes; please review again

nohlson avatar Jul 25 '24 01:07 nohlson

Thanks for making the requested changes!

: please review the changes made to this pull request.

bedevere-app[bot] avatar Jul 25 '24 01:07 bedevere-app[bot]

@picnixz Your review comments came after I'd enabled auto-merge, sorry about that!


@nohlson Hi! @corona10 noticed that with this change, the build output is no longer being output to the logs, because we're redirecting it to a file. It can sometimes be useful to see this output.

Before: https://github.com/python/cpython/actions/runs/10122181963/job/27993976874 After: https://github.com/python/cpython/actions/runs/10122668622/job/27995097214

@zware suggested a command like this:

set -o pipefail; make -j4 2>&1 | tee compiler_output.txt

Please could you open a PR to try this out? Thank you!

hugovk avatar Jul 30 '24 06:07 hugovk