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:
|
wiki:
|
||||||
stage: first
|
stage: first
|
||||||
<<: *only-default
|
<<: *only-default
|
||||||
|
only:
|
||||||
|
changes:
|
||||||
|
- device/device-*
|
||||||
before_script:
|
before_script:
|
||||||
- apk -q add python3
|
- apk -q add python3
|
||||||
script:
|
script:
|
||||||
- .gitlab-ci/check_devices_in_wiki.py --booting
|
- .gitlab-ci/check_devices_in_wiki.py --booting
|
||||||
|
|
||||||
# static code analysis
|
# testcases linting
|
||||||
py-sh-static:
|
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
|
stage: first
|
||||||
<<: *only-default
|
<<: *only-default
|
||||||
before_script:
|
before_script:
|
||||||
- apk -q add py3-flake8 shellcheck
|
- apk -q add shellcheck
|
||||||
script:
|
script:
|
||||||
- .gitlab-ci/static_code_analysis.sh
|
- .gitlab-ci/shellcheck.sh
|
||||||
|
|
||||||
# aports checks (generic)
|
# aports checks (generic)
|
||||||
aports-static:
|
aports-static:
|
||||||
|
|
|
@ -21,32 +21,22 @@ sh_files="
|
||||||
./main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.sh
|
./main/postmarketos-mkinitfs-hook-debug-shell/20-debug-shell.sh
|
||||||
./main/postmarketos-update-kernel/update-kernel.sh
|
./main/postmarketos-update-kernel/update-kernel.sh
|
||||||
./main/mdss-fb-init-hack/mdss-fb-init-hack.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 . -name '*.trigger')
|
||||||
$(find . -path './main/devicepkg-dev/*.sh')
|
$(find . -path './main/devicepkg-dev/*.sh')
|
||||||
|
|
||||||
$(find . -path '.gitlab-ci/*.sh')
|
$(find . -path '.gitlab-ci/*.sh')
|
||||||
"
|
"
|
||||||
for file in ${sh_files}; do
|
for file in $sh_files; do
|
||||||
echo "Test with shellcheck: $file"
|
echo "Test with shellcheck: $file"
|
||||||
cd "$DIR/../$(dirname "$file")"
|
cd "$DIR/../$(dirname "$file")"
|
||||||
shellcheck -e SC1008 -x "$(basename "$file")"
|
shellcheck -e SC1008 -x "$(basename "$file")"
|
||||||
done
|
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