-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.22 KB
/
ci.yml
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
name: CI
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install scikit-build-core cmake
- name: Install lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov
- name: Configure and build the C extension
run: |
mkdir lib
# Set environment variables for compiler and linker flags
# Build the project
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage" \
pip install . --target lib --no-clean -Cbuild-dir=build
cmake --build build --target test_incstatspy
- name: Install test dependencies
run: |
python -m pip install numpy pytest
- name: Run pytest
run: |
export PYTHONPATH=$(pwd)/lib
pytest test/test_incstatspy.py
- name: Generate coverage data
run: |
export PYTHONPATH=$(pwd)/lib
cd build
./test_incstatspy ../test/test_incstatspy.py
lcov --capture --directory . --directory .. --output-file coverage.info --rc lcov_branch_coverage=1
lcov --remove coverage.info '/usr/*' --output-file coverage.info --rc lcov_branch_coverage=1
lcov --remove coverage.info '/opt/hostedtoolcache/*' --output-file coverage.info --rc lcov_branch_coverage=1
lcov --remove coverage.info '*/numpy/*' --output-file coverage.info --rc lcov_branch_coverage=1
lcov --list coverage.info --rc lcov_branch_coverage=1
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/coverage.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
codecov_yml_path: .github/codecov.yml