.gitlab-ci.yml 2.34 KB
Newer Older
Gregory Ashton's avatar
Gregory Ashton committed
1 2
# This script is an edited version of the example found at
# https://git.ligo.org/lscsoft/example-ci-project/blob/python/.gitlab-ci.yml
3
# Each 0th-indentation level is a job that will be run within GitLab CI
Gregory Ashton's avatar
Gregory Ashton committed
4 5 6 7 8 9 10 11 12 13 14 15
# 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

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
.test-python: &test-python
  stage: test
  image: python
  before_script:
    # this is required because pytables doesn't use a wheel on py37
    - apt-get -yqq update
    - apt-get -yqq install libhdf5-dev
  script:
    - python -m pip install .
    - python -c "import bilby"
    - python -c "import bilby.core"
    - python -c "import bilby.gw"
    - python -c "import bilby.hyper"
    - python -c "import cli_bilby"

# test basic setup on python2
basic-2.7:
  <<: *test-python
  image: python:2.7

# test basic setup on python3
basic-3.7:
  <<: *test-python
  image: python:3.7

Colm Talbot's avatar
Colm Talbot committed
41
# test example on python 2
42
python-2.7:
Colm Talbot's avatar
Colm Talbot committed
43
  stage: test
44
  image: bilbydev/bilby-test-suite-python27
Colm Talbot's avatar
Colm Talbot committed
45 46 47
  script:
    - python setup.py install
    # Run tests without finding coverage
48
    - pytest --ignore=test/utils_py3_test.py
Colm Talbot's avatar
Colm Talbot committed
49 50

# test example on python 3
51
python-3.7:
Gregory Ashton's avatar
Gregory Ashton committed
52
  stage: test
53
  image: bilbydev/bilby-test-suite-python37
Gregory Ashton's avatar
Gregory Ashton committed
54
  script:
55
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
56 57 58 59

    # Run pyflakes
    - flake8 .

Gregory Ashton's avatar
Gregory Ashton committed
60
    # Run tests and collect coverage data
Colm Talbot's avatar
Colm Talbot committed
61
    - pytest --cov=bilby
62 63
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
64 65 66

    # Make the documentation
    - cd docs
Gregory Ashton's avatar
Gregory Ashton committed
67
    - make clean
68 69
    - make html

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

76 77 78 79 80 81 82 83 84 85 86 87 88
# Tests run at a fixed schedule rather than on push
scheduled-python-3.7:
  stage: test
  image: bilbydev/bilby-test-suite-python37
  only:
    - schedules
  script:
    - python setup.py install

    # Run tests which are only done on schedule
    - pytest test/example_test.py
    - pytest test/gw_example_test.py

Gregory Ashton's avatar
Gregory Ashton committed
89 90 91
pages:
  stage: deploy
  dependencies:
92 93
    - python-3.7
    - python-2.7
Gregory Ashton's avatar
Gregory Ashton committed
94
  script:
95
    - mkdir public/
Gregory Ashton's avatar
Gregory Ashton committed
96
    - mv htmlcov/ public/
97
    - mv coverage_badge.svg public/
98
    - mv docs/_build/html/* public/
Gregory Ashton's avatar
Gregory Ashton committed
99 100 101 102
  artifacts:
    paths:
      - public
    expire_in: 30 days
103 104
  only:
    - master