CI: various improvements (!694)
* Only run the wiki test, if anything matching device/device-* was modified. * Split testcase linting (flake8) from shellcheck and only run flake8 if .gitlab-ci/* was modified. * Rename .gitlab-ci/static_code_analysis.sh to .gitlab-ci/shellcheck.sh and make it scan all pre/post install/upgrade/deinstall scripts. [ci:skip-vercheck]: other commits in this merge request have several intended version downgrades, such as 3 -> 1.0.0
This commit is contained in:
parent
5f53f6ac9c
commit
8b7c90d328
2 changed files with 29 additions and 24 deletions
|
@ -26,19 +26,34 @@ stages:
|
|||
wiki:
|
||||
stage: first
|
||||
<<: *only-default
|
||||
only:
|
||||
changes:
|
||||
- device/device-*
|
||||
before_script:
|
||||
- apk -q add python3
|
||||
script:
|
||||
- .gitlab-ci/check_devices_in_wiki.py --booting
|
||||
|
||||
# static code analysis
|
||||
py-sh-static:
|
||||
# testcases linting
|
||||
testcases-linting:
|
||||
stage: first
|
||||
<<: *only-default
|
||||
only:
|
||||
changes:
|
||||
- .gitlab-ci/*
|
||||
before_script:
|
||||
- apk -q add py3-flake8
|
||||
script:
|
||||
- flake8 --ignore E501,F401,E722,W504,W605
|
||||
|
||||
# shellcheck
|
||||
shellcheck:
|
||||
stage: first
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- apk -q add py3-flake8 shellcheck
|
||||
- apk -q add shellcheck
|
||||
script:
|
||||
- .gitlab-ci/static_code_analysis.sh
|
||||
- .gitlab-ci/shellcheck.sh
|
||||
|
||||
# aports checks (generic)
|
||||
aports-static:
|
||||
|
|
|
@ -21,32 +21,22 @@ sh_files="
|
|||
./main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.sh
|
||||
./main/postmarketos-update-kernel/update-kernel.sh
|
||||
./main/mdss-fb-init-hack/mdss-fb-init-hack.sh
|
||||
./main/postmarketos-ui-hildon/postmarketos-ui-hildon.post-install
|
||||
$(find . -path './main/postmarketos-ui-hildon/*.sh')
|
||||
|
||||
$(find . -path './main/postmarketos-ui-*/*.sh')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-install')
|
||||
$(find . -path './main/postmarketos-ui-*/*.post-install')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-upgrade')
|
||||
$(find . -path './main/postmarketos-ui-*/*.post-upgrade')
|
||||
$(find . -path './main/postmarketos-ui-*/*.pre-deinstall')
|
||||
$(find . -path './main/postmarketos-ui-*/*.post-deinstall')
|
||||
|
||||
$(find . -name '*.trigger')
|
||||
$(find . -path './main/devicepkg-dev/*.sh')
|
||||
|
||||
$(find . -path '.gitlab-ci/*.sh')
|
||||
"
|
||||
for file in ${sh_files}; do
|
||||
for file in $sh_files; do
|
||||
echo "Test with shellcheck: $file"
|
||||
cd "$DIR/../$(dirname "$file")"
|
||||
shellcheck -e SC1008 -x "$(basename "$file")"
|
||||
done
|
||||
|
||||
# Python: flake8
|
||||
# E501: max line length
|
||||
# F401: imported, but not used (false positive: add_pmbootstrap_to_import_path)
|
||||
# E722: do not use bare except
|
||||
cd "$DIR/.."
|
||||
|
||||
echo "Test with flake8: testcases"
|
||||
# shellcheck disable=SC2086
|
||||
flake8 --ignore E501,F401,E722,W504,W605 $(find . -path "./.gitlab-ci/testcases/*.py")
|
||||
|
||||
echo "Test with flake8: all other Python files"
|
||||
# shellcheck disable=SC2086
|
||||
flake8 --ignore E501,E722,W504,W605 $(find . -not -path './.gitlab-ci/testcases/*' -a -name '*.py')
|
||||
|
||||
# Done
|
||||
echo "Success!"
|
Loading…
Reference in a new issue