--- /dev/null
+---
+
+variables:
+ UPDATE_ALL_PIP_MODULES: 'n'
+
+Linter:
+ stage: linter
+ extends: .setup-python-environment
+ image: python:3.11
+ rules:
+ - if: '$CI_COMMIT_TAG'
+ - if: $CI_COMMIT_BRANCH == "master"
+ - if: $CI_COMMIT_BRANCH == "main"
+ - if: $CI_COMMIT_BRANCH == "test"
+ - if: $CI_COMMIT_BRANCH =~ /test-.*/
+ - if: $CI_COMMIT_BRANCH =~ /build.*/
+ - if: $CI_COMMIT_BRANCH == "develop"
+ tags:
+ - docker
+ before_script:
+ - locale -a
+ - apt update
+ - apt dist-upgrade --yes
+ - apt install --yes --no-install-recommends sudo locales gettext
+ - >
+ if test -f /etc/locale.gen; then
+ echo "/etc/locale.gen:"
+ grep -P -v '^\s*(#.*)?$' /etc/locale.gen || true
+ echo "<-- EOF"
+ fi
+ - >
+ if grep 'en_US.UTF-8' /etc/locale.gen; then
+ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
+ else
+ echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
+ fi
+ - locale-gen
+ - locale -a
+ - pip install --upgrade pip
+ - >
+ if [[ -n "${UPDATE_ALL_PIP_MODULES}" && "${UPDATE_ALL_PIP_MODULES}" == "y" ]] ; then
+ echo ' '
+ echo "Updating all outdated PIP modules."
+ for module in $( pip list --outdated | awk '{if(NR>=3) print $1}' ); do
+ echo ' '
+ echo "Updating module '${module}' ..."
+ pip install --upgrade "${module}"
+ done
+ echo ' '
+ fi
+ script:
+ - apt install --yes shellcheck yamllint
+ - python --version
+ - pip install --upgrade --upgrade-strategy eager flake8 pylint
+ - >
+ YAML_FILE_PATHS=""
+ if [[ -f .gitlab-ci.yml ]]; then
+ YAML_FILE_PATHS=".gitlab-ci.yml"
+ fi
+ if [[ -d ".github" ]] ; then
+ if [[ -z "${YAML_FILE_PATHS}" ]] ; then
+ YAML_FILE_PATHS=".github"
+ else
+ YAML_FILE_PATHS+=" .github"
+ fi
+ fi
+ - >
+ if [[ -n "${YAML_FILE_PATHS}" ]] ; then
+ echo " "
+ echo "Linting YAML file paths ${YAML_FILE_PATHS} ..."
+ yamllint --config-file .yamllint.yaml --strict --format colored ${YAML_FILE_PATHS} || exit $?
+ echo "All YAML files ok."
+ fi
+
+# vim: et tabstop=2 expandtab shiftwidth=2 softtabstop=2 list