.gitlab-ci.yml 3.75 KB
Newer Older
Daniel Scheffler's avatar
Daniel Scheffler committed
1
before_script:
Daniel Scheffler's avatar
Daniel Scheffler committed
2
  - git lfs pull
Daniel Scheffler's avatar
Daniel Scheffler committed
3

4

5
6
7
8
9
10
11
# Advise GitLab that these environment vars should be loaded from the Variables config.
variables:
    GMS_DB_HOST: SECURE
    GMS_INDEX_HOST: SECURE
    GMS_INDEX_PORT: SECURE


12
13
14
15
16
stages:
    - test
    - deploy


17
test_gms_preprocessing:
18
  stage: test
Daniel Scheffler's avatar
Daniel Scheffler committed
19
  script:
20
    - source /root/miniconda3/bin/activate ci_env
21
22
23
    - export GMS_db_host=${GMS_DB_HOST}
    - export GMS_index_host=${GMS_INDEX_HOST}
    - export GMS_index_port=${GMS_INDEX_PORT}
24

25
26
27
28
29
30
31
32
    # update sicor
    # - conda install -y -q -c conda-forge basemap
    # - rm -rf context/sicor
    # - git clone https://gitext.gfz-potsdam.de/EnMAP/sicor.git ./context/sicor
    # - cd ./context/sicor
    # - make download-tables
    # - python setup.py install
    # - cd ../../
Daniel Scheffler's avatar
Daniel Scheffler committed
33
    # make tests
34
    - pip install -U sicor
35
    # - python -c 'from sicor.tables import get_tables; get_tables(sensor="s2"); get_tables(sensor="l8"); get_tables(sensor="enmap", optional_downloads=("ch4",))'
36

37
    - pip install 'scipy==1.1.0'  # TODO remove as soon as pinning is included in SICOR requirements or SICOR issue #63 is fixed
38
    - pip install "geoarray>=0.8.33"  # TODO remove as soon as docker container is rebuilt
39

40
    # run tests
41
    - make nosetests
Daniel Scheffler's avatar
Daniel Scheffler committed
42
43
44
45
46
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
47
48
    - nosetests.html
    - nosetests.xml
49
    when: always
Daniel Scheffler's avatar
Daniel Scheffler committed
50

51

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
test_gms_preprocessing_install:
  stage: test
  script:
    - source /root/miniconda3/bin/activate
    - conda update conda
    - conda create -y -q -c conda-forge --name gms_test python=3
    - source activate gms_test

    # update conda and python
    - conda update -n base -c conda-forge conda
#    - conda update -c conda-forge python

    # avoid package incompatibilities
    # - conda config --set channel_priority strict  # otherwise gdal or libgdal may be installed from defaults channel

    # install some dependencies that cause trouble when installed via pip
    - conda install -y -c conda-forge numpy gdal scikit-image pyproj lxml geopandas ipython matplotlib basemap scikit-learn=0.23.2 shapely pyhdf python-fmask holoviews

    # install not pip-installable deps of arosics
    - conda install -y -c conda-forge pyfftw pykrige

    # install not pip-installable deps of sicor
    - conda install -y -q -c conda-forge glymur pygrib cachetools pyhdf h5py pytables llvmlite numba
    - pip install ecmwf-api-client  # FIXME remove as long as this is no more needed for the hyperspectral part of SICOR

    # install gms_preprocessing
    - pip install -e .
    - cd ..
    - pwd
    - ls

    # test importability
    - python -c "import gms_preprocessing; print(gms_preprocessing)"
    - python -c "from gms_preprocessing import ProcessController; print(ProcessController)"
  only:
    - master
    - dev


91
92
93
test_styles:
  stage: test
  script:
94
    - source /root/miniconda3/bin/activate ci_env
95
96
97
98
99
100
101
102
103
    - make lint
  artifacts:
    paths:
    - tests/linting/flake8.log
    - tests/linting/pycodestyle.log
    - tests/linting/pydocstyle.log
    when: always


104
pages:  # this job must be called 'pages' to advise GitLab to upload content to GitLab Pages
Daniel Scheffler's avatar
Daniel Scheffler committed
105
106
  stage: deploy
  dependencies:
107
    - test_gms_preprocessing
Daniel Scheffler's avatar
Daniel Scheffler committed
108
  script:
109
110
111
112
    # Create the public directory
    - rm -rf public
    - mkdir public
    - mkdir -p public/doc
Daniel Scheffler's avatar
Daniel Scheffler committed
113
    - mkdir -p public/coverage
Daniel Scheffler's avatar
Daniel Scheffler committed
114
    - mkdir -p public/nosetests_reports
115

116
    # Copy over the docs
Daniel Scheffler's avatar
Daniel Scheffler committed
117
    - cp -r docs/_build/html/* public/doc/
118

119
120
    # Copy over the coverage reports
    - cp -r htmlcov/* public/coverage/
121

122
123
    # Copy over the nosetests reports
    - cp nosetests.* public/nosetests_reports/
124

125
126
127
128
129
    # Check if everything is working great
    - ls -al public
    - ls -al public/doc
    - ls -al public/coverage
    - ls -al public/nosetests_reports
Daniel Scheffler's avatar
Daniel Scheffler committed
130
131
132
  artifacts:
    paths:
      - public
133
    expire_in: 10 days
Daniel Scheffler's avatar
Daniel Scheffler committed
134
135
  only:
    - master