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

4
5
6

stages:
  - test
Daniel Scheffler's avatar
Daniel Scheffler committed
7
  - sqa
Daniel Scheffler's avatar
Fix.    
Daniel Scheffler committed
8
  - deploy_pages
9
  - deploy_pypi
10
11
12
  - cleanup


Daniel Scheffler's avatar
Daniel Scheffler committed
13
test_py_tools_ds:
14
  stage: test
Daniel Scheffler's avatar
Daniel Scheffler committed
15
  script:
16
    - source /root/miniconda3/bin/activate ci_env
17
    - make nosetests
Daniel Scheffler's avatar
Daniel Scheffler committed
18
19
20
21
22
    - make docs
  artifacts:
    paths:
    - htmlcov/
    - docs/_build/html/
23
24
25
    - nosetests.html
    - nosetests.xml
    when: always
Daniel Scheffler's avatar
Daniel Scheffler committed
26

27

28
29
30
test_styles:
  stage: test
  script:
31
    - source /root/miniconda3/bin/activate ci_env
32
33
34
35
36
37
38
39
40
    - make lint
  artifacts:
    paths:
    - tests/linting/flake8.log
    - tests/linting/pycodestyle.log
    - tests/linting/pydocstyle.log
    when: always


Daniel Scheffler's avatar
Daniel Scheffler committed
41
42
43
44
test_urls:
  stage: test
  script:
    - source /root/miniconda3/bin/activate ci_env
45
46
    - pip install -U urlchecker
    - make urlcheck
Daniel Scheffler's avatar
Daniel Scheffler committed
47
48
49
  when: always


50
51
52
test_py_tools_ds_install:
  stage: test
  script:
53
    - source /root/miniconda3/bin/activate
54
    - conda create -y -q -c conda-forge --name py_tools_ds_testinstall python=3
55
    - conda activate py_tools_ds_testinstall
56

57
    # update conda and python
58
    - conda update -n base -c conda-forge conda
59
    # - conda update -c conda-forge python
60

61
    # avoid package incompatibilities due to usage of wrong channels
62
    # - conda config --set channel_priority strict  # otherwise gdal or libgdal may be installed from defaults channel
63

Daniel Scheffler's avatar
Daniel Scheffler committed
64
    # resolve some requirements with conda
65
    - conda install --yes -q -c conda-forge numpy gdal 'pyproj>=2.5.0' shapely geopandas
66

67
    # run installer
68
    - python setup.py install
69

70
    # test if its importable
71
72
73
74
75
    - cd ..
    - pwd
    - ls
    - python -c "import py_tools_ds; print(py_tools_ds)"
    - python -c "from py_tools_ds.geo.vector.geometry import boxObj"
76
77
  only:
    - master
Daniel Scheffler's avatar
Daniel Scheffler committed
78

79

Daniel Scheffler's avatar
Daniel Scheffler committed
80
81
82
83
84
85
sqa:
  stage: sqa
  image:
    name: "git.gfz-potsdam.de:5000/id2/software/services/fair/software-quality-assurance/software-quality-assurance:latest"
    entrypoint: [""]
  script:
86
    - sqa --repository_dir "$CI_PROJECT_DIR" run -r -lli -lla -la -c
Daniel Scheffler's avatar
Daniel Scheffler committed
87
88
89
  only:
    refs:
      - master
90
      - enhancement/add_sqa
Daniel Scheffler's avatar
Daniel Scheffler committed
91
92
93
94
95
96
  artifacts:
    paths:
      - QUALITY.md
    expire_in: 30 days


97
pages:  # this job must be called 'pages' to advise GitLab to upload content to GitLab Pages
Daniel Scheffler's avatar
Fix.    
Daniel Scheffler committed
98
  stage: deploy_pages
Daniel Scheffler's avatar
Daniel Scheffler committed
99
100
101
  dependencies:
    - test_py_tools_ds
  script:
102
103
104
      # Create the public directory
    - rm -rf public
    - mkdir public
Daniel Scheffler's avatar
Daniel Scheffler committed
105
106
    - mkdir -p public/doc
    - mkdir -p public/coverage
107
    - mkdir -p public/nosetests_reports
108

109
    # Copy over the docs
Daniel Scheffler's avatar
Daniel Scheffler committed
110
    - cp -r docs/_build/html/* public/doc/
111

112
113
    # Copy over the coverage reports
    - cp -r htmlcov/* public/coverage/
114

115
116
    # Copy over the nosetests reports
    - cp nosetests.* public/nosetests_reports/
117

118
119
120
    # Check if everything is working great
    - ls -al public
    - ls -al public/doc
Daniel Scheffler's avatar
Daniel Scheffler committed
121
122
    - ls -al public/coverage
    - ls -al public/nosetests_reports
Daniel Scheffler's avatar
Daniel Scheffler committed
123
124
125
126
127
128
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
129
130
131


deploy_pypi:
132
  stage: deploy_pypi
133
134
  dependencies:
    - test_py_tools_ds
135
  script:
136
    - source /root/miniconda3/bin/activate ci_env
137
138
139
    - pip install -U twine
    - python setup.py sdist
    - twine upload dist/*  # requires creds as environment variables
140
141
142
143
  only:
    - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
  except:
    - dev