.gitlab-ci.yml 2.93 KB
Newer Older
André Hollstein's avatar
André Hollstein committed
1
before_script:
André Hollstein's avatar
André Hollstein committed
2
  - git lfs pull
André Hollstein's avatar
André Hollstein committed
3

Daniel Scheffler's avatar
Daniel Scheffler committed
4
5
6
7
8
9

stages:
    - test
    - deploy


André Hollstein's avatar
André Hollstein committed
10
test_enpt:
Daniel Scheffler's avatar
Daniel Scheffler committed
11
  stage: test
André Hollstein's avatar
André Hollstein committed
12
  script:
Daniel Scheffler's avatar
Daniel Scheffler committed
13
    - source /root/miniconda3/bin/activate enpt
Daniel Scheffler's avatar
Daniel Scheffler committed
14
    - export GDAL_DATA=/root/miniconda3/envs/enpt/share/gdal
André Hollstein's avatar
André Hollstein committed
15
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- here are the sicor tables
16
17
18
19
20
21
22
23
24
25

    # 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
26
    # run nosetests
27
    - make nosetests  # test are called here
Daniel Scheffler's avatar
Daniel Scheffler committed
28
    # create the docs
André Hollstein's avatar
André Hollstein committed
29
30
31
32
33
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
34
35
    - nosetests.html
    - nosetests.xml
André Hollstein's avatar
André Hollstein committed
36
    - tests/linting
Daniel Scheffler's avatar
Daniel Scheffler committed
37
38
39
40
41
42
  when: always


test_styles:
  stage: test
  script:
Daniel Scheffler's avatar
Daniel Scheffler committed
43
    - source /root/miniconda3/bin/activate enpt
Daniel Scheffler's avatar
Daniel Scheffler committed
44
    - export GDAL_DATA=/root/miniconda3/envs/enpt/share/gdal
Daniel Scheffler's avatar
Daniel Scheffler committed
45
46
47
48
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
    - make lint
  artifacts:
    paths:
49
    - tests/data/test_outputs/*.log
Daniel Scheffler's avatar
Daniel Scheffler committed
50
51
52
53
    - tests/linting/flake8.log
    - tests/linting/pycodestyle.log
    - tests/linting/pydocstyle.log
    when: always
André Hollstein's avatar
André Hollstein committed
54
55


André Hollstein's avatar
André Hollstein committed
56
test_enpt_install:
Daniel Scheffler's avatar
Daniel Scheffler committed
57
  stage: test
André Hollstein's avatar
André Hollstein committed
58
  script:
59
    - source /root/miniconda3/bin/activate
Daniel Scheffler's avatar
Daniel Scheffler committed
60
61
    - conda create -y -q --name enpt_test python=3
    - source activate enpt_test
62

63
    # install some dependencies that cause trouble when installed via pip
64
    - conda install -y -c conda-forge scipy  # scikit-image, matplotlib
65

66
67
68
    # install not pip-installable deps of geoarray
    - conda install -y -c conda-forge numpy scikit-image matplotlib pandas gdal rasterio pyproj basemap shapely
    - conda install -y -c conda-forge 'icu=58.*' lxml  # fixes bug for conda-forge gdal build
69
70
71
72
73
74
75
76
77

    # install sicor
    - conda install -y -q -c conda-forge pygrib h5py pytables pyfftw numba llvmlite
    - rm -rf context/sicor
    - git clone https://gitext.gfz-potsdam.de/EnMAP/sicor.git ./context/sicor
    - cd ./context/sicor
    - make install
    - cd ../../

78
    # install enpt
André Hollstein's avatar
André Hollstein committed
79
80
81
82
    - make install
    - cd ..
    - pwd
    - ls
83

Daniel Scheffler's avatar
Daniel Scheffler committed
84
    # test importability
André Hollstein's avatar
André Hollstein committed
85
    - python -c "import enpt; print(enpt)"
Daniel Scheffler's avatar
Bugfix    
Daniel Scheffler committed
86
    - python -c "from enpt.model.images import EnMAPL1Product_SensorGeo"
André Hollstein's avatar
André Hollstein committed
87
88


André Hollstein's avatar
André Hollstein committed
89
90
91
92
93
pages:
  stage: deploy
  dependencies:
    - test_enpt
  script:
Daniel Scheffler's avatar
Daniel Scheffler committed
94
95
96
97
    # Create the public directory
    - rm -rf public
    - mkdir public
    - mkdir -p public/doc
André Hollstein's avatar
André Hollstein committed
98
    - mkdir -p public/coverage
99
    - mkdir -p public/nosetests_reports
Daniel Scheffler's avatar
Daniel Scheffler committed
100
    # Copy over the docs
André Hollstein's avatar
André Hollstein committed
101
    - cp -r docs/_build/html/* public/doc/
Daniel Scheffler's avatar
Daniel Scheffler committed
102
103
104
105
106
107
108
109
110
    # Copy over the coverage reports
    - cp -r htmlcov/* public/coverage/
    # Copy over the nosetests reports
    - cp nosetests.* public/nosetests_reports/
    # Check if everything is working great
    - ls -al public
    - ls -al public/doc
    - ls -al public/coverage
    - ls -al public/nosetests_reports
André Hollstein's avatar
André Hollstein committed
111
112
113
  artifacts:
    paths:
      - public
114
    expire_in: 30 days
115
116
  only:
    - master