.gitlab-ci.yml 2.06 KB
Newer Older
Gregory Ashton's avatar
Gregory Ashton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# This script is an edited version of the example found at
# https://git.ligo.org/lscsoft/example-ci-project/blob/python/.gitlab-ci.yml
# Each 0th-indendation level is a job that will be run within GitLab CI
# The only exception are a short list of reserved keywords
#
# https://docs.gitlab.com/ee/ci/yaml/#gitlab-ci-yml

# stages is a reserved keyword that defines job dependencies and
# parallelization. each stage runs in parallel but must complete
# before the next stage begins

stages:
  - test
  - deploy

Colm Talbot's avatar
Colm Talbot committed
16 17 18 19 20
# test example on python 2
python-2:
  stage: test
  image: continuumio/anaconda
  before_script:
Colm Talbot's avatar
Colm Talbot committed
21 22
    - apt-get update
    - apt-get install gcc -y
Colm Talbot's avatar
Colm Talbot committed
23 24
    - apt install -y libgl1-mesa-glx
    - pip install -r requirements.txt
25
    - pip install -r optional_requirements.txt
26
    - pip install enum
Colm Talbot's avatar
Colm Talbot committed
27 28 29
  script:
    - python setup.py install
    # Run tests without finding coverage
MoritzThomasHuebner's avatar
MoritzThomasHuebner committed
30
    - pytest --ignore=test/gw_example_test.py
Colm Talbot's avatar
Colm Talbot committed
31 32 33

# test example on python 3
python-3:
Gregory Ashton's avatar
Gregory Ashton committed
34
  stage: test
35
  image: continuumio/anaconda3
Gregory Ashton's avatar
Gregory Ashton committed
36
  before_script:
Colm Talbot's avatar
Colm Talbot committed
37 38
    - apt-get update
    - apt-get install gcc -y
39
    - apt install -y libgl1-mesa-glx
40
    - pip install -r requirements.txt
41
    - pip install -r optional_requirements.txt
42
    - pip install 'coverage>=4.5'
Gregory Ashton's avatar
Gregory Ashton committed
43
    - pip install coverage-badge
Gregory Ashton's avatar
Gregory Ashton committed
44
    - pip install flake8
45
    - pip install pytest-cov
Gregory Ashton's avatar
Gregory Ashton committed
46
  script:
47
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
48 49 50 51

    # Run pyflakes
    - flake8 .

Gregory Ashton's avatar
Gregory Ashton committed
52
    # Run tests and collect coverage data
MoritzThomasHuebner's avatar
MoritzThomasHuebner committed
53
    - pytest --cov=tupak --ignore=test/gw_example_test.py
54 55
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
56 57 58 59

    # Make the documentation
    - pip install -r docs/requirements.txt
    - cd docs
60
    - conda install -y make
Gregory Ashton's avatar
Gregory Ashton committed
61
    - make clean
62 63
    - make html

Gregory Ashton's avatar
Gregory Ashton committed
64 65 66
  artifacts:
    paths:
      - htmlcov/
67
      - coverage_badge.svg
68
      - docs/_build/html/
Gregory Ashton's avatar
Gregory Ashton committed
69 70 71 72

pages:
  stage: deploy
  dependencies:
Colm Talbot's avatar
Colm Talbot committed
73 74
    - python-3
    - python-2
Gregory Ashton's avatar
Gregory Ashton committed
75
  script:
76
    - mkdir public/
Gregory Ashton's avatar
Gregory Ashton committed
77
    - mv htmlcov/ public/
78
    - mv /builds/Monash/tupak/coverage_badge.svg public/
79
    - mv docs/_build/html/* public/
Gregory Ashton's avatar
Gregory Ashton committed
80 81 82 83
  artifacts:
    paths:
      - public
    expire_in: 30 days
84 85
  only:
    - master