From bebb6b5dd3ae6cfc8b1544d3e7d285e1ee499e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Moreno?= <inigo.moreno@tecnalia.com> Date: Wed, 18 May 2022 10:54:39 +0200 Subject: [PATCH] Use auto-rules to determine python version --- ci-templates/auto-rules/no-default.yml | 19 +++++++++++++++++++ ci-templates/syntax-check.yml | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ci-templates/auto-rules/no-default.yml b/ci-templates/auto-rules/no-default.yml index 011021a..023c1da 100644 --- a/ci-templates/auto-rules/no-default.yml +++ b/ci-templates/auto-rules/no-default.yml @@ -38,6 +38,25 @@ industrial_ci_noetic: - if: $DEFAULT_DISTRO == "noetic" - if: $BUILD_NOETIC + +python3_syntax: + extends: .python_syntax_template + variables: + PYTHON_VERSION: python3 + rules: + - if: $DEFAULT_DISTRO == "noetic" + - if: $BUILD_NOETIC + +python2_syntax: + extends: .python_syntax_template + variables: + PYTHON_VERSION: python2 + rules: + - if: $DEFAULT_DISTRO == "kinetic" + - if: $BUILD_KINETIC + - if: $DEFAULT_DISTRO == "melodic" + - if: $BUILD_MELODIC + ddeploy: extends: .ddeploy rules: diff --git a/ci-templates/syntax-check.yml b/ci-templates/syntax-check.yml index ccf1df2..15dde79 100644 --- a/ci-templates/syntax-check.yml +++ b/ci-templates/syntax-check.yml @@ -5,7 +5,7 @@ clang_format: stage: .post before_script: - - apk add --update bash coreutils tar wget + - apk add --update git bash coreutils tar wget - git clone --quiet --depth 1 https://github.com/ros-industrial/industrial_ci.git .ci_config -b legacy - wget https://git.code.tecnalia.com/tecnalia_robotics-public/gitlab_templates/raw/master/clang-format -O .clang-format script: .ci_config/gitlab.sh @@ -19,11 +19,11 @@ clang_format: ## Simple check for basic Python syntax errors; this is much less thorough than ## other options like pylint, but much faster and less strict ########################################################## -python_syntax: +.python_syntax_template: before_script: - - apk add --update python2 + - apk add --update ${PYTHON_VERSION} stage: build - script: python -m compileall -q . + script: ${PYTHON_VERSION} -m compileall -q . when: always ########################################################## -- GitLab