.gitlab-ci.yml 2.33 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
  before_script:
46
    # Install the dependencies specified in the Pipfile
47
    - pipenv install --two --python=/opt/conda/bin/python2 --system --deploy
Colm Talbot's avatar
Colm Talbot committed
48 49 50
  script:
    - python setup.py install
    # Run tests without finding coverage
51
    - pytest --ignore=test/utils_py3_test.py
Colm Talbot's avatar
Colm Talbot committed
52 53

# test example on python 3
54
python-3.7:
Gregory Ashton's avatar
Gregory Ashton committed
55
  stage: test
56
  image: bilbydev/bilby-test-suite-python37
Gregory Ashton's avatar
Gregory Ashton committed
57
  before_script:
58
    # Install the dependencies specified in the Pipfile
59
    - pipenv install --three --python=/opt/conda/bin/python --system --deploy
Gregory Ashton's avatar
Gregory Ashton committed
60
  script:
61
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
62 63 64 65

    # Run pyflakes
    - flake8 .

Gregory Ashton's avatar
Gregory Ashton committed
66
    # Run tests and collect coverage data
Colm Talbot's avatar
Colm Talbot committed
67
    - pytest --cov=bilby
68 69
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
70 71 72

    # Make the documentation
    - cd docs
Gregory Ashton's avatar
Gregory Ashton committed
73
    - make clean
74 75
    - make html

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

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