-
Notifications
You must be signed in to change notification settings - Fork 41
138 lines (121 loc) · 4.96 KB
/
Copy pathcoverity.yml
File metadata and controls
138 lines (121 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Coverity Scan
on:
schedule:
- cron: "0 1 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: coverity-${{ github.ref }}
cancel-in-progress: true
env:
COVERITY_PROJECT: IntelPython/dpctl
ONEAPI_ROOT: /opt/intel/oneapi
jobs:
coverity-scan:
if: github.repository == 'IntelPython/dpctl'
runs-on: ubuntu-latest
timeout-minutes: 150
steps:
- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# versioneer needs the tags to compute the package version
fetch-depth: 0
- name: Add Intel repository
run: |
wget -qO- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
| sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
- name: Install latest Intel OneAPI
run: |
sudo apt install intel-oneapi-compiler-dpcpp-cpp
sudo apt install intel-oneapi-tbb
sudo apt install intel-oneapi-umf
sudo apt install hwloc
- name: Install CMake and Ninja
run: |
sudo apt-get install ninja-build
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
architecture: x64
- name: Install dpctl dependencies
run: |
pip install numpy cython setuptools"<80" scikit-build cmake ninja versioneer[toml]==0.29
- name: Report compiler version
run: |
source "${ONEAPI_ROOT}/setvars.sh"
icpx --version
- name: Download Coverity Build Tool
timeout-minutes: 15
env:
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
run: |
curl --location --no-progress-meter --fail-with-body \
--retry 5 --retry-connrefused --retry-delay 5 \
--data-urlencode "token=${COVERITY_SCAN_TOKEN}" \
--data-urlencode "project=${COVERITY_PROJECT}" \
--output cov-analysis.tar.gz \
https://scan.coverity.com/download/linux64
mkdir -p cov-analysis
tar -xzf cov-analysis.tar.gz --strip 1 -C cov-analysis
echo "${PWD}/cov-analysis/bin" >> "$GITHUB_PATH"
- name: Configure Coverity for the DPC++ compiler
env:
# icx/icpx are not in Coverity's list of known compilers, so the
# clang-based templates below have to be accepted explicitly
COVERITY_UNSUPPORTED: 1
run: |
source "${ONEAPI_ROOT}/setvars.sh"
# Cython-generated sources and the pybind11 extensions go through
# icpx, the sysroot/driver probing bits still use gcc
cov-configure --gcc
cov-configure --template --comptype clangcc --compiler icx
cov-configure --template --comptype clangcxx --compiler icpx
- name: Build under cov-build
timeout-minutes: 90
env:
COVERITY_UNSUPPORTED: 1
run: |
set -o pipefail
source "${ONEAPI_ROOT}/setvars.sh"
rm -rf _skbuild
# --skip-editable: the in-place build_ext already compiled everything
# Coverity needs to see, a pip install would only repeat it
cov-build --dir cov-int \
python scripts/build_locally.py --oneapi --skip-editable --verbose \
2>&1 | tee cov-build.log
if ! grep -qE "Emitted [1-9][0-9]* .*compilation unit" cov-build.log; then
echo "::error::Coverity captured 0 compilation units — the C++ build did not run under cov-build."
exit 1
fi
- name: Upload Coverity build log
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverity-build-log
path: |
cov-build.log
cov-int/build-log.txt
retention-days: 7
if-no-files-found: warn
- name: Submit results to Coverity Scan
timeout-minutes: 15
env:
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
run: |
tar -czf cov-int.tgz cov-int
curl --no-progress-meter --fail-with-body \
--retry 5 --retry-connrefused --retry-delay 5 \
--form token="${COVERITY_SCAN_TOKEN}" \
--form email="${COVERITY_SCAN_EMAIL}" \
--form file=@cov-int.tgz \
--form version="${GITHUB_SHA}" \
--form description="GitHub Actions ${GITHUB_REF_NAME} (run ${GITHUB_RUN_ID})" \
--form project="${COVERITY_PROJECT}" \
https://scan.coverity.com/builds