-
-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (90 loc) · 2.97 KB
/
coverage.yml
File metadata and controls
90 lines (90 loc) · 2.97 KB
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
name: Run coverage tests
on: [workflow_dispatch, workflow_call]
jobs:
coverage:
timeout-minutes: 20
runs-on: ${{ matrix.os }}
env:
CFLAGS: -Wall -Wpedantic -Werror -std=c17 -Wconversion
strategy:
matrix:
os: [ubuntu-24.04]
python-version: [pypy3.11, "graalpy-25.0", "3.x"]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- run: sudo apt-get update
- run: sudo apt-get install autoconf-archive lcov
- name: Setup locales
run: |
sudo locale-gen ru_RU.UTF-8
sudo locale-gen ps_AF.UTF-8
- name: Cache GNU GMP builds
id: cache-gmp
uses: actions/cache@v5
with:
path: .local
key: ${{ matrix.os }}-${{ hashFiles('scripts/*') }}
- run: bash scripts/cibw_before_all.sh
if: steps.cache-gmp.outputs.cache-hit != 'true'
- run: python -m pip install --upgrade pip
- run: |
pip install --verbose .[ci] -Cbuild-dir=build \
-Csetup-args=-Dbuildtype=debug \
-Csetup-args=-Db_coverage=true
env:
PKG_CONFIG_PATH: ${{ github.workspace }}/.local/lib/pkgconfig
- run: pytest
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/.local/lib
- name: Get coverage data
run: |
lcov --capture --directory build/ --output-file coverage.info
lcov --remove coverage.info "*.h" --ignore-errors unused \
--output-file coverage.info
cp coverage.info build/coverage-${{ matrix.python-version }}.info
- uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.python-version }}
path: |
build/coverage-${{ matrix.python-version }}.info
retention-days: 1
merge-coverage:
runs-on: ubuntu-24.04
needs:
- coverage
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- run: sudo apt-get update
- run: sudo apt-get install lcov diff-cover
- uses: actions/download-artifact@v8
with:
pattern: coverage-*
path: build/
merge-multiple: true
- run: |
genhtml build/coverage*.info --hierarchical \
--output-directory build/coverage
- run: |
diff-cover build/coverage*.info --fail-under=100 \
--compare-branch=origin/master
- uses: actions/upload-artifact@v7
with:
name: coverage
path: |
build/coverage/
build/coverage*.info
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
gcov_ignore: pythoncapi_compat.h
gcov_include: '*.c'
gcov_args: --no-external --preserve-paths
fail_ci_if_error: true