.gitlab-ci.yml 2.65 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
Daniel Scheffler's avatar
Daniel Scheffler committed
15
  - deploy_pages
Daniel Scheffler's avatar
Daniel Scheffler committed
16
  - deploy_to_pypi
17
18
19
  - cleanup


20
test_arosics:
21
  stage: test
22
23
24
25
  script:
    - source /root/anaconda3/bin/activate
    - export GDAL_DATA=/root/anaconda3/share/gdal
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
26
    - pip install rednose # remove as soon as it is included in test runner
27
    - make nosetests
28
29
30
31
32
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
33
34
    - nosetests.html
    - nosetests.xml
35
    when: always
36

37

38
39
40
41
test_arosics_install:
  stage: test
  script:
    - source /root/anaconda3/bin/activate
42
    - export GDAL_DATA=/root/anaconda3/share/gdal
43
44
    - conda create -y -q --name arosics python=3.5
    - source activate arosics
Daniel Scheffler's avatar
Daniel Scheffler committed
45
46
     # resolve some requirements with conda
    - conda install --yes -q -c conda-forge numpy gdal scikit-image matplotlib pyproj rasterio shapely
47
48
49
50
51
52
53
54
    - python setup.py install
    - cd ..
    - pwd
    - ls
    - python -c "import arosics; print(arosics)"
    - python -c "from arosics import COREG, COREG_LOCAL"


55
pages:
Daniel Scheffler's avatar
Daniel Scheffler committed
56
  stage: deploy_pages
57
58
59
60
61
  dependencies:
    - test_arosics
  script:
    - mkdir -p public/coverage
    - cp -r htmlcov/* public/coverage/
62
63
    - mkdir -p public/nosetests_reports
    - cp nosetests.* public/nosetests_reports/
64
65
66
67
68
69
70
71
72
    - mkdir -p public/doc
    - cp -r docs/_build/html/* public/doc/

  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
73

Daniel Scheffler's avatar
Daniel Scheffler committed
74

Daniel Scheffler's avatar
Daniel Scheffler committed
75
deploy_pypi:
Daniel Scheffler's avatar
Daniel Scheffler committed
76
  stage: deploy_to_pypi
Daniel Scheffler's avatar
Daniel Scheffler committed
77
78
  dependencies:
    - test_arosics
79
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
Daniel Scheffler's avatar
Daniel Scheffler committed
80
    - source /root/anaconda3/bin/activate
81
82
    - mkdir -p public/images/
    - cp -r docs/images/* public/images/
Daniel Scheffler's avatar
Daniel Scheffler committed
83
84
85
86
    - 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
87
    - python setup.py check sdist upload -r pypi  # This will fail if your creds are bad.
88
89
90
91
92
93
94
95
96
97
98
99
    - 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.