Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release 2.0.0

See merge request nicolasnn/pyotb!108
  • Loading branch information
remicres committed Nov 23, 2023
2 parents 10b65c3 + e819878 commit b2f06f8
Show file tree
Hide file tree
Showing 37 changed files with 4,036 additions and 2,073 deletions.
169 changes: 93 additions & 76 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,134 +1,151 @@
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_REF_NAME =~ /master/

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
- Documentation test
- Tests
- Documentation
- Ship

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

.static_analysis:
stage: Static Analysis
allow_failure: true

codespell:
extends: .static_analysis
before_script:
- pip install codespell
script:
- codespell {pyotb,tests}

flake8:
extends: .static_analysis
before_script:
- pip install flake8
script:
- flake8 --max-line-length=120 $PWD/pyotb --ignore=F403,E402,F401,W503,W504
rules:
- changes:
- pyotb/*.py

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

pylint:
extends: .static_analysis
before_script:
- pip install pylint
script:
- pylint --max-line-length=120 $PWD/pyotb --disable=too-many-nested-blocks,too-many-locals,too-many-statements,too-few-public-methods,too-many-instance-attributes,too-many-arguments,invalid-name,fixme,too-many-return-statements,too-many-lines,too-many-branches,import-outside-toplevel,wrong-import-position,wrong-import-order,import-error,missing-class-docstring

# ---------------------------------- Documentation ----------------------------------
- pylint $PWD/pyotb --disable=fixme

.docs:
codespell:
extends: .static_analysis
rules:
- changes:
- "**/*.py"
- "**/*.md"
before_script:
- apt-get update && apt-get -y install virtualenv
- virtualenv doc_env
- source doc_env/bin/activate
- pip install -U pip
- pip install -U -r doc/doc_requirements.txt

pages_test:
stage: Documentation test
extends: .docs
except:
- master
when: manual
- pip install codespell
script:
- mkdocs build --site-dir public_test
artifacts:
paths:
- public_test
- codespell {pyotb,tests,doc,README.md}

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

.tests:
stage: Tests
allow_failure: false
rules:
- changes:
- "**/*.py"
- .gitlab-ci.yml
variables:
OTB_ROOT: /opt/otb
LD_LIBRARY_PATH: /opt/otb/lib
SPOT_IMG_URL: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Input/SP67_FR_subset_1.tif
PLEIADES_IMG_URL: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Baseline/OTB/Images/prTvOrthoRectification_pleiades-1_noDEM.tif
before_script:
- pip install pytest pytest-cov

module_core:
extends: .tests
variables:
OTB_LOGGER_LEVEL: INFO
PYOTB_LOGGER_LEVEL: DEBUG
IMAGE_URL: https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/raw/develop/Data/Input/SP67_FR_subset_1.tif?inline=false
TEST_INPUT_IMAGE: tests/image.tif
artifacts:
reports:
junit: test-*.xml
before_script:
- wget $IMAGE_URL -O $TEST_INPUT_IMAGE
- pip install pytest

test_core:
extends: .tests
script:
- python3 -m pytest --color=yes --junitxml=test-core.xml tests/test_core.py

test_numpy:
extends: .tests
junit: test-module-core.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
coverage: '/TOTAL.*\s+(\d+%)$/'
script:
- python3 -m pytest --color=yes --junitxml=test-numpy.xml tests/test_numpy.py
- curl -fsLI $SPOT_IMG_URL
- curl -fsLI $PLEIADES_IMG_URL
- python3 -m pytest -vv --junitxml=test-module-core.xml --cov-report xml:coverage.xml tests/test_core.py

test_pipeline:
#when: manual
extends: .tests
script:
- python3 -m pytest --color=yes --junitxml=test-pipeline.xml tests/test_pipeline.py

test_serialization:
pipeline_permutations:
extends: .tests
variables:
OTB_LOGGER_LEVEL: WARNING
PYOTB_LOGGER_LEVEL: INFO
artifacts:
reports:
junit: test-pipeline-permutations.xml
script:
- python3 -m pytest --color=yes --junitxml=test-serialization.xml tests/test_serialization.py
- curl -fsLI $SPOT_IMG_URL
- python3 -m pytest -vv --junitxml=test-pipeline-permutations.xml tests/test_pipeline.py

# -------------------------------------- Ship ---------------------------------------
# -------------------------------------- Docs ---------------------------------------

pages:
stage: Ship
extends: .docs
only:
- master
docs:
stage: Documentation
rules:
- changes:
- "*.txt"
- "*.md"
- mkdocs.yml
- doc/*
- pyotb/*.py
before_script:
- apt update && apt install -y python3.8-venv
- python3 -m venv docs_venv
- source docs_venv/bin/activate
- python3 -m pip install -U pip
- python3 -m pip install -r doc/doc_requirements.txt
script:
- mkdocs build --site-dir public
artifacts:
paths:
- public

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

pypi:
stage: Ship
# when: manual
only:
- master
- tags
before_script:
- apt update && apt install -y python3.8-venv
- python3 -m pip install --upgrade build twine
- apt update && apt install -y python3.8-venv
- pip install build twine
script:
- python3 -m build
- python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ --non-interactive -u __token__ -p $pypi_token dist/*
- python3 -m build
- python3 -m twine upload --non-interactive -u __token__ -p $pypi_token dist/*
10 changes: 10 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Project authors

## Initial codebase

* Nicolas NARÇON (INRAE, now ESA)

## Current maintainers

* Rémi CRESSON (INRAE)
* Vincent DELBAR (La TeleScop)
Loading

0 comments on commit b2f06f8

Please sign in to comment.