.gitlab-ci.yml 4.2 KB
Newer Older
1
2
before_script:
  - git lfs pull
Daniel Scheffler's avatar
Daniel Scheffler committed
3
4
  - mkdir -p public/images/
  - cp -r docs/images/* public/images/
5

6
7
8
9
10
11
12

# Advise GitLab that these environment vars should be loaded from the Variables config.
variables:
    PYPI_USER: SECURE
    PYPI_PASSWORD: SECURE


Daniel Scheffler's avatar
Daniel Scheffler committed
13
stages:
14
  - test
15
  - deploy
16
17
18
  - cleanup


19
test_arosics:
20
  stage: test
21
  script:
22
    - source /root/miniconda3/bin/activate
23
24
    - source activate ci_env
    - export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
25
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
26
    - pip install "py_tools_ds>=0.14.12"  # FIXME remove as soon as docker runner has been updated
27
    - make nosetests
28
29
    # create the docs
    - pip install sphinx_rtd_theme  # Read-the-docs theme for SPHINX documentation
30
    - pip install sphinx-autodoc-typehints
31
32
33
34
35
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
36
37
    - nosetests.html
    - nosetests.xml
38
    when: always
39

40

41
42
43
test_styles:
  stage: test
  script:
44
    - source /root/miniconda3/bin/activate
45
46
    - source activate ci_env
    - export GDAL_DATA=/root/miniconda3/envs/ci_env/share/gdal
47
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
48
#    - pip install "pycodestyle>=2.0.0,!=2.4.0"  # TODO remove as soon as docker runner is recreated
49
50
51
52
53
54
55
56
57
    - make lint
  artifacts:
    paths:
    - tests/linting/flake8.log
    - tests/linting/pycodestyle.log
    - tests/linting/pydocstyle.log
    when: always


58
59
60
test_arosics_install:
  stage: test
  script:
61
    - source /root/miniconda3/bin/activate
62
63
    - conda create -y -q --name arosics_testinstall python=3
    - source activate arosics_testinstall
Daniel Scheffler's avatar
Daniel Scheffler committed
64
     # resolve some requirements with conda
65
    - conda install --yes -q -c conda-forge numpy gdal scikit-image matplotlib pyproj rasterio shapely geopandas pyresample>=1.11.0
66
    - conda install --yes -q -c conda-forge libgdal ncurses # Fix for libgdal installed from defaults channel causing libkea.so.1.4.7: cannot open shared object file: No such file or directory
67
    # run installer
68
    - python setup.py install
69
    # test if its importable
70
71
72
73
74
    - cd ..
    - pwd
    - ls
    - python -c "import arosics; print(arosics)"
    - python -c "from arosics import COREG, COREG_LOCAL"
75
76
  only:
    - master
77
78


79
pages:  # this job must be called 'pages' to advise GitLab to upload content to GitLab Pages
80
  stage: deploy
81
82
83
  dependencies:
    - test_arosics
  script:
84
    # Create the public directory
85
86
87
    - rm -rf public
    - mkdir public
    - mkdir -p public/doc
88
    - mkdir -p public/images/
89
    - mkdir -p public/coverage
90
    - mkdir -p public/nosetests_reports
91
    # Copy over the docs
92
    - cp -r docs/_build/html/* public/doc/
93
    - cp -r docs/images/* public/images/
94
95
96
97
98
99
100
    # 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
101
102
    - ls -al public/coverage
    - ls -al public/nosetests_reports
103
104
105
106
107
108
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
109
    - enhancement/improve_docs
110

Daniel Scheffler's avatar
Daniel Scheffler committed
111

Daniel Scheffler's avatar
Daniel Scheffler committed
112
deploy_pypi:
113
  stage: deploy
Daniel Scheffler's avatar
Daniel Scheffler committed
114
115
  dependencies:
    - test_arosics
116
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
117
    - source /root/miniconda3/bin/activate
118
    - source activate ci_env
119
120
    - mkdir -p public/images/
    - cp -r docs/images/* public/images/
121
122
123
124
125
126
127
128
129
#    - printf "[distutils]\nindex-servers =\n    pypi\n\n" >> ~/.pypirc
#    - printf "[pypi]\n""repository:"" https://upload.pypi.org/legacy/\n" >> ~/.pypirc
#    - printf "username= ${PYPI_USER}\n" >> ~/.pypirc
#    - printf "password= ${PYPI_PASSWORD}\n" >> ~/.pypirc
#    - python setup.py check sdist upload -r pypi  # This will fail if your creds are bad.
#    - echo "" > ~/.pypirc && rm ~/.pypirc  # If the above fails, this won't run.
    - pip install -U twine
    - python setup.py sdist
    - twine upload dist/*
130
131
132
133
134
135
136
137
138
139
140
  only:
    - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
  except:
    - dev


cleanup_pypirc:
   stage: cleanup
   when: always   # this is important; run even if preceding stages failed.
   script:
    - rm -vf ~/.pypirc  # we don't want to leave these around, but GitLab may clean up anyway.