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

4
5
6
7
8
9
10
11
12
13
14
15
16

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


stage:
  - test
  - deploy
  - cleanup


17
test_arosics:
18
  stage: test
19
20
21
22
23
24
25
26
27
28
29
  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/

30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
pages:
  stage: deploy
  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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67


 deploy_pypi:
  stage: deploy
  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.