Verified Commit b22ef6db authored by Adrian DC's avatar Adrian DC
Browse files

ci(gitlab-ci): isolate 'codestyle' job to 'codestyle.yml' template

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent 1aa2f67d
Loading
Loading
Loading
Loading
+25
Changes for .gitlab-ci.d/codestyle.yml: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
spec:
  inputs:
    stage:
      default: test
      description: 'Defines the codestyle stage (Default: test)'
    image:
      default: undefined:latest
      description: 'Specify the codestyle image (Default: undefined:latest)'
---

codestyle:
  stage: $[[ inputs.stage ]]
  image: $[[ inputs.image ]]
  script:
    - |
      if ls ./docs/*.py >/dev/null 2>&1; then
        yapf -i ./docs/*.py ./src/*.py ./src/*/*.py ./setup.py
      else
        yapf -i ./src/*.py ./src/*/*.py ./setup.py
      fi
    - echo ' ' && git diff --name-status
    - |
      if [ -z "${CI_LOCAL:-}" ] || [ ! -z "${PRE_COMMIT}" ]; then
        git diff --quiet
      fi
+4 −12
Changes for .gitlab-ci.yml: 4 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@ include:
  - local: .gitlab-ci.d/registry.yml
    inputs:
      stage: registry
  - local: .gitlab-ci.d/codestyle.yml
    inputs:
      stage: prepare
      image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
  - local: .gitlab-ci.d/build.yml
    inputs:
      stage: build
@@ -205,23 +209,11 @@ registry:test-latest:
        - containers/test-linux/Dockerfile
        - requirements/tests.txt

# =============================================================================
# Stage: prepare

codestyle:
  stage: prepare
  image: registry.gitlab.com/radiandevcore/tools/gitlab-projects-settings/gitlab-projects-settings:codestyle
  needs:
    - job: registry:codestyle
      artifacts: false
      optional: true
  script:
    - yapf -i ./src/*.py ./src/*/*.py ./setup.py
    - echo ' ' && git diff --name-status
    - |
      if [ -z "${CI_LOCAL:-}" ] || [ ! -z "${PRE_COMMIT}" ]; then
        git diff --quiet
      fi
  rules:
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
      changes: