.gitlab-ci.yml 2.55 KB
Newer Older
Daniel Scheffler's avatar
Daniel Scheffler committed
1
2
3
before_script:
  - git lfs pull

4
5
6
7
8

# Advise GitLab that these environment vars should be loaded from the Variables config.
variables:
    PYPI_USER: SECURE
    PYPI_PASSWORD: SECURE
Daniel Scheffler's avatar
Fix.    
Daniel Scheffler committed
9
10
11
    ANACONDA_USER: SECURE
    ANACONDA_PASSWORD: SECURE

12
13
14
15


stages:
  - test
16
  - deploy
17
18
19
  - cleanup


Daniel Scheffler's avatar
Daniel Scheffler committed
20
test_py_tools_ds:
21
  stage: test
Daniel Scheffler's avatar
Daniel Scheffler committed
22
23
24
25
26
27
28
29
30
31
32
  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/

33

34
35
deploy_pages:
  stage: deploy
Daniel Scheffler's avatar
Daniel Scheffler committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  dependencies:
    - test_py_tools_ds
  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
50
51
52


deploy_pypi:
53
  stage: deploy
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  dependencies:
    - test_py_tools_ds
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
    - source /root/anaconda3/bin/activate
    - 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
    - python setup.py check sdist upload -r pypi  # 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


70
71
72
73
74
75
76
deploy_anaconda:
  stage: deploy
  dependencies:
    - test_py_tools_ds
    #- deploy_pypi
  script:
    - source /root/anaconda3/bin/activate
Daniel Scheffler's avatar
Fix.    
Daniel Scheffler committed
77
    - conda install conda-build
78
79
80
81
82
83
84
85
86
87
88
89
90
91
    - conda skeleton pypi py_tools_ds  # create recipe
    - conda config --set anaconda_upload yes  # enable auto-upload to anaconda
    - anaconda login --username ${ANACONDA_USER} --password ${ANACONDA_PASSWORD}
    - conda build -c conda-forge py_tools_ds  # --output returns package name
    #- conda convert --platform all /home/jsmith/miniconda/conda-bld/linux-64/pyinstrument-0.13.1-py27_0.tar.bz2
    #-o outputdir/
    - anaconda logout
  only:
    - feature/conda_deployment
    #- /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
  except:
    - dev


92
93
94
95
96
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.