Skip to content
Snippets Groups Projects
Commit df025d18 authored by Iñigo Moreno i Caireta's avatar Iñigo Moreno i Caireta
Browse files

Make jobs python2 or python3 depending on distro

parent 470bc229
No related branches found
No related tags found
1 merge request!80Resolve "python_syntax is python2 only"
Pipeline #79861 failed
......@@ -38,6 +38,26 @@ industrial_ci_noetic:
- if: $DEFAULT_DISTRO == "noetic"
- if: $BUILD_NOETIC
.py3_template:
rules:
- if: $DEFAULT_DISTRO == "noetic"
when: always
- if: $BUILD_NOETIC
when: always
when: always
.py2_template:
rules:
- if: $DEFAULT_DISTRO == "kinetic"
when: always
- if: $BUILD_KINETIC
when: always
- if: $DEFAULT_DISTRO == "melodic"
when: always
- if: $BUILD_MELODIC
when: always
ddeploy:
extends: .ddeploy
rules:
......
......@@ -24,6 +24,7 @@ before_script:
include:
- ci-templates/syntax-check.yml
- ci-templates/python.yml
- ci-templates/industrial-ci-templates.yml
default:
......
.flake8_template:
stage: build
before_script: ${PYTHON_VERSION} -m pip -q install flake8
script: ${PYTHON_VERSION} -m flake8 --max-line-length 120 --statistics --show-source .
.flake8_extended_template:
stage: .post
before_script:
- ${PYTHON_VERSION} -m pip install flake8 flake8-isort flake8-builtins
# The following flake8 extensions only work on python3
- ${PYTHON_VERSION} -m pip install flake8-eradicate flake8-functions-names flake8-return flake8-functions || true
script: ${PYTHON_VERSION} -m flake8 --max-line-length 120 --statistics --show-source .
allow_failure: true
.security_template:
stage: .post
before_script:
- ${PYTHON_VERSION} -m pip install bandit safety
script:
- bandit -r . || RET=1
- safety check || RET=1
- exit $RET
when: always
allow_failure: true
.py3_template:
image: python:3-alpine
variables:
PYTHON_VERSION: python3
when: never
.py2_template:
image: python:2-alpine
variables:
PYTHON_VERSION: python2
when: always
py3-flake8:
extends:
- .flake8_template
- .py3_template
py2-flake8:
extends:
- .flake8_template
- .py2_template
py3-flake8_extended:
extends:
- .flake8_extended_template
- .py3_template
py2-flake8_extended:
extends:
- .flake8_extended_template
- .py2_template
py3-security:
extends:
- .security_template
- .py3_template
\ No newline at end of file
......@@ -15,45 +15,6 @@ clang_format:
CLANG_FORMAT_VERSION: "3.8"
when: always
##########################################################
## Several Python checks
##########################################################
flake8:
stage: .post
image: python:3-alpine
before_script:
- pip3 install flake8
script:
- flake8 --max-line-length 120 --statistics --show-source .
tags:
- docker
when: always
flake8_extended:
stage: .post
image: python:3-alpine
before_script:
- pip3 install flake8 flake8-isort flake8-builtins flake8-eradicate flake8-functions-names flake8-return flake8-functions
script:
- flake8 --max-line-length 120 --statistics --show-source .
tags:
- docker
when: always
allow_failure: true
python_security:
stage: .post
image: python:3-alpine
before_script:
- pip3 install bandit safety
script:
- bandit -r . || RET=1
- safety check || RET=1
- exit $RET
tags:
- docker
when: always
##########################################################
## Check for errors in bash/sh scripts
## Uses https://github.com/koalaman/shellcheck
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment