mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Implement target in Makefile to run github CI-like checks locally (#1753)
* Makefile: implement tests target with subtargets to run github CI-like tests locally (in docker container) * Dockerfile: update comment for PIP packages
This commit is contained in:
47
Makefile
47
Makefile
@@ -70,6 +70,7 @@ list:
|
||||
@echo " * docker-clean - delete created docker container (but not pre-downloaded data for it)"
|
||||
@echo " * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
|
||||
@echo " * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
|
||||
@echo " * tests - run set of checks, linters & tests (equivalent of github CI IronOS project settings for push trigger)"
|
||||
@echo " * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image"
|
||||
@echo " * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image"
|
||||
@echo ""
|
||||
@@ -81,7 +82,7 @@ list:
|
||||
@echo " $$ make firmware-LANG_ID model=MODEL_ID"
|
||||
@echo
|
||||
@echo "Full list of current supported IDs:"
|
||||
@echo " * LANG_ID: BE BG CS DA DE EL EN ES FI FR HR HU IT JA_JP LT NB NL_BE NL PL PT RO RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW"
|
||||
@echo " * LANG_ID: $(shell echo "`ls Translations/ | grep -e "^translation_.*.json$$" | sed -e 's,^translation_,,g; s,\.json$$,,g; ' | tr '\n' ' '`")"
|
||||
@echo " * MODEL_ID: TS100 TS101 TS80 TS80P MHP30 Pinecil Pinecilv2 S60"
|
||||
@echo
|
||||
@echo "For example, to make a local build of IronOS firmware for TS100 with English language, just type:"
|
||||
@@ -89,9 +90,6 @@ list:
|
||||
@echo " $$ make firmware-EN model=TS100"
|
||||
@echo
|
||||
|
||||
# bash one-liner to generate langs for "make list":
|
||||
# echo "`ls Translations/ | grep -e "^translation_.*.json$" | sed -e 's,^translation_,,g; s,\.json$,,g; ' | tr '\n' ' '`"
|
||||
|
||||
# detect availability of docker
|
||||
docker-check:
|
||||
ifeq ($(DOCKER_BIN),)
|
||||
@@ -121,6 +119,44 @@ docs: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/im
|
||||
docs-deploy: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/images/*
|
||||
$(MKDOCS) gh-deploy -f $(MKDOCS_YML) -d ../site
|
||||
|
||||
# routine check for autogenerated Documentation/README.md
|
||||
test-md:
|
||||
@echo ""
|
||||
@echo "---- Checking REAMDE.md... ----"
|
||||
@echo ""
|
||||
@/bin/sh ./scripts/deploy.sh docs_readme
|
||||
|
||||
# shell style & linter check (github CI version of shellcheck is more recent than alpine one so the latter may not catch some policies)
|
||||
test-sh:
|
||||
@echo ""
|
||||
@echo "---- Checking shell scripts... ----"
|
||||
@echo ""
|
||||
@for f in `find ./scripts -type f -iname "*.sh" ! -name "flash_ts100_linux.sh"` ; do shellcheck "$${f}"; done;
|
||||
|
||||
# python-related tests & checks
|
||||
test-py:
|
||||
@echo ""
|
||||
@echo "---- Checking python code... ----"
|
||||
@echo ""
|
||||
flake8 Translations
|
||||
black --check Translations
|
||||
@make -C source/ Objects/host/brieflz/libbrieflz.so
|
||||
./Translations/brieflz_test.py
|
||||
./Translations/make_translation_test.py
|
||||
|
||||
# clang-format check for C/C++ code style
|
||||
test-ccpp:
|
||||
@echo ""
|
||||
@echo "---- Checking C/C++ code... ----"
|
||||
@echo ""
|
||||
make -C source/ clean check-style
|
||||
|
||||
# meta target for tests & checks based on .github/workflows/push
|
||||
tests: test-md test-sh test-py test-ccpp
|
||||
@echo ""
|
||||
@echo "All tests & checks have been completed successfully."
|
||||
@echo ""
|
||||
|
||||
# pass-through target for Makefile inside source/ dir
|
||||
%:
|
||||
make -C source/ $@
|
||||
@@ -135,5 +171,4 @@ clean-build:
|
||||
clean-full: clean-build docker-clean
|
||||
|
||||
# phony targets
|
||||
.PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy clean-build clean-full
|
||||
|
||||
.PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy test-md test-sh test-py test-ccpp tests clean-build clean-full
|
||||
|
||||
Reference in New Issue
Block a user