Skip to content

Commit 15111b4

Browse files
authored
[CI] Add Coverity workflow (#16894)
1 parent 498af15 commit 15111b4

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/coverity.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Coverity
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * 0'
6+
7+
permissions: read-all
8+
9+
jobs:
10+
coverity:
11+
name: Coverity
12+
runs-on: [Linux, build]
13+
container:
14+
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps
15+
options: -u 1001:1001
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
sparse-checkout: |
21+
devops/actions
22+
23+
- name: Register cleanup after job is finished
24+
uses: ./devops/actions/cleanup
25+
26+
- uses: ./devops/actions/cached_checkout
27+
with:
28+
path: src
29+
ref: ${{ github.sha }}
30+
cache_path: "/__w/repo_cache/"
31+
32+
- name: Get coverity tool
33+
run: |
34+
wget https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=intel%2Fllvm" -O coverity_tool.tgz
35+
tar -xf coverity_tool.tgz
36+
37+
- name: Configure
38+
env:
39+
CC: gcc
40+
CXX: g++
41+
CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs"
42+
run: |
43+
mkdir -p $GITHUB_WORKSPACE/build
44+
cd $GITHUB_WORKSPACE/build
45+
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
46+
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \
47+
--ci-defaults --hip --cuda \
48+
--cmake-opt="-DNATIVECPU_USE_OCK=Off" \
49+
--cmake-opt="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SPIRV"
50+
51+
- name: Build with coverity
52+
run: $GITHUB_WORKSPACE/cov-analysis-linux64-*/bin/cov-build --dir cov-int cmake --build $GITHUB_WORKSPACE/build
53+
54+
- name: Compress results
55+
run: tar -czf intel_llvm.tgz cov-int
56+
57+
- name: Submit build
58+
run: |
59+
# Initialize a build. Fetch a cloud upload url.
60+
curl -X POST \
61+
-d version="sycl: ${{ github.sha }}" \
62+
-d description="Regular build" \
63+
-d email=${{ secrets.COVERITY_EMAIL }} \
64+
-d token=${{ secrets.COVERITY_TOKEN }} \
65+
-d file_name="intel_llvm.tgz" \
66+
https://scan.coverity.com/projects/31090/builds/init \
67+
| tee response
68+
69+
# Store response data to use in later stages.
70+
upload_url=$(jq -r '.url' response)
71+
build_id=$(jq -r '.build_id' response)
72+
73+
# Upload the tarball to the Cloud.
74+
curl -X PUT \
75+
--header 'Content-Type: application/json' \
76+
--upload-file $PWD/intel_llvm.tgz \
77+
$upload_url
78+
79+
# Trigger the build on Scan.
80+
curl -X PUT \
81+
-d token=${{ secrets.COVERITY_TOKEN }} \
82+
https://scan.coverity.com/projects/31090/builds/$build_id/enqueue

0 commit comments

Comments
 (0)