Skip to content

task: coverity - #244

Open
jharlow-intel wants to merge 5 commits into
masterfrom
task/coverity
Open

jharlow-intel wants to merge 5 commits into
masterfrom
task/coverity

Conversation

@jharlow-intel

Copy link
Copy Markdown
Collaborator

https://scan.coverity.com/projects/intelpython-mkl-service?tab=overview

adding mkl-service to open-source coverity scanning w/ a github action workflow

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical build-tool and Coverity project configuration issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds scheduled/manual Coverity Scan integration for the C/Cython build and a README status badge.

Changes:

  • Adds a GitHub Actions workflow for Coverity setup, build capture, and submission.
  • Adds a Coverity Scan badge to README.md.
File summaries
File Summary Review findings
README.md Adds the Coverity Scan status badge. No findings.
.github/workflows/coverity.yml Configures oneMKL installation, Coverity capture, and result submission. Critical: Install meson-python, ninja, and cmake before the non-isolated build. Critical: Correct COVERITY_PROJECT to the registered project identifier (also on line 151). Nit: Update the outdated setup.py diagnostic comment.
Review details

Suppressed comments (1)

.github/workflows/coverity.yml:152

  • The Coverity upload API selects the project from the project query parameter; passing it only as a multipart form field does not target the registered project. As written, this submission will not be associated with IntelPython/mkl-service; put COVERITY_PROJECT in the upload URL instead.
               --form project="${COVERITY_PROJECT}" \
               https://scan.coverity.com/builds
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

cancel-in-progress: true

env:
COVERITY_PROJECT: IntelPython/mkl-service

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

IntelPython/mkl-service is the registered project name: the heading at https://scan.coverity.com/projects/intelpython-mkl-service reads "Coverity Scan: IntelPython/mkl-service", and intelpython-mkl-service is only the URL slug derived from it. mkl_fft's workflow sends IntelPython/mkl_fft the same way and its weekly scans pass. Kept the value and added a comment explaining the distinction in 9a06323.

Comment thread .github/workflows/coverity.yml Outdated
- name: Install build dependencies
# Cython is pinned here only (not in pyproject.toml) to keep the generated
# code stable between scans, so Coverity CIDs and their triage survive
run: pip install "setuptools>=77" "cython==3.3.0" "wheel>=0.45.1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That is a valid point.
mkl-service is currently built using Meson
@jharlow-intel please update it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 9a06323: the step now runs pip install meson-python ninja cmake "cython==3.3.0" mkl-devel, the same tooling build-with-standard-clang.yml uses, and the oneAPI apt repo / setvars.sh steps are gone. Verified locally on current master in a fresh venv: pip install . --no-build-isolation --no-deps finds MKL through CMake, compiles all three extensions, and the test suite passes.

Comment thread .github/workflows/coverity.yml Outdated
Comment on lines +122 to +124
# setup.py hard-requires MKLROOT and only raises a bare ValueError if
# it is unset, so surface what setvars.sh resolved it to.
echo "MKLROOT=${MKLROOT}"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed in 9a06323 along with the setvars.sh/MKLROOT lines. The diagnostic note now sits on the install step and describes the real lookup: meson.build's dependency('MKL', method: 'cmake') finds the mkl-devel wheel's CMake config because CMake's find_package searches PATH entries with bin/ stripped as install prefixes.

@antonwolfy antonwolfy added this to the 2.9.0 release milestone Sep 19, 2026
Comment thread .github/workflows/coverity.yml Outdated
- name: Install build dependencies
# Cython is pinned here only (not in pyproject.toml) to keep the generated
# code stable between scans, so Coverity CIDs and their triage survive
run: pip install "setuptools>=77" "cython==3.3.0" "wheel>=0.45.1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That is a valid point.
mkl-service is currently built using Meson
@jharlow-intel please update it

Comment thread .github/workflows/coverity.yml Outdated
Comment on lines +75 to +81
- name: Install Intel oneMKL
# Only oneMKL is needed: both conda recipes pin `c_compiler: gcc`, so the
# shipped packages are gcc builds and that is what Coverity should see.
# icx is exercised separately by build-with-clang.yml, and pulling the
# DPC++ compiler in here would analyze a configuration we do not ship.
timeout-minutes: 25
run: sudo apt-get install -y intel-oneapi-mkl-devel

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need that step?
mkl-devel is already in [build-system].requires and meson.build finds MKL via CMake.
mkl_fft only does pip install mkl-devel in its Coverity workflow

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, it is not needed. Dropped the apt repo and intel-oneapi-mkl-devel steps in 9a06323; the install step now does pip install ... mkl-devel like mkl_fft.

Comment thread .github/workflows/coverity.yml Outdated
source "${ONEAPI_ROOT}/setvars.sh"
# setup.py hard-requires MKLROOT and only raises a bare ValueError if
# it is unset, so surface what setvars.sh resolved it to.
echo "MKLROOT=${MKLROOT}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this won't be necessary after you switch to meson
echo "MKLROOT=${MKLROOT}"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, removed together with the setvars.sh sourcing in 9a06323.

Comment thread README.md
# `mkl-service` - Python package for run-time control of Intel® oneAPI Math Kernel Library (oneMKL).
[![Conda package](https://github.com/IntelPython/mkl-service/actions/workflows/conda-package.yml/badge.svg)](https://github.com/IntelPython/mkl-service/actions/workflows/conda-package.yml)
[![Build mkl-service with clang](https://github.com/IntelPython/mkl-service/actions/workflows/build-with-clang.yml/badge.svg)](https://github.com/IntelPython/mkl-service/actions/workflows/build-with-clang.yml)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/intelpython-mkl-service/badge.svg)](https://scan.coverity.com/projects/intelpython-mkl-service)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is the path to badge.svg correct?
In mkl_fft the link contains a numeric project ID

[![Coverity Scan Build Status](https://scan.coverity.com/projects/33202/badge.svg)](https://scan.coverity.com/projects/intelpython-mkl_fft)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, both forms resolve. https://scan.coverity.com/projects/intelpython-mkl-service/badge.svg returns HTTP 200 image/svg+xml and currently renders "coverity | pending" because no build has been uploaded yet. Coverity's embed snippet uses the numeric ID, which is what mkl_fft copied, but the slug form works and matches the link target, so I kept it.

ndgrigorian and others added 3 commits October 5, 2026 07:50
- Install meson-python, ninja, cmake and mkl-devel from PyPI, as the
  other --no-build-isolation workflows do, instead of the oneAPI apt repo
- Drop setvars.sh/MKLROOT; meson.build locates oneMKL through CMake
- Refresh comments for the three extensions built by meson.build and
  document why COVERITY_PROJECT is the owner/repo name, not the URL slug
- Pin actions/checkout and actions/setup-python to the SHAs master uses
- List the workflow in .github/AGENTS.md
on:
schedule:
- cron: "0 1 * * 1" # Mondays 01:00 UTC; well under the free build quota
workflow_dispatch:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is no github.ref check, so a run started from a feature branch replaces the master results on the dashboard. Fix: add github.ref == 'refs/heads/master' to the job's if:.

- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we bump python version? Can we use 3.14t?

# _mkl_memory.c) are genuinely recompiled under cov-build. An editable
# install reusing a stale build/ would instead yield "No files were
# emitted", which the upload rejects.
cov-build --dir cov-int pip install . --no-build-isolation --no-deps 2>&1 | tee cov-build.log

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Saving cov-build.log and cov-int/build-log.txt as artifacts (if: always()) would make post-merge failures possible to debug.

Comment thread .github/AGENTS.md
- **build_pip.yml** — validates editable build
- **pre-commit.yml** — code quality checks (flake8, etc.)
- **openssf-scorecard.yml** — security posture scanning
- **coverity.yml** — weekly Coverity Scan static analysis of the C/Cython extensions (scan.coverity.com)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The root AGENTS.md workflow list also needs a coverity.yml entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants