.gitlab-ci.yml 3.16 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
22
23
24
  script:
    - source /root/anaconda3/bin/activate
    - export GDAL_DATA=/root/anaconda3/share/gdal
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
25
    - make nosetests
26
27
28
29
30
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
31
32
    - nosetests.html
    - nosetests.xml
33
    when: always
34

35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
test_styles:
  stage: test
  script:
    - source /root/anaconda3/bin/activate
    - export GDAL_DATA=/root/anaconda3/share/gdal
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
    - make lint
  artifacts:
    paths:
    - tests/linting/flake8.log
    - tests/linting/pycodestyle.log
    - tests/linting/pydocstyle.log
    when: always


51
52
53
54
test_arosics_install:
  stage: test
  script:
    - source /root/anaconda3/bin/activate
55
    - export GDAL_DATA=/root/anaconda3/share/gdal
56
57
    - conda create -y -q --name arosics python=3.5
    - source activate arosics
Daniel Scheffler's avatar
Daniel Scheffler committed
58
59
     # resolve some requirements with conda
    - conda install --yes -q -c conda-forge numpy gdal scikit-image matplotlib pyproj rasterio shapely
60
61
62
63
64
65
66
67
    - python setup.py install
    - cd ..
    - pwd
    - ls
    - python -c "import arosics; print(arosics)"
    - python -c "from arosics import COREG, COREG_LOCAL"


68
69
deploy_pages:
  stage: deploy
70
71
72
  dependencies:
    - test_arosics
  script:
73
74
75
76
      # Create the public directory
    - rm -rf public
    - mkdir public
    - mkdir -p public/doc
77
    - mkdir -p public/coverage
78
    - mkdir -p public/nosetests_reports
79
    # Copy over the docs
80
    - cp -r docs/_build/html/* public/doc/
81
82
83
84
85
86
87
    # 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
88
89
90
91
92
93
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
94

Daniel Scheffler's avatar
Daniel Scheffler committed
95

Daniel Scheffler's avatar
Daniel Scheffler committed
96
deploy_pypi:
97
  stage: deploy
Daniel Scheffler's avatar
Daniel Scheffler committed
98
99
  dependencies:
    - test_arosics
100
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
Daniel Scheffler's avatar
Daniel Scheffler committed
101
    - source /root/anaconda3/bin/activate
102
103
    - mkdir -p public/images/
    - cp -r docs/images/* public/images/
Daniel Scheffler's avatar
Daniel Scheffler committed
104
105
106
107
    - 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
108
    - python setup.py check sdist upload -r pypi  # This will fail if your creds are bad.
109
110
111
112
113
114
115
116
117
118
119
120
    - echo "" > ~/.pypirc && rm ~/.pypirc  # If the above fails, this won't run.
  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.