Skip to content

ci: Simplify CodeQL setup #27733

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

Merged
merged 1 commit into from
Feb 2, 2024
Merged

ci: Simplify CodeQL setup #27733

merged 1 commit into from
Feb 2, 2024

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Feb 2, 2024

PR summary

The workflow is now warning that CODEQL_PYTHON should not be set, as it is no longer used. According to the message, we also don't need to install dependencies, so fold everything into the 'build-for-C++' step.

PR checklist

@QuLogic QuLogic added this to the v3.9.0 milestone Feb 2, 2024
@QuLogic QuLogic force-pushed the fix-codeql branch 2 times, most recently from 278f46f to ac93141 Compare February 2, 2024 02:20
@QuLogic QuLogic added CI: testing CI configuration and testing Maintenance labels Feb 2, 2024
@QuLogic
Copy link
Member Author

QuLogic commented Feb 2, 2024

Looking at the results here, it appears that the C++ job is uploading results for 0 files. But so far, it seems like it's always done that? I'm investigating older runs to see if this ever worked and/or when it broke.

@QuLogic
Copy link
Member Author

QuLogic commented Feb 2, 2024

I suspected that this changed with the Meson build, and looking at Code Scanning results, they were indeed all "fixed" (even the closed ones) as of Oct 4, 2023 by the merging of #26621.

@QuLogic QuLogic marked this pull request as draft February 2, 2024 03:41
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@QuLogic QuLogic force-pushed the fix-codeql branch 5 times, most recently from 4ee402b to d670194 Compare February 2, 2024 06:36
@oscargus
Copy link
Member

oscargus commented Feb 2, 2024

Maybe you have already tried this in your previous attempts, but I was inspired to set up the same thing for one of my repositories when I saw this and with the default template it worked pretty simple. I basically skipped the autobuild and just installed it with pip. (And had to add a setup-python-step to be able to install using meson.)

However, I assume that the remaining problem is that not that many of the files are considered?

FWIW: https://github.com/apytypes/apytypes/blob/main/.github/workflows/codeql.yml

@QuLogic
Copy link
Member Author

QuLogic commented Feb 2, 2024

Oh, that's interesting; I would've thought that just building (as we used to do) would be equivalent, unless it's something to do with where it builds. I'll give that a try as well.

@QuLogic QuLogic force-pushed the fix-codeql branch 4 times, most recently from 68088d5 to 867971c Compare February 2, 2024 07:57
The workflow is now warning that `CODEQL_PYTHON` should not be set, as
it is no longer used. According to the message, we also don't need to
install dependencies, so fold everything into the 'build-for-C++' step.
@QuLogic
Copy link
Member Author

QuLogic commented Feb 2, 2024

Thanks, that worked and looks even simpler to me:

CodeQL scanned 79 out of 162 C files and 25 out of 60 C++ files in this job.

(Note: we get some extra from Qhull/FreeType/etc, so we get more C files than we actually have. We could maybe configure it to ignore those.)

But note that we don't need a new Python, just upgrading pip, as that fixes the automatic install of meson/ninja/pybind11.

@QuLogic QuLogic marked this pull request as ready for review February 2, 2024 08:19
@dstansby
Copy link
Member

dstansby commented Feb 2, 2024

Looks good. One of the checks is complaining that:

Warning: Code scanning cannot determine the alerts introduced by this pull request, because 1 configuration present on refs/heads/main was not found

(https://github.com/matplotlib/matplotlib/pull/27733/checks?check_run_id=21143960748)

I'm guessing this will get fixed upon merging this into main?

@QuLogic
Copy link
Member Author

QuLogic commented Feb 2, 2024

Yes, I believe that's because we "lost" the C/C++ results on main for a long while now.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ksunden
Copy link
Member

ksunden commented Feb 2, 2024

All of the new alerts are in the subprojects directory (i.e freetype/qhull code), so we can probably either mark them as won't fix (like we have for some in ttconv/other extern things) or filter out the subprojects directory from results, as I don't think we are going to change that code.

@ksunden ksunden merged commit 26832df into matplotlib:main Feb 2, 2024
@QuLogic QuLogic deleted the fix-codeql branch February 5, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: testing CI configuration and testing Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants