Check the presence of changelog for the latest stable release in History.md (#1999)
Some checks are pending
Docs / deploy-docs (push) Waiting to run
CI / build (MHP30) (push) Waiting to run
CI / build (Pinecil) (push) Waiting to run
CI / build (Pinecilv2) (push) Waiting to run
CI / build (S60) (push) Waiting to run
CI / build (S60P) (push) Waiting to run
CI / build (T55) (push) Waiting to run
CI / build (TS100) (push) Waiting to run
CI / build (TS101) (push) Waiting to run
CI / build (TS80) (push) Waiting to run
CI / build (TS80P) (push) Waiting to run
CI / build_multi-lang (Pinecil) (push) Waiting to run
CI / build_multi-lang (Pinecilv2) (push) Waiting to run
CI / upload_metadata (push) Blocked by required conditions
CI / tests (push) Waiting to run
CI / check_c-cpp (push) Waiting to run
CI / check_python (push) Waiting to run
CI / check_shell (push) Waiting to run
CI / check_docs (push) Waiting to run

* Documentation/History.md: update version format according to git tag for easiest automation

* Add test check for changelog of the latest stable version

* Add git config permissions routine to test docs via push.yml

* scripts/deploy.sh fixes

* making shellcheck happy due to false negative in deploy.sh

* push.yml: fetch tags for test docs

* push.yml: set fetch depth trying to get tags

* deploy.sh printf debugging

* deploy.sh: remove printf debugging

* push.yml: rename step from check_readme to check_docs to reflect its function
This commit is contained in:
Ivan Zorin
2024-11-21 12:16:02 +03:00
committed by GitHub
parent 0187f9f1bf
commit 26c50d7962
4 changed files with 100 additions and 54 deletions

View File

@@ -19,7 +19,9 @@ usage()
echo -e "\tbuild - compile builds of IronOS inside docker container for supported hardware"
echo -e "\tclean - delete created docker image for IronOS & its build cache objects\n"
echo "CMD (helper routines):"
echo -e "\tdocs - high level target to run docs_readme and docs_history (see below)\n"
echo -e "\tdocs_readme - generate & OVERWRITE(!) README.md inside Documentation/ based on nav section from mkdocs.yml if it changed\n"
echo -e "\tdocs_history - check if History.md has the changelog for the latest stable release\n"
echo -e "\tcheck_style_file SRC - run code style checks based on clang-format & custom parsers for source code file SRC\n"
echo -e "\tcheck_style_log - run clang-format using source/Makefile and generate gcc-compatible error log in source/check-style.log\n"
echo -e "STORAGE NOTICE: for \"shell\" and \"build\" commands extra files will be downloaded so make sure that you have ~5GB of free space.\n"
@@ -71,6 +73,23 @@ EOF
return "${ret}"
}
# Documentation/History.md automagical changelog routine
docs_history()
{
md="Documentation/History.md"
ver_md="$(sed -ne 's/^## //1p' "${md}" | head -1)"
echo "Latest changelog: ${ver_md}"
ver_git="$(git tag -l | sort | grep -e "^v" | grep -v "rc" | tail -1)"
echo "Latest release tag: ${ver_git}"
ret=0
if [ "${ver_md}" != "${ver_git}" ]; then
ret=1
echo "It seems there is no changelog information for ${ver_git} in ${md} yet."
echo "Please, update changelog information in ${md}."
fi;
return "${ret}"
}
# Helper function to check code style using clang-format & grep/sed custom parsers:
# - basic logic moved from source/Makefile : `check-style` target for better maintainance since a lot of sh script involved;
# - output goes in gcc-like error compatible format for IDEs/editors.
@@ -126,27 +145,42 @@ docker_file="-f ${root_dir}/${docker_conf}"
# (compose sub-command must be included, i.e. DOCKER_BIN="/usr/local/bin/docker compose" ./deploy.sh)
if [ -z "${DOCKER_BIN}" ]; then
docker_bin=""
docker_app=""
else
docker_bin="${DOCKER_BIN}"
docker_app="${DOCKER_BIN}"
fi;
# detect availability of docker
docker_compose="$(command -v docker-compose)"
if [ -n "${docker_compose}" ] && [ -z "${docker_bin}" ]; then
docker_bin="${docker_compose}"
if [ -n "${docker_compose}" ] && [ -z "${docker_app}" ]; then
docker_app="${docker_compose}"
fi;
docker_tool="$(command -v docker)"
if [ -n "${docker_tool}" ] && [ -z "${docker_bin}" ]; then
docker_bin="${docker_tool} compose"
if [ -n "${docker_tool}" ] && [ -z "${docker_app}" ]; then
docker_app="${docker_tool} compose"
fi;
# give function argument a name
cmd="${1}"
# meta target to verify markdown documents
if [ "docs" = "${cmd}" ]; then
docs_readme
readme="${?}"
docs_history
hist="${?}"
if [ "${readme}" -eq 0 ] && [ "${hist}" -eq 0 ]; then
ret=0
else
ret=1
fi;
exit ${ret}
fi;
# if only README.md for Documentation update is required then run it & exit
if [ "docs_readme" = "${cmd}" ]; then
@@ -154,6 +188,13 @@ if [ "docs_readme" = "${cmd}" ]; then
exit "${?}"
fi;
# if only History.md for Documentation update is required then run it & exit
if [ "docs_history" = "${cmd}" ]; then
docs_history
exit "${?}"
fi;
if [ "check_style_file" = "${cmd}" ]; then
check_style_file "${2}"
exit "${?}"
@@ -166,7 +207,7 @@ fi;
# if docker is not presented in any way show warning & exit
if [ -z "${docker_bin}" ]; then
if [ -z "${docker_app}" ]; then
echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again."
exit 1
fi;
@@ -194,6 +235,6 @@ if [ "${cmd}" = "shell" ]; then
echo -e "\t* type \"exit\" to end the session when done;"
fi;
echo -e "\t* type \"${0} clean\" to delete created container (but not cached data)"
echo -e "\n====>>>> ${docker_bin} ${docker_file} ${docker_cmd}\n"
eval "${docker_bin} ${docker_file} ${docker_cmd}"
echo -e "\n====>>>> ${docker_app} ${docker_file} ${docker_cmd}\n"
eval "${docker_app} ${docker_file} ${docker_cmd}"
exit "${?}"