Skip to content

Commit 0771dc5

Browse files
committed
ci: use uv to install gcovr and sphinx
Change-Id: I1f04e20ef45f7352fddd4fdad7b7c418721a59ec
1 parent 4b465b5 commit 0771dc5

5 files changed

Lines changed: 65 additions & 41 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: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,25 @@ DNF_PKGS=(
3030
sqlite-devel
3131
)
3232
FORMULAE=(boost openssl pkgconf)
33-
PIP_PKGS=()
3433
case $JOB_NAME in
3534
*code-coverage)
36-
APT_PKGS+=(lcov python3-pip)
37-
PIP_PKGS+=('gcovr~=5.2')
35+
APT_PKGS+=(lcov)
3836
;;
3937
*Docs)
40-
APT_PKGS+=(python3-pip)
41-
PIP_PKGS+=(sphinx)
4238
;;
4339
esac
4440

41+
install_uv() {
42+
if [[ -z $GITHUB_ACTIONS && $ID_LIKE == *debian* ]]; then
43+
sudo apt-get install -qy --no-install-recommends pipx
44+
pipx upgrade uv || pipx install uv
45+
fi
46+
}
47+
4548
set -x
4649

4750
if [[ $ID == macos ]]; then
51+
export HOMEBREW_COLOR=1
4852
export HOMEBREW_NO_ENV_HINTS=1
4953
if [[ -n $GITHUB_ACTIONS ]]; then
5054
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
@@ -58,6 +62,14 @@ elif [[ $ID_LIKE == *fedora* ]]; then
5862
sudo dnf install -y "${DNF_PKGS[@]}"
5963
fi
6064

61-
if (( ${#PIP_PKGS[@]} )); then
62-
pip3 install --user --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}"
63-
fi
65+
case $JOB_NAME in
66+
*code-coverage)
67+
install_uv
68+
;;
69+
*Docs)
70+
install_uv
71+
export FORCE_COLOR=1
72+
export UV_NO_MANAGED_PYTHON=1
73+
uv tool install sphinx --upgrade --with-requirements manpages/requirements.txt
74+
;;
75+
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
1515
./waf --color=yes configure --with-tests
1616
./waf --color=yes build

.jenkins.d/30-coverage.sh

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
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-
--filter tools/ \
9-
--exclude-throw-branches \
10-
--exclude-unreachable-branches \
11-
--cobertura build/coverage.xml \
12-
--html-details build/gcovr/ \
13-
--print-summary
4+
[[ $JOB_NAME == *code-coverage ]] || exit 0
145

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

24-
genhtml --branch-coverage \
25-
--demangle-cpp \
26-
--legend \
27-
--output-directory build/lcov \
28-
--title "ndn-tools unit tests" \
29-
build/coverage.info
30-
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+
--filter tools/ \
16+
--exclude-throw-branches \
17+
--exclude-unreachable-branches \
18+
--cobertura build/coverage.xml \
19+
--html-details build/gcovr/ \
20+
--print-summary
21+
22+
# Generate a detailed HTML report using lcov
23+
lcov --quiet \
24+
--capture \
25+
--directory . \
26+
--exclude "$PWD/tests/*" \
27+
--no-external \
28+
--rc lcov_branch_coverage=1 \
29+
--output-file build/coverage.info
30+
31+
genhtml --branch-coverage \
32+
--demangle-cpp \
33+
--legend \
34+
--output-directory build/lcov \
35+
--title "ndn-tools unit tests" \
36+
build/coverage.info

manpages/requirements.txt

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

0 commit comments

Comments
 (0)