mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Separate Linting from main ci yml
This commit is contained in:
parent
c34c204d95
commit
087e28c1fc
@ -13,72 +13,6 @@ variables:
|
|||||||
DOCKER_HOST: tcp://docker:2376
|
DOCKER_HOST: tcp://docker:2376
|
||||||
DOCKER_TLS_CERTDIR: "/certs"
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
|
||||||
yamllint:
|
|
||||||
stage: lint
|
|
||||||
image: registry.gitlab.com/pipeline-components/yamllint:latest
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
||||||
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
|
||||||
when: never
|
|
||||||
script:
|
|
||||||
- yamllint .
|
|
||||||
|
|
||||||
jsonlint:
|
|
||||||
stage: lint
|
|
||||||
image: registry.gitlab.com/pipeline-components/jsonlint:latest
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
||||||
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
|
||||||
when: never
|
|
||||||
script:
|
|
||||||
- |
|
|
||||||
find . -not -path './.git/*' -name '*.json' -type f -print0 |
|
|
||||||
parallel --will-cite -k -0 -n1 jsonlint -q
|
|
||||||
|
|
||||||
black:
|
|
||||||
stage: lint
|
|
||||||
image: registry.gitlab.com/pipeline-components/black:latest
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
||||||
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
|
||||||
when: never
|
|
||||||
script:
|
|
||||||
- black --check --verbose -- .
|
|
||||||
|
|
||||||
pylint:
|
|
||||||
stage: lint
|
|
||||||
image: registry.gitlab.com/pipeline-components/pylint:latest
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
rules:
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
||||||
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
|
||||||
when: never
|
|
||||||
# before_script:
|
|
||||||
# - mkdir -p public/badges public/lint
|
|
||||||
# - echo undefined > public/badges/$CI_JOB_NAME.score
|
|
||||||
script:
|
|
||||||
# - pylint --exit-zero --output-format=text $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**") | tee /tmp/pylint.txt
|
|
||||||
# - sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/$CI_JOB_NAME.score
|
|
||||||
- pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**") > codeclimate.json
|
|
||||||
# after_script:
|
|
||||||
# - anybadge --overwrite --label $CI_JOB_NAME --value=$(cat public/badges/$CI_JOB_NAME.score) --file=public/badges/$CI_JOB_NAME.svg 4=red 6=orange 8=yellow 10=green
|
|
||||||
# - |
|
|
||||||
# echo "Your score is: $(cat public/badges/$CI_JOB_NAME.score)"
|
|
||||||
# Removed lint badge generation until public release
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
reports:
|
|
||||||
codequality: codeclimate.json
|
|
||||||
when: always
|
|
||||||
|
|
||||||
docker-build-dev:
|
docker-build-dev:
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
services:
|
services:
|
||||||
@ -295,6 +229,7 @@ gemnasium-python-dependency_scanning:
|
|||||||
- docker
|
- docker
|
||||||
|
|
||||||
include:
|
include:
|
||||||
|
- local: ./.gitlab/lint.yml
|
||||||
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
- template: Security/Secret-Detection.gitlab-ci.yml
|
- template: Security/Secret-Detection.gitlab-ci.yml
|
||||||
|
68
.gitlab/lint.yml
Normal file
68
.gitlab/lint.yml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# YAML Linting
|
||||||
|
yamllint:
|
||||||
|
stage: lint
|
||||||
|
image: registry.gitlab.com/pipeline-components/yamllint:latest
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
||||||
|
when: never
|
||||||
|
script:
|
||||||
|
- yamllint .
|
||||||
|
|
||||||
|
# JSON Linting
|
||||||
|
jsonlint:
|
||||||
|
stage: lint
|
||||||
|
image: registry.gitlab.com/pipeline-components/jsonlint:latest
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
||||||
|
when: never
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
find . -not -path './.git/*' -name '*.json' -type f -print0 |
|
||||||
|
parallel --will-cite -k -0 -n1 jsonlint -q
|
||||||
|
|
||||||
|
# Code Format Checking
|
||||||
|
black:
|
||||||
|
stage: lint
|
||||||
|
image: registry.gitlab.com/pipeline-components/black:latest
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
||||||
|
when: never
|
||||||
|
script:
|
||||||
|
- black --check --verbose -- .
|
||||||
|
|
||||||
|
# Code Climate/Quality Checking
|
||||||
|
pylint:
|
||||||
|
stage: lint
|
||||||
|
image: registry.gitlab.com/pipeline-components/pylint:latest
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
rules:
|
||||||
|
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||||
|
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
||||||
|
when: never
|
||||||
|
before_script:
|
||||||
|
- mkdir -p public/badges public/lint
|
||||||
|
- echo undefined > public/badges/$CI_JOB_NAME.score
|
||||||
|
script:
|
||||||
|
- pylint --exit-zero --output-format=text $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**") | tee /tmp/pylint.txt
|
||||||
|
- sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/$CI_JOB_NAME.score
|
||||||
|
- pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $(find -type f -name "*.py" ! -path "**/.venv/**" ! -path "**/app/migrations/**") > codeclimate.json
|
||||||
|
after_script:
|
||||||
|
- anybadge --overwrite --label $CI_JOB_NAME --value=$(cat public/badges/$CI_JOB_NAME.score) --file=public/badges/$CI_JOB_NAME.svg 4=red 6=orange 8=yellow 10=green
|
||||||
|
- |
|
||||||
|
echo "Your score is: $(cat public/badges/$CI_JOB_NAME.score)"
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
reports:
|
||||||
|
codequality: codeclimate.json
|
||||||
|
when: always
|
Loading…
Reference in New Issue
Block a user