-
Notifications
You must be signed in to change notification settings - Fork 30
155 lines (137 loc) · 5.23 KB
/
generate-coverage.yaml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Generate coverage data
on:
pull_request:
push:
branches: [master]
permissions: read-all
jobs:
generate-coverage:
name: Generate coverage and push to Coveralls.io
runs-on: ubuntu-latest
timeout-minutes: 150
permissions:
pull-requests: write
env:
ONEAPI_ROOT: /opt/intel/oneapi
GTEST_ROOT: /home/runner/work/googletest-1.15.2/install
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Add Intel repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
cat GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
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: Run SYCL list
run: |
source /opt/intel/oneapi/setvars.sh
sycl-ls --verbose
- name: Install CMake and Ninja
run: |
sudo apt-get install ninja-build
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: x64
- name: Cache Gtest
id: cache-gtest
uses: actions/cache@v4
with:
path: |
/home/runner/work/googletest-1.15.2/install
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-1.15.2/install/include/gtest/*') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Gtest
if: steps.cache-gtest.outputs.cache-hit != 'true'
shell: bash -l {0}
run: |
cd /home/runner/work
wget https://github.com/google/googletest/archive/refs/tags/v1.15.2.tar.gz
tar xf v1.15.2.tar.gz
cd googletest-1.15.2
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-1.15.2/install
make && make install
- name: Checkout repo
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: Install Lcov
run: |
sudo apt-get install lcov
- name: Install dpctl dependencies
shell: bash -l {0}
run: |
pip install numpy cython setuptools pytest pytest-cov scikit-build cmake coverage[toml] versioneer[toml]==0.29
- name: Build dpctl with coverage
shell: bash -l {0}
env:
SYCL_CACHE_PERSISTENT: 1
run: |
source /opt/intel/oneapi/setvars.sh
python scripts/gen_coverage.py --verbose
- name: Install coverall dependencies
shell: bash -l {0}
run: |
sudo gem install coveralls-lcov
pip install coveralls
- name: Upload coverage data to coveralls.io
shell: bash -l {0}
run: |
echo "Processing c-api-coverage"
export DPCTL_LCOV_FN=$(find _skbuild -name dpctl.lcov)
grep "/tmp" $DPCTL_LCOV_FN
coveralls-lcov -v -n \
$DPCTL_LCOV_FN > dpctl-c-api-coverage.json
echo "Processing pytest-coverage"
export DPCTL_PYTEST_LCOV=$(find . -name dpctl_pytest.lcov)
grep "/tmp" $DPCTL_PYTEST_LCOV
coveralls-lcov -v -n \
$DPCTL_PYTEST_LCOV > pytest-dpctl-c-api-coverage.json
echo "Merging JSON files"
python -c "import json; \
fh1 = open('dpctl-c-api-coverage.json', 'r'); \
f1 = json.load(fh1); fh1.close(); \
fh2 = open('pytest-dpctl-c-api-coverage.json', 'r'); \
f2 = json.load(fh2); fh2.close(); \
f3 = {'source_files': f1['source_files'] + f2['source_files']}; \
fh3 = open('combined-dpctl-c-api-coverage.json', 'w'); \
json.dump(f3, fh3); fh3.close()" || exit 1
# merge combined file with coverage data and upload
ls -lh dpctl-c-api-coverage.json pytest-dpctl-c-api-coverage.json \
combined-dpctl-c-api-coverage.json \
$(find _skbuild -name dpctl.lcov) $(find . -name dpctl_pytest.lcov)
echo "Merging combined files with coverage data"
coveralls --service=github --merge=combined-dpctl-c-api-coverage.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
SYCL_QUEUE_THREAD_POOL_SIZE: 6
coveralls:
name: Indicate completion to coveralls.io
needs: generate-coverage
runs-on: ubuntu-latest
timeout-minutes: 20
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}