-
Notifications
You must be signed in to change notification settings - Fork 22
147 lines (123 loc) · 4.99 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
name: Generate coverage data for dpnp
on:
pull_request:
push:
branches: [master]
permissions: read-all
jobs:
generate-coverage:
name: Generate coverage and push to Coveralls.io
runs-on: ubuntu-latest
permissions:
# Needed to cancel any previous runs that are not completed for a given workflow
actions: write
defaults:
run:
shell: bash -el {0}
env:
environment-file: 'environments/environment.yml'
build-with-oneapi-env: 'environments/build_with_oneapi.yml'
coverage-env: 'environments/coverage.yml'
oneapi-pkgs-env: ''
# Enable env when it's required to use only conda packages without OneAPI installation
# oneapi-pkgs-env: 'environments/oneapi_pkgs.yml'
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 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 hwloc \
intel-oneapi-mkl \
intel-oneapi-umf \
intel-oneapi-mkl-devel \
intel-oneapi-tbb-devel \
intel-oneapi-libdpstd-devel \
intel-oneapi-compiler-dpcpp-cpp
- name: Install Lcov
run: |
sudo apt-get install lcov
sudo gem install coveralls-lcov
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install conda-merge tool
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
with:
packages: conda-merge
- name: Merge conda env files
run: |
conda-merge ${{ env.build-with-oneapi-env }} ${{ env.coverage-env }} ${{ env.oneapi-pkgs-env }} > ${{ env.environment-file }}
cat ${{ env.environment-file }}
- name: Setup miniconda
id: setup_miniconda
continue-on-error: true
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
environment-file: '${{ env.environment-file }}'
activate-environment: 'coverage'
- name: ReSetup miniconda
if: steps.setup_miniconda.outcome == 'failure'
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
with:
miniforge-version: latest
use-mamba: 'true'
conda-remove-defaults: 'true'
environment-file: '${{ env.environment-file }}'
activate-environment: 'coverage'
- name: Conda info
run: |
mamba info
mamba list
- name: Build dpnp with coverage
id: build_coverage
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
with:
shell: bash
timeout_minutes: 60
max_attempts: 5
retry_on: error
command: |
. $CONDA/etc/profile.d/conda.sh
conda activate coverage
[ -f /opt/intel/oneapi/setvars.sh ] && source /opt/intel/oneapi/setvars.sh
git clean -fxd
python scripts/gen_coverage.py --verbose
- name: Total number of coverage attempts
run: |
echo "Total number of coverage attempts: ${{ steps.build_coverage.outputs.total_attempts }}"
- name: Upload coverage data to coveralls.io
run: |
echo "Processing pytest-coverage"
export DPNP_PYTEST_LCOV=$(find . -name dpnp_pytest.lcov)
coveralls-lcov -v -n $DPNP_PYTEST_LCOV > pytest-dpnp-c-api-coverage.json
# merge file with coverage data and upload
echo "Merging files with coverage data"
coveralls --service=github --merge=pytest-dpnp-c-api-coverage.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
coveralls:
name: Indicate completion to coveralls.io
needs: generate-coverage
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls==3.3.1
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}