From: Aleš Mrázek Date: Tue, 10 Sep 2024 10:02:32 +0000 (+0200) Subject: ci: manager: configure meson before every test X-Git-Tag: v6.0.9~9^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28070cffafe789159cca42b5ac106bb21be66fdb;p=thirdparty%2Fknot-resolver.git ci: manager: configure meson before every test --- diff --git a/.gitlab-ci.manager.yml b/.gitlab-ci.manager.yml index cc94c0bf3..5ba0d40c7 100644 --- a/.gitlab-ci.manager.yml +++ b/.gitlab-ci.manager.yml @@ -6,6 +6,8 @@ default: before_script: - poetry --version - poetry env use $PYTHON_INTERPRETER + - poetry install -E prometheus + - poe configure tags: - docker - linux @@ -14,7 +16,6 @@ default: examples:py3.12: stage: check script: - - poetry install --only main,dev - poe examples variables: PYTHON_INTERPRETER: python3.12 @@ -22,7 +23,6 @@ examples:py3.12: lint:py3.12: stage: check script: - - poetry install --only main,dev,lint - poe check variables: PYTHON_INTERPRETER: python3.12 @@ -30,7 +30,6 @@ lint:py3.12: .unit: &unit stage: check script: - - poetry install --only main,dev,test # create required directories that are in default config, otherwise unit tests fail - mkdir -p /var/cache/knot-resolver - poe test diff --git a/scripts/poe-tasks/check b/scripts/poe-tasks/check index 9cd529e97..8e6507e4e 100755 --- a/scripts/poe-tasks/check +++ b/scripts/poe-tasks/check @@ -14,6 +14,8 @@ function check_rv { aggregate_rv=$(( $aggregate_rv + $1 )) } +kres_is_meson_configured + # stop failing early, because we wouldn't do anything else than fail set +e diff --git a/scripts/poe-tasks/examples b/scripts/poe-tasks/examples index 8b0be2c42..b501ca572 100755 --- a/scripts/poe-tasks/examples +++ b/scripts/poe-tasks/examples @@ -4,6 +4,8 @@ src_dir="$(dirname "$(realpath "$0")")" source $src_dir/utils/_env.sh +kres_is_meson_configured + # validate all configuration examples for example in $PWD/etc/config/config.example.*.yaml; do diff --git a/scripts/poe-tasks/kresctl b/scripts/poe-tasks/kresctl index 50e028fc7..d5662fb82 100755 --- a/scripts/poe-tasks/kresctl +++ b/scripts/poe-tasks/kresctl @@ -4,5 +4,7 @@ src_dir="$(dirname "$(realpath "$0")")" source $src_dir/utils/_env.sh +kres_is_meson_configured + # run knot-resolver client python3 -m knot_resolver.client $@ diff --git a/scripts/poe-tasks/man b/scripts/poe-tasks/man index f6986d584..60f0ae6e7 100755 --- a/scripts/poe-tasks/man +++ b/scripts/poe-tasks/man @@ -4,6 +4,6 @@ src_dir="$(dirname "$(realpath "$0")")" source $src_dir/utils/_env.sh -build_knot_resolver_c +kres_meson_build man -l .install/share/man/man8/$1* diff --git a/scripts/poe-tasks/test b/scripts/poe-tasks/test index 85fd6089a..79c6e3a24 100755 --- a/scripts/poe-tasks/test +++ b/scripts/poe-tasks/test @@ -4,5 +4,7 @@ src_dir="$(dirname "$(realpath "$0")")" source $src_dir/utils/_env.sh +kres_is_meson_configured + # run pytest env PYTHONPATH=. pytest --junitxml=unit.junit.xml --cov=python/knot_resolver --show-capture=all tests/manager diff --git a/scripts/poe-tasks/utils/_env.sh b/scripts/poe-tasks/utils/_env.sh index b5e0f14f6..7b8fc4b37 100644 --- a/scripts/poe-tasks/utils/_env.sh +++ b/scripts/poe-tasks/utils/_env.sh @@ -73,18 +73,8 @@ function kres_meson_configure { echo } -function kres_meson_build { - if [ -d .build ]; then - echo - echo Building Knot Resolver C komponents - echo ----------------------------------- - echo -e "${blue}In case of an compilation error, run this command to try to fix it:${reset}" - echo -e "\t${blue}rm -r $install_dir $build_dir${reset}" - echo - ninja -C $build_dir - ninja install -C $build_dir - echo - else +function kres_is_meson_configured { + if [ ! -d .build ]; then echo echo Knot Resolver is not configured for building. echo "Please run './poe configure' (optionally with additional Meson arguments)". @@ -92,3 +82,18 @@ function kres_meson_build { exit 2 fi } + +function kres_meson_build { + + kres_is_meson_configured + + echo + echo Building Knot Resolver C komponents + echo ----------------------------------- + echo -e "${blue}In case of an compilation error, run this command to try to fix it:${reset}" + echo -e "\t${blue}rm -r $install_dir $build_dir${reset}" + echo + ninja -C $build_dir + ninja install -C $build_dir + echo +}