Skip to content

Commit 83b5ff8

Browse files
committed
task: coverity
1 parent 3abbf5d commit 83b5ff8

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/coverity.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Coverity Scan
2+
3+
on:
4+
schedule:
5+
- cron: "0 1 * * 1"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: coverity-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
COVERITY_PROJECT: IntelPython/mkl_umath
17+
ONEAPI_ROOT: /opt/intel/oneapi
18+
19+
jobs:
20+
coverity-scan:
21+
if: github.repository == 'IntelPython/mkl_umath'
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 90
24+
25+
steps:
26+
- name: Checkout repo
27+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28+
29+
- name: Setup Python
30+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
31+
with:
32+
python-version: "3.12"
33+
architecture: x64
34+
35+
- name: Add Intel repository
36+
run: |
37+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
38+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
39+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
40+
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
41+
sudo apt-get update
42+
43+
- name: Install Intel oneAPI
44+
timeout-minutes: 25
45+
run: |
46+
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp
47+
sudo apt-get install -y intel-oneapi-mkl-devel
48+
49+
- name: Install mkl_umath dependencies
50+
run: pip install scikit-build cmake ninja cython "setuptools>=77" "numpy>=2"
51+
52+
- name: Download Coverity Build Tool
53+
timeout-minutes: 15
54+
env:
55+
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
56+
run: |
57+
curl --location --no-progress-meter --fail-with-body \
58+
--retry 5 --retry-connrefused --retry-delay 5 \
59+
--data-urlencode "token=${COVERITY_SCAN_TOKEN}" \
60+
--data-urlencode "project=${COVERITY_PROJECT}" \
61+
--output cov-analysis.tar.gz \
62+
https://scan.coverity.com/download/linux64
63+
mkdir -p cov-analysis
64+
tar -xzf cov-analysis.tar.gz --strip 1 -C cov-analysis
65+
echo "${PWD}/cov-analysis/bin" >> "$GITHUB_PATH"
66+
67+
- name: Build under cov-build
68+
timeout-minutes: 20
69+
run: |
70+
# shellcheck disable=SC1091
71+
source "${ONEAPI_ROOT}/setvars.sh"
72+
export CC="${CMPLR_ROOT}/bin/icx"
73+
cov-configure --template --comptype clangcc --compiler "${CC}"
74+
rm -rf _skbuild
75+
cov-build --dir cov-int pip install . --no-build-isolation --no-deps 2>&1 | tee cov-build.log
76+
if ! grep -qE "Emitted [1-9][0-9]* .*compilation unit" cov-build.log; then
77+
echo "::error::Coverity captured 0 compilation units — the C build did not run under cov-build."
78+
exit 1
79+
fi
80+
81+
- name: Submit results to Coverity Scan
82+
timeout-minutes: 15
83+
env:
84+
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
85+
COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
86+
run: |
87+
tar -czf cov-int.tgz cov-int
88+
curl --no-progress-meter --fail-with-body \
89+
--retry 5 --retry-connrefused --retry-delay 5 \
90+
--form token="${COVERITY_SCAN_TOKEN}" \
91+
--form email="${COVERITY_SCAN_EMAIL}" \
92+
--form file=@cov-int.tgz \
93+
--form version="${GITHUB_SHA}" \
94+
--form description="GitHub Actions ${GITHUB_REF_NAME} (run ${GITHUB_RUN_ID})" \
95+
--form project="${COVERITY_PROJECT}" \
96+
https://scan.coverity.com/builds

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Conda package](https://github.com/IntelPython/mkl_umath/actions/workflows/conda-package.yml/badge.svg)](https://github.com/IntelPython/mkl_umath/actions/workflows/conda-package.yml)
22
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/IntelPython/mkl_umath/badge)](https://securityscorecards.dev/viewer/?uri=github.com/IntelPython/mkl_umath)
3+
[![Coverity Scan Build Status](https://scan.coverity.com/projects/33201/badge.svg)](https://scan.coverity.com/projects/intelpython-mkl_umath)
34

45
# `mkl_umath`
56

0 commit comments

Comments
 (0)