Repository navigation
86 lines (73 loc) · 2.64 KB
/
Copy pathcoverage.yml
File metadata and controls
86 lines (73 loc) · 2.64 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
name: Coverage
on:
push:
branches:
- master
pull_request:
merge_group:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
coverage:
name: Run coverage
runs-on: ubuntu-24.04
timeout-minutes: 75
env:
NIMBLE_COMMIT: aa8e6ea09ecac774b6fad42552569ce07bef37ec # v0.24.1
CICOV: YES
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Nim
uses: "./.github/actions/install_nim"
with:
os: linux-gcc-14
cpu: amd64
shell: bash
nim_ref: v2.2.14
- name: Use gcc 14
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
sudo update-alternatives --set gcc /usr/bin/gcc-14
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 14
sudo update-alternatives --set g++ /usr/bin/g++-14
- name: Restore dependencies from cache
uses: "./.github/actions/install_test_deps"
with:
os: linux-gcc-14
cpu: amd64
cc: gcc
nim_ref: v2.2.14
- name: Setup deps
run: make setup
- name: Setup coverage
run: |
sudo apt-get update
sudo apt-get install -y lcov build-essential git curl
mkdir coverage
- name: Build test_all
run: |
NIMFLAGS="--nimcache:nimcache/test_all --opt:none --lineDir:on --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage --skipUserCfg"
NIMFLAGS="$NIMFLAGS -d:chronicles_log_level=INFO -d:libp2p_testing_slow"
nim c $NIMFLAGS ./tests/test_all
- name: Run tests
run: |
./tests/test_all
# Nim attributes generated C code to non-code lines and to lines past the end of the file.
- name: Run coverage
run: |
lcov --capture --directory nimcache --gcov-tool gcov-14 --ignore-errors mismatch \
--include "${PWD}/libp2p/*" --output-file coverage/coverage.info
lcov --extract coverage/coverage.info "${PWD}/libp2p/*" --output-file coverage/coverage.f.info \
--rc c_file_extensions=nim --filter range,blank \
--omit-lines '^\s*#' \
--omit-lines '^\s*(proc|func|method|iterator|template)\b([^=]*|.*=\s*(#.*)?)$' \
--omit-lines '^\s*[\)\]\}]+\s*$'
- name: Require at least 90% line coverage
run: lcov --summary coverage/coverage.f.info --fail-under-lines 90