.gitlab-ci.yml 3.08 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 21 22
# test example on python 2
python-2:
  stage: test
  image: continuumio/anaconda
  before_script:
    - apt install -y libgl1-mesa-glx
    - pip install -r requirements.txt
23
    - pip install -r optional_requirements.txt
Colm Talbot's avatar
Colm Talbot committed
24 25 26 27 28 29 30 31
    - pip install lalsuite enum gwpy
  script:
    - python setup.py install
    # Run tests without finding coverage
    - for test in test/*tests.py; do python $test; done

# test example on python 3
python-3:
Gregory Ashton's avatar
Gregory Ashton committed
32
  stage: test
33
  image: continuumio/anaconda3
Gregory Ashton's avatar
Gregory Ashton committed
34 35
  before_script:
    - sed -i '/lalsuite/d' requirements.txt
36
    - apt install -y libgl1-mesa-glx
37
    - pip install -r requirements.txt
38
    - pip install -r optional_requirements.txt
39
    - pip install 'coverage>=4.5'
Gregory Ashton's avatar
Gregory Ashton committed
40
    - pip install coverage-badge
Gregory Ashton's avatar
Gregory Ashton committed
41
    - pip install flake8
Gregory Ashton's avatar
Gregory Ashton committed
42
  script:
43
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
44
    # Run tests and collect coverage data
45
    - coverage --version
46
    - coverage erase
47
    - coverage run --debug=trace --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/conversion_tests.py
Colm Talbot's avatar
Colm Talbot committed
48
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/calibration_tests.py
49
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/detector_tests.py
Colm Talbot's avatar
Colm Talbot committed
50 51
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/gw_likelihood_tests.py
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/likelihood_tests.py
52 53
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/prior_tests.py
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/sampler_tests.py
Colm Talbot's avatar
Colm Talbot committed
54
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/utils_tests.py
55
    - coverage run --include=/opt/conda/lib/python3.6/site-packages/tupak* -a test/waveform_generator_tests.py
56 57
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
Gregory Ashton's avatar
Gregory Ashton committed
58 59
    # Run all other tests (no coverage data collected)
    - python test/example_tests.py
60
    - python test/gw_example_tests.py
Gregory Ashton's avatar
Gregory Ashton committed
61
    - python test/noise_realisation_tests.py
62 63 64 65

    # Make the documentation
    - pip install -r docs/requirements.txt
    - cd docs
66
    - conda install -y make
Gregory Ashton's avatar
Gregory Ashton committed
67
    - make clean
68 69
    - make html

Gregory Ashton's avatar
Gregory Ashton committed
70 71 72
    # Run pyflakes
    - flake8 .

Gregory Ashton's avatar
Gregory Ashton committed
73 74 75
  artifacts:
    paths:
      - htmlcov/
76
      - coverage_badge.svg
77
      - docs/_build/html/
Gregory Ashton's avatar
Gregory Ashton committed
78 79 80 81

pages:
  stage: deploy
  dependencies:
Colm Talbot's avatar
Colm Talbot committed
82 83
    - python-3
    - python-2
Gregory Ashton's avatar
Gregory Ashton committed
84
  script:
85
    - mkdir public/
Gregory Ashton's avatar
Gregory Ashton committed
86
    - mv htmlcov/ public/
87
    - mv /builds/Monash/tupak/coverage_badge.svg public/
88
    - mv docs/_build/html/* public/
Gregory Ashton's avatar
Gregory Ashton committed
89 90 91 92
  artifacts:
    paths:
      - public
    expire_in: 30 days
93 94
  only:
    - master