| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # ensure consistent behaviour |
| 4 | src_dir="$(dirname "$(realpath "$0")")" |
| 5 | source $src_dir/utils/_env.sh |
| 6 | |
| 7 | # stop failing early, because we wouldn't do anything else than fail |
| 8 | set +e |
| 9 | |
| 10 | # check that all dependencies are installed correctly |
| 11 | echo -e "${yellow}Checking that all dependencies are properly installed...${reset}" |
| 12 | poetry install --dry-run --only main,dev,lint | grep "0 install" > /dev/null |
| 13 | check_rv $? |
| 14 | echo |
| 15 | |
| 16 | # early exit when dependencies are not installed |
| 17 | if test "$aggregated_rv" -ne "0"; then |
| 18 | echo -e "${red}Dependencies are not properly installed. Run this command to fix it:${reset}" |
| 19 | echo -e " ${red}poetry install${reset}" |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
| 23 | # check that setup.py is not behind pyproject.toml |
| 24 | echo -e "${yellow}Checking setup.py${reset}" |
| 25 | python scripts/poe-tasks/utils/create_setup.py | diff - setup.py |
| 26 | check_rv $? |
| 27 | python setup.py --help > /dev/null |
| 28 | check_rv $? |
| 29 | echo |
| 30 | |
| 31 | # check python/knot_resolver/constants.py |
| 32 | echo -e "${yellow}python/knot_resolver/constants.py${reset}" |
| 33 | meson_setup_configure > /dev/null |
| 34 | diff python/knot_resolver/constants.py $build_dir/python/knot_resolver/constants.py |
| 35 | check_rv $? |
| 36 | echo |
| 37 | |
| 38 | # check that doc/_static/config.schema.json is the latest |
| 39 | echo -e "${yellow}Checking doc/_static/config.schema.json${reset}" |
| 40 | python -m knot_resolver.client schema | diff - doc/_static/config.schema.json |
| 41 | check_rv $? |
| 42 | echo |
| 43 | |
| 44 | # fancy messages at the end :) |
| 45 | fancy_message |
| 46 | |
| 47 | # exit with the aggregate return value |
| 48 | exit $aggregated_rv |