.gitlab-ci.yml 1.61 KB
Newer Older
1
2
3
before_script:
  - git lfs pull

4
5
6
7
8
9
10

# 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
11
stages:
12
  - test
Daniel Scheffler's avatar
Daniel Scheffler committed
13
14
  - deploy_pages
  - deploy_pypi
15
16
17
  - cleanup


18
test_arosics:
19
  stage: test
20
21
22
23
24
25
26
27
28
29
30
  script:
    - source /root/anaconda3/bin/activate
    - export GDAL_DATA=/root/anaconda3/share/gdal
    - export PYTHONPATH=$PYTHONPATH:/root  # /root <- directory needed later
    - make coverage
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/

31

32
pages:
Daniel Scheffler's avatar
Daniel Scheffler committed
33
  stage: deploy_pages
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  dependencies:
    - test_arosics
  script:
    - mkdir -p public/coverage
    - cp -r htmlcov/* public/coverage/
    - mkdir -p public/doc
    - cp -r docs/_build/html/* public/doc/

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

Daniel Scheffler's avatar
Daniel Scheffler committed
49

Daniel Scheffler's avatar
Daniel Scheffler committed
50
deploy_pypi:
Daniel Scheffler's avatar
Daniel Scheffler committed
51
  stage: deploy_pypi
Daniel Scheffler's avatar
Daniel Scheffler committed
52
53
  dependencies:
    - test_arosics
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
    - echo "[server-login]" >> ~/.pypirc
    - echo "username=" ${PYPI_USER} >> ~/.pypirc
    - echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc
    - python setup.py check sdist bdist upload   # This will fail if your creds are bad.
    - 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.