.gitlab-ci.yml 2.61 KB
Newer Older
Daniel Scheffler's avatar
Daniel Scheffler committed
1
2
3
4
5
6
7
8
9
10
11
12
before_script:
  - git lfs pull


stages:
  - test
  - deploy


test_pyrsr:
  stage: test
  script:
13
    - source /root/miniconda3/bin/activate ci_env
Daniel Scheffler's avatar
Daniel Scheffler committed
14
    - make nosetests
15

Daniel Scheffler's avatar
Daniel Scheffler committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    # create the docs
    - pip install sphinx_rtd_theme  # Read-the-docs theme for SPHINX documentation
    - pip install sphinx-autodoc-typehints
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
    - nosetests.html
    - nosetests.xml
    when: always


test_styles:
  stage: test
  script:
32
    - source /root/miniconda3/bin/activate ci_env
Daniel Scheffler's avatar
Daniel Scheffler committed
33
34
35
36
37
38
39
40
41
    - make lint
  artifacts:
    paths:
    - tests/linting/flake8.log
    - tests/linting/pycodestyle.log
    - tests/linting/pydocstyle.log
    when: always


42
43
44
45
46
47
48
49
50
test_urls:
  stage: test
  script:
    - source /root/miniconda3/bin/activate ci_env
    - pip install -U urlchecker
    - make urlcheck
  when: always


Daniel Scheffler's avatar
Daniel Scheffler committed
51
52
53
54
test_pyrsr_install:
  stage: test
  script:
    - source /root/miniconda3/bin/activate
55
56
57
58
59

    - conda update -n base -c conda-forge conda
    # - conda update -c conda-forge python

    - conda create -y -q -c conda-forge --name pyrsr_testinstall python=3
60
    - conda activate pyrsr_testinstall
61

Daniel Scheffler's avatar
Daniel Scheffler committed
62
     # resolve some requirements with conda
63
64
    - conda install --y -q -c conda-forge numpy matplotlib pandas

Daniel Scheffler's avatar
Daniel Scheffler committed
65
66
    # run installer
    - python setup.py install
67

Daniel Scheffler's avatar
Daniel Scheffler committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    # test if its importable
    - cd ..
    - pwd
    - ls
    - python -c "import pyrsr; print(pyrsr)"
    - python -c "from pyrsr import RSR"
  only:
    - master


pages:  # this job must be called 'pages' to advise GitLab to upload content to GitLab Pages
  stage: deploy
  dependencies:
    - test_pyrsr
  script:
    # Create the public directory
    - rm -rf public
    - mkdir public
    - mkdir -p public/doc
    - mkdir -p public/coverage
    - mkdir -p public/nosetests_reports
89

Daniel Scheffler's avatar
Daniel Scheffler committed
90
91
    # Copy over the docs
    - cp -r docs/_build/html/* public/doc/
92

Daniel Scheffler's avatar
Daniel Scheffler committed
93
94
    # Copy over the coverage reports
    - cp -r htmlcov/* public/coverage/
95

Daniel Scheffler's avatar
Daniel Scheffler committed
96
97
    # Copy over the nosetests reports
    - cp nosetests.* public/nosetests_reports/
98

Daniel Scheffler's avatar
Daniel Scheffler committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
    # Check if everything is working great
    - ls -al public
    - ls -al public/doc
    - ls -al public/coverage
    - ls -al public/nosetests_reports
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
    - enhancement/improve_docs


deploy_pypi:
  stage: deploy
  dependencies:
    - test_pyrsr
  script:
    - source /root/miniconda3/bin/activate
119
    - conda activate ci_env
Daniel Scheffler's avatar
Daniel Scheffler committed
120
121
122
123
124
125
126
    - pip install -U twine
    - python setup.py sdist
    - twine upload dist/*  # requires creds as environment variables
  only:
    - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
  except:
    - dev