Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.11 KiB
default:
  image: python:3.8-slim

workflow:
  rules:
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_BRANCH == 'main'

stages:
  - Static Analysis
  - Install
  - Documentation
  - Test
  - Ship

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

.static_analysis_base:
  stage: Static Analysis
  allow_failure: true

flake8:
  extends: .static_analysis_base
  script:
    - pip install flake8
    - flake8 $PWD/dinamis_sdk

pylint:
  extends: .static_analysis_base
  script:
    - pip install pylint appdirs requests pystac pystac-client pydantic urllib3 qrcode
    - pylint $PWD/dinamis_sdk --disable=W0718,W0603,R0914,C0415 --ignore=examples

codespell:
  extends: .static_analysis_base
  script: 
    - pip install codespell
    - codespell dinamis_sdk docs README.md

pydocstyle:
  extends: .static_analysis_base
  script:
    - pip install pydocstyle
    - pydocstyle $PWD/dinamis_sdk

# ------------------------------- Install -------------------------------------

pip_install:
  stage: Install
  script:
    - pip install .

# --------------------------------- Doc ---------------------------------------

.doc_base:
  stage: Documentation
  before_script:
    - pip install -r doc/doc_requirements.txt
  artifacts:
    paths:
      - public
      - public_test

test:
  extends: .doc_base
  except:
    - main
  script:
    - mkdocs build --site-dir public_test
pages:
  extends: .doc_base
  only:
    - main
  script:
    - mkdocs build --site-dir public

# --------------------------------- Test --------------------------------------

Tests:
  stage: Test
  except:
    - main
  before_script:
    - pip install .
    - pip install pystac-client
  script:
    - python tests/test_spot-6-7-drs.py
    - python tests/test_super-s2.py

# --------------------------------- Ship --------------------------------------

pypi:
  stage: Ship
  only:
   - main
  before_script:
   - python3 -m pip install --upgrade build twine
  script:
   - python3 -m build
  after_script:
   - python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive --verbose -u __token__ -p $pypi_token dist/*