Skip to content

Commit 780b24f

Browse files
author
Diptorup Deb
committed
Adds a new github CI Action to generate coverage and upload to coveralls.io.
- A new github action that builds dpctl in develop mode with coverage enabled. - The coverage reports for dpctl C and Python APIs are merged and uploaded to coveralls.io.
1 parent 20821af commit 780b24f

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Generate coverage data
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
generate-coverage:
9+
name: Generate coverage and push to Coveralls.io
10+
runs-on: ubuntu-20.04
11+
12+
env:
13+
ONEAPI_ROOT: /opt/intel/oneapi
14+
GTEST_ROOT: /home/runner/work/googletest-release-1.10.0/install
15+
16+
steps:
17+
- name: Cancel Previous Runs
18+
uses: styfle/[email protected]
19+
with:
20+
access_token: ${{ github.token }}
21+
22+
- name: Add Intel repository
23+
run: |
24+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
25+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
26+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
27+
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
28+
sudo apt-get update
29+
30+
- name: Install Intel OneAPI
31+
run: |
32+
sudo apt-get install intel-oneapi-dpcpp-cpp-compiler
33+
sudo apt-get install intel-oneapi-tbb
34+
35+
- name: Install CMake
36+
run: |
37+
sudo apt-get install cmake
38+
39+
- name: Setup Python
40+
uses: actions/setup-python@v2
41+
with:
42+
python-version: '3.8'
43+
architecture: x64
44+
45+
- name: Cache Gtest
46+
id: cache-gtest
47+
uses: actions/cache@v2
48+
with:
49+
path: |
50+
/home/runner/work/googletest-release-1.10.0/install
51+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-release-1.10.0/install/include/gtest/*') }}
52+
restore-keys: |
53+
${{ runner.os }}-build-${{ env.cache-name }}-
54+
${{ runner.os }}-build-
55+
${{ runner.os }}-
56+
57+
- name: Install Gtest
58+
if: steps.cache-gtest.outputs.cache-hit != 'true'
59+
shell: bash -l {0}
60+
run: |
61+
cd /home/runner/work
62+
wget https://github.com/google/googletest/archive/refs/tags/release-1.10.0.tar.gz
63+
tar xf release-1.10.0.tar.gz
64+
cd googletest-release-1.10.0
65+
mkdir build
66+
cd build
67+
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-release-1.10.0/install
68+
make && make install
69+
70+
- name: Checkout repo
71+
uses: actions/checkout@v2
72+
with:
73+
fetch-depth: 0
74+
75+
- name: Install Lcov
76+
run: |
77+
sudo apt-get install lcov
78+
79+
- name: Install dpctl dependencies
80+
shell: bash -l {0}
81+
run: |
82+
pip install numpy cython setuptools pytest pytest-cov coverage
83+
84+
- name: Build dpctl with coverage
85+
shell: bash -l {0}
86+
run: |
87+
source /opt/intel/oneapi/setvars.sh
88+
python setup.py develop --coverage=True
89+
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()"
90+
pytest -q -ra --disable-warnings --cov dpctl --cov-report term-missing --pyargs dpctl -vv
91+
92+
- name: Install coverall dependencies
93+
shell: bash -l {0}
94+
run: |
95+
sudo gem install coveralls-lcov
96+
pip install coveralls
97+
98+
- name: Upload coverage data to coveralls.io
99+
run: |
100+
coveralls-lcov -v -n build_cmake/tests/dpctl.lcov > dpctl-c-api-coverage.json
101+
coveralls --service=github --merge=dpctl-c-api-coverage.json
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
COVERALLS_PARALLEL: true
105+
106+
coveralls:
107+
name: Indicate completion to coveralls.io
108+
needs: generate-coverage
109+
runs-on: ubuntu-latest
110+
container: python:3-slim
111+
steps:
112+
- name: Finished
113+
run: |
114+
pip3 install --upgrade coveralls
115+
coveralls --finish
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)