.gitlab-ci.yml 3.64 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 arosics
    - export GDAL_DATA=/root/miniconda3/envs/arosics/share/gdal
25
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
26
    - make nosetests
27
28
29
30
31
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
32
33
    - nosetests.html
    - nosetests.xml
34
    when: always
35

36

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


54
55
56
test_arosics_install:
  stage: test
  script:
57
    - source /root/miniconda3/bin/activate
58
59
    - conda create -y -q --name arosics_testinstall python=3
    - source activate arosics_testinstall
Daniel Scheffler's avatar
Daniel Scheffler committed
60
     # resolve some requirements with conda
61
    - conda install --yes -q -c conda-forge numpy gdal scikit-image matplotlib pyproj rasterio shapely geopandas
62
    # run installer
63
    - python setup.py install
64
    # test if its importable
65
66
67
68
69
    - cd ..
    - pwd
    - ls
    - python -c "import arosics; print(arosics)"
    - python -c "from arosics import COREG, COREG_LOCAL"
70
71
  only:
    - master
72
73


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

Daniel Scheffler's avatar
Daniel Scheffler committed
105

Daniel Scheffler's avatar
Daniel Scheffler committed
106
deploy_pypi:
107
  stage: deploy
Daniel Scheffler's avatar
Daniel Scheffler committed
108
109
  dependencies:
    - test_arosics
110
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
111
    - source /root/miniconda3/bin/activate
112
    - source activate arosics
113
114
    - mkdir -p public/images/
    - cp -r docs/images/* public/images/
Daniel Scheffler's avatar
Daniel Scheffler committed
115
116
117
118
    - 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
119
    - python setup.py check sdist upload -r pypi  # This will fail if your creds are bad.
120
121
122
123
124
125
126
127
128
129
130
131
    - 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.