-
Notifications
You must be signed in to change notification settings - Fork 441
130 lines (124 loc) · 4.91 KB
/
Copy pathcoverage.yml
File metadata and controls
130 lines (124 loc) · 4.91 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
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
name: Code Coverage
on:
push:
branches:
- main
- feat/*
pull_request:
branches:
- main
- feat/*
paths-ignore:
- "docs/**"
- "**.md"
merge_group:
types: [checks_requested]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
# micromamba activation
shell: bash -l -eo pipefail {0}
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Disk Space Before Clean Up
run: |
df -h
- name: Free Disk Space (Base Runner)
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
large-packages: false
docker-images: false
- name: Disk Space After Clean Up
run: |
df -h
- name: Checkout mamba repository
uses: actions/checkout@v7
- name: Create build environment
uses: mamba-org/setup-micromamba@v3
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
cache-environment: true
cache-environment-key: >-
coverage-${{
hashFiles(
'dev/environment-dev.yml',
'dev/environment-dev-extra.yml',
'dev/environment-micromamba-static.yml'
)
}}-${{ github.event.pull_request.number || github.ref }}
- name: Install dev-extra environment
run: micromamba install -n build_env -y -f ./dev/environment-dev-extra.yml
- name: Install micromamba-static environment
run: micromamba install -n build_env -y -f ./dev/environment-micromamba-static.yml
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ github.runner.os }}
restore-keys: |
ccache-libmamba-${{ github.runner.os }}
- name: Build mamba with coverage
run: |
# Ensure ar/ranlib are found: conda compiler activation may not set AR when
# mixing envs (dev + micromamba-static); CMAKE_AR from preset uses $env{AR}
# which can resolve to a bare name, causing "x86_64-conda-linux-gnu-ar: not found"
# when building the static libmamba (micromamba requires BUILD_STATIC).
export AR="${CONDA_PREFIX}/bin/x86_64-conda-linux-gnu-ar"
export RANLIB="${CONDA_PREFIX}/bin/x86_64-conda-linux-gnu-ranlib"
cmake -B build/ -G Ninja \
--preset mamba-unix-shared-debug \
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
-D MAMBA_WARNING_AS_ERROR=ON \
-D BUILD_LIBMAMBA_SPDLOG=ON \
-D BUILD_LIBMAMBAPY=ON \
-D BUILD_MICROMAMBA=ON \
-D ENABLE_MAMBA_ROOT_PREFIX_FALLBACK=OFF \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_CXX_FLAGS_DEBUG="-g -O0 -fno-omit-frame-pointer --coverage -fprofile-update=atomic" \
-D CMAKE_C_FLAGS_DEBUG="-g -O0 -fno-omit-frame-pointer --coverage -fprofile-update=atomic"
cmake --build build/ --parallel
- name: Show build cache statistics
run: sccache --show-stats
- name: Run C++ tests with coverage
continue-on-error: true
run: |
unset CONDARC # Interferes with tests
./build/libmamba/ext/solv-cpp/tests/test_solv_cpp
./build/libmamba/tests/test_libmamba
- name: Install lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov
- name: Generate C++ coverage report
run: |
lcov --directory . --capture --output-file cpp_coverage.info
lcov --remove cpp_coverage.info '/usr/*' '*/tests/*' '*/build/*' 'libmamba/tests/*' --output-file cpp_coverage.info --ignore-errors unused
lcov --summary cpp_coverage.info --ignore-errors mismatch --rc geninfo_unexecuted_blocks=1
# TODO: Those steps need adaptations so that the coverage reports from the C++ and the python test suites are consolidated.
# - name: Install libmambapy
# run: |
# cmake --install build/ --prefix "${CONDA_PREFIX}"
# python -m pip install --no-deps --no-build-isolation ./libmambapy
# - name: Run Python tests with coverage
# continue-on-error: true
# run: |
# # Run libmambapy tests with coverage
# python -m pytest libmambapy/tests/ --cov=libmambapy --cov-report=xml --cov-report=term-missing
# # Run micromamba tests with coverage
# export TEST_MAMBA_EXE=$(pwd)/build/micromamba/mamba
# python -m pytest micromamba/tests/ --cov=micromamba --cov-report=xml --cov-report=term-missing
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
with:
files: |
./cpp_coverage.info
./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}