Skip to content

Commit b9792dd

Browse files
committed
ci: use uv to install gcovr and sphinx
Change-Id: If41dc0b522c70f462b62c34f54c40f73c39565b1
1 parent e11fa9a commit b9792dd

5 files changed

Lines changed: 69 additions & 43 deletions

File tree

.jenkins

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ case $(uname) in
1010
fi
1111
export ID VERSION_ID
1212
export ID_LIKE="${ID} ${ID_LIKE} linux"
13-
export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
13+
if [[ -z $GITHUB_ACTIONS ]]; then
14+
export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
15+
fi
1416
;;
1517
Darwin)
1618
# Emulate a subset of os-release(5)
1719
export ID=macos
1820
export VERSION_ID=$(sw_vers -productVersion)
19-
export PATH="/usr/local/bin${PATH:+:}${PATH}"
21+
if [[ -z $GITHUB_ACTIONS ]]; then
22+
export PATH="/usr/local/bin${PATH:+:}${PATH}"
23+
fi
2024
if [[ -x /opt/homebrew/bin/brew ]]; then
2125
eval "$(/opt/homebrew/bin/brew shellenv)"
2226
elif [[ -x /usr/local/bin/brew ]]; then
@@ -27,9 +31,9 @@ esac
2731

2832
export CACHE_DIR=${CACHE_DIR:-/tmp}
2933

30-
if [[ $JOB_NAME == *"code-coverage" ]]; then
31-
export DISABLE_ASAN=yes
32-
export DISABLE_HEADERS_CHECK=yes
34+
if [[ $JOB_NAME == *code-coverage ]]; then
35+
export DISABLE_ASAN=1
36+
export DISABLE_HEADERS_CHECK=1
3337
fi
3438

3539
# https://reproducible-builds.org/docs/source-date-epoch/

.jenkins.d/00-deps.sh

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,27 @@ DNF_PKGS=(
3232
systemd-devel
3333
)
3434
FORMULAE=(boost openssl pkgconf)
35-
PIP_PKGS=()
3635
case $JOB_NAME in
3736
*code-coverage)
38-
APT_PKGS+=(lcov python3-pip)
39-
PIP_PKGS+=('gcovr~=5.2')
37+
APT_PKGS+=(lcov)
4038
;;
4139
*Docs)
42-
APT_PKGS+=(doxygen graphviz python3-pip)
40+
APT_PKGS+=(doxygen graphviz)
4341
FORMULAE+=(doxygen graphviz)
44-
PIP_PKGS+=(sphinx sphinxcontrib-doxylink)
4542
;;
4643
esac
4744

45+
install_uv() {
46+
if [[ -z $GITHUB_ACTIONS && $ID_LIKE == *debian* ]]; then
47+
sudo apt-get install -qy --no-install-recommends pipx
48+
pipx upgrade uv || pipx install uv
49+
fi
50+
}
51+
4852
set -x
4953

5054
if [[ $ID == macos ]]; then
55+
export HOMEBREW_COLOR=1
5156
export HOMEBREW_NO_ENV_HINTS=1
5257
if [[ -n $GITHUB_ACTIONS ]]; then
5358
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
@@ -61,6 +66,14 @@ elif [[ $ID_LIKE == *fedora* ]]; then
6166
sudo dnf install -y "${DNF_PKGS[@]}"
6267
fi
6368

64-
if (( ${#PIP_PKGS[@]} )); then
65-
pip3 install --user --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}"
66-
fi
69+
case $JOB_NAME in
70+
*code-coverage)
71+
install_uv
72+
;;
73+
*Docs)
74+
install_uv
75+
export FORCE_COLOR=1
76+
export UV_NO_MANAGED_PYTHON=1
77+
uv tool install sphinx --upgrade --with-requirements docs/requirements.txt
78+
;;
79+
esac

.jenkins.d/10-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set -eo pipefail
44
if [[ -z $DISABLE_ASAN ]]; then
55
ASAN="--with-sanitizer=address"
66
fi
7-
if [[ $JOB_NAME == *"code-coverage" ]]; then
7+
if [[ $JOB_NAME == *code-coverage ]]; then
88
COVERAGE="--with-coverage"
99
fi
1010

1111
set -x
1212

13-
if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
13+
if [[ $JOB_NAME != *code-coverage && $JOB_NAME != *limited-build ]]; then
1414
# Build in release mode with tests and without precompiled headers
1515
./waf --color=yes configure --with-tests --without-pch
1616
./waf --color=yes build

.jenkins.d/30-coverage.sh

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
#!/usr/bin/env bash
2-
set -exo pipefail
2+
set -eo pipefail
33

4-
if [[ $JOB_NAME == *"code-coverage" ]]; then
5-
# Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
6-
# Note: trailing slashes are important in the paths below. Do not remove them!
7-
gcovr --object-directory build \
8-
--exclude tests/ \
9-
--exclude websocketpp/ \
10-
--exclude-throw-branches \
11-
--exclude-unreachable-branches \
12-
--cobertura build/coverage.xml \
13-
--html-details build/gcovr/ \
14-
--print-summary
4+
[[ $JOB_NAME == *code-coverage ]] || exit 0
155

16-
# Generate a detailed HTML report using lcov
17-
lcov --quiet \
18-
--capture \
19-
--directory . \
20-
--exclude "$PWD/tests/*" \
21-
--exclude "$PWD/websocketpp/*" \
22-
--no-external \
23-
--rc lcov_branch_coverage=1 \
24-
--output-file build/coverage.info
6+
export FORCE_COLOR=1
7+
export UV_NO_MANAGED_PYTHON=1
258

26-
genhtml --branch-coverage \
27-
--demangle-cpp \
28-
--legend \
29-
--output-directory build/lcov \
30-
--title "NFD unit tests" \
31-
build/coverage.info
32-
fi
9+
set -x
10+
11+
# Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
12+
# Note: trailing slashes are important in the paths below. Do not remove them!
13+
uvx gcovr@5.2 \
14+
--object-directory build \
15+
--exclude tests/ \
16+
--exclude websocketpp/ \
17+
--exclude-throw-branches \
18+
--exclude-unreachable-branches \
19+
--cobertura build/coverage.xml \
20+
--html-details build/gcovr/ \
21+
--print-summary
22+
23+
# Generate a detailed HTML report using lcov
24+
lcov --quiet \
25+
--capture \
26+
--directory . \
27+
--exclude "$PWD/tests/*" \
28+
--exclude "$PWD/websocketpp/*" \
29+
--no-external \
30+
--rc lcov_branch_coverage=1 \
31+
--output-file build/coverage.info
32+
33+
genhtml --branch-coverage \
34+
--demangle-cpp \
35+
--legend \
36+
--output-directory build/lcov \
37+
--title "NFD unit tests" \
38+
build/coverage.info

docs/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docutils>=0.20
2+
sphinx>=7.0.1,<9
3+
sphinxcontrib-doxylink~=1.13

0 commit comments

Comments
 (0)