Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.54 KiB
default:
  image: $CI_REGISTRY/orfeotoolbox/otb-build-env/otb-ubuntu-native-develop-headless:20.04
  tags:
    - light
  interruptible: true

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
  key: $CI_COMMIT_REF_SLUG
  paths:
    - .cache/pip

workflow:
  rules:
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
      when: never
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_REF_PROTECTED == "true"

stages:
  - Static Analysis
  - Tests
  - Documentation
  - Ship

#  -------------------------------- Static analysis --------------------------------

.static_analysis:
  stage: Static Analysis
  allow_failure: true
  rules:
    - changes:
        - pyotb/*.py

pydocstyle:
  extends: .static_analysis
  before_script:
    - pip install pydocstyle tomli
  script:
    - pydocstyle $PWD/pyotb

pylint:
  extends: .static_analysis
  before_script:
    - pip install pylint
  script:
    - pylint $PWD/pyotb --disable=fixme

codespell:
  extends: .static_analysis
  rules:
    - changes:
        - "**/*.py"
        - "**/*.md"
  before_script:
    - pip install codespell
  script:
    - codespell {pyotb,tests,doc,README.md}

# -------------------------------------- Tests --------------------------------------
test_install:
  stage: Tests
  only:
    - tags
  allow_failure: false
  script:
    - pip install .