.gitlab-ci.yml 2.17 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:
21
    - apt-get update -y
Colm Talbot's avatar
Colm Talbot committed
22
    - apt-get install gcc -y
Colm Talbot's avatar
Colm Talbot committed
23
    - apt install -y libgl1-mesa-glx
24 25
    - pip install pip --upgrade
    - pip install pipenv
26
    - pip install enum
27
    - pipenv install --two --python=/opt/conda/bin/python2 --system --deploy
Colm Talbot's avatar
Colm Talbot committed
28 29 30
  script:
    - python setup.py install
    # Run tests without finding coverage
MoritzThomasHuebner's avatar
MoritzThomasHuebner committed
31
    - pytest --ignore=test/gw_example_test.py
Colm Talbot's avatar
Colm Talbot committed
32 33 34

# test example on python 3
python-3:
Gregory Ashton's avatar
Gregory Ashton committed
35
  stage: test
36
  image: continuumio/anaconda3
Gregory Ashton's avatar
Gregory Ashton committed
37
  before_script:
38
    - apt-get update -y
Colm Talbot's avatar
Colm Talbot committed
39
    - apt-get install gcc -y
40
    - apt install -y libgl1-mesa-glx
41
    - pip install pip --upgrade
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
46 47
    - pip install pipenv
    - pipenv install --three --python=/opt/conda/bin/python --system --deploy
Gregory Ashton's avatar
Gregory Ashton committed
48
  script:
49
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
50 51 52 53

    # Run pyflakes
    - flake8 .

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

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

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

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