2022-06-10 14:46:21 +00:00
|
|
|
# yamllint disable rule:line-length
|
2022-06-10 13:57:56 +00:00
|
|
|
---
|
2022-06-10 13:48:00 +00:00
|
|
|
# YAML Linting [https://yamllint.readthedocs.io/en/latest/]
|
2022-06-10 13:45:48 +00:00
|
|
|
yamllint:
|
|
|
|
stage: lint
|
|
|
|
image: registry.gitlab.com/pipeline-components/yamllint:latest
|
|
|
|
tags:
|
2024-05-09 19:11:46 +00:00
|
|
|
- saas-linux-medium-amd64
|
2022-06-10 13:45:48 +00:00
|
|
|
rules:
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CODE_QUALITY_DISABLED"
|
2022-06-10 13:45:48 +00:00
|
|
|
when: never
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
|
2022-06-10 13:45:48 +00:00
|
|
|
script:
|
|
|
|
- yamllint .
|
|
|
|
|
2022-06-10 13:48:00 +00:00
|
|
|
# JSON Linting [https://github.com/zaach/jsonlint]
|
2022-06-10 13:45:48 +00:00
|
|
|
jsonlint:
|
|
|
|
stage: lint
|
|
|
|
image: registry.gitlab.com/pipeline-components/jsonlint:latest
|
|
|
|
tags:
|
2024-05-09 19:11:46 +00:00
|
|
|
- saas-linux-medium-amd64
|
2022-06-10 13:45:48 +00:00
|
|
|
rules:
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CODE_QUALITY_DISABLED"
|
2022-06-10 13:45:48 +00:00
|
|
|
when: never
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
|
2022-06-10 13:45:48 +00:00
|
|
|
script:
|
|
|
|
- |
|
|
|
|
find . -not -path './.git/*' -name '*.json' -type f -print0 |
|
|
|
|
parallel --will-cite -k -0 -n1 jsonlint -q
|
|
|
|
|
2022-06-10 13:48:00 +00:00
|
|
|
# Code Format Checking [https://black.readthedocs.io/en/stable/]
|
2022-06-10 13:45:48 +00:00
|
|
|
black:
|
|
|
|
stage: lint
|
|
|
|
image: registry.gitlab.com/pipeline-components/black:latest
|
|
|
|
tags:
|
2024-05-09 19:11:46 +00:00
|
|
|
- saas-linux-medium-amd64
|
2022-06-10 13:45:48 +00:00
|
|
|
rules:
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CODE_QUALITY_DISABLED"
|
2022-06-10 13:45:48 +00:00
|
|
|
when: never
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
|
2022-06-10 13:45:48 +00:00
|
|
|
script:
|
|
|
|
- black --check --verbose -- .
|
|
|
|
|
2022-06-10 13:48:00 +00:00
|
|
|
# Code Climate/Quality Checking [https://pylint.pycqa.org/en/latest/]
|
2022-06-10 13:45:48 +00:00
|
|
|
pylint:
|
|
|
|
stage: lint
|
2024-02-02 18:02:59 +00:00
|
|
|
image: registry.gitlab.com/pipeline-components/pylint:latest
|
2022-06-10 13:45:48 +00:00
|
|
|
tags:
|
2024-05-09 19:11:46 +00:00
|
|
|
- saas-linux-medium-amd64
|
2022-06-10 13:45:48 +00:00
|
|
|
rules:
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CODE_QUALITY_DISABLED"
|
2022-06-10 13:45:48 +00:00
|
|
|
when: never
|
2022-06-10 13:48:00 +00:00
|
|
|
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
|
2024-02-02 19:23:34 +00:00
|
|
|
before_script:
|
|
|
|
- apk update
|
|
|
|
- apk add gcc python3-dev linux-headers build-base
|
2024-02-02 19:11:18 +00:00
|
|
|
- pip3 install --no-cache-dir -r requirements.txt
|
2024-02-02 19:23:34 +00:00
|
|
|
script:
|
2022-09-19 22:31:01 +00:00
|
|
|
- pylint --exit-zero --load-plugins=pylint_gitlab --output-format=gitlab-codeclimate:codeclimate.json $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**")
|
2022-06-10 13:45:48 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
codequality: codeclimate.json
|
|
|
|
when: always
|
2023-06-18 19:29:23 +00:00
|
|
|
|
|
|
|
# SonarQube/SonarCloud - Code Climate & QA [https://www.sonarsource.com]
|
|
|
|
sonarcloud-check:
|
|
|
|
stage: lint
|
|
|
|
image:
|
2024-05-23 22:40:03 +00:00
|
|
|
name: sonarsource/sonar-scanner-cli:latest
|
2023-06-18 19:29:23 +00:00
|
|
|
entrypoint: [""]
|
|
|
|
tags:
|
2024-05-09 19:11:46 +00:00
|
|
|
- saas-linux-medium-amd64
|
2023-06-18 19:29:23 +00:00
|
|
|
rules:
|
2023-07-18 20:54:45 +00:00
|
|
|
- if: "$SONAR_TOKEN == null"
|
|
|
|
when: never
|
2023-06-18 19:29:23 +00:00
|
|
|
- if: "$CODE_QUALITY_DISABLED"
|
|
|
|
when: never
|
|
|
|
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
|
|
|
|
variables:
|
|
|
|
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
|
|
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
|
|
cache:
|
|
|
|
key: "${CI_JOB_NAME}"
|
|
|
|
paths:
|
|
|
|
- .sonar/cache
|
|
|
|
script:
|
|
|
|
- sonar-scanner
|
2023-10-17 19:04:37 +00:00
|
|
|
|
|
|
|
# Lang file checking
|
|
|
|
lang-check:
|
|
|
|
stage: lint
|
|
|
|
image: alpine:latest
|
|
|
|
tags:
|
2024-05-09 19:11:46 +00:00
|
|
|
- saas-linux-medium-amd64
|
2023-10-17 19:04:37 +00:00
|
|
|
rules:
|
|
|
|
- if: "$CODE_QUALITY_DISABLED"
|
|
|
|
when: never
|
|
|
|
- if: "$CI_COMMIT_TAG || $CI_COMMIT_BRANCH"
|
|
|
|
allow_failure: true
|
|
|
|
before_script:
|
2023-10-17 19:23:19 +00:00
|
|
|
- apk add --no-cache jq bash
|
2023-10-17 19:04:37 +00:00
|
|
|
script:
|
|
|
|
- chmod +x .gitlab/scripts/lang_sort.sh
|
|
|
|
- bash .gitlab/scripts/lang_sort.sh ./app/translations/
|
|
|
|
after_script:
|
2023-10-17 19:23:19 +00:00
|
|
|
- if [ -f .gitlab/scripts/lang_sort_log.txt ]; then cat .gitlab/scripts/lang_sort_log.txt; fi
|
2023-10-17 19:04:37 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- .gitlab/scripts/lang_sort_log.txt
|
|
|
|
expire_in: 1 week
|