.gitlab-ci.yml 1.89 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

Colm Talbot's avatar
Colm Talbot committed
16 17 18
# test example on python 2
python-2:
  stage: test
19
  image: bilbydev/test-suite-py2
Colm Talbot's avatar
Colm Talbot committed
20
  before_script:
Colm Talbot's avatar
Colm Talbot committed
21 22
    # Source the .bashrc for MultiNest
    - source /root/.bashrc
23
    # Install the dependencies specified in the Pipfile
24
    - pipenv install --two --python=/opt/conda/bin/python2 --system --deploy
Colm Talbot's avatar
Colm Talbot committed
25 26 27
  script:
    - python setup.py install
    # Run tests without finding coverage
28
    - pytest --ignore=test/utils_py3_test.py
Colm Talbot's avatar
Colm Talbot committed
29 30 31

# test example on python 3
python-3:
Gregory Ashton's avatar
Gregory Ashton committed
32
  stage: test
33
  image: bilbydev/test-suite-py3
Gregory Ashton's avatar
Gregory Ashton committed
34
  before_script:
Colm Talbot's avatar
Colm Talbot committed
35 36
    # Source the .bashrc for MultiNest
    - source /root/.bashrc
37
    # Install the dependencies specified in the Pipfile
38
    - pipenv install --three --python=/opt/conda/bin/python --system --deploy
Gregory Ashton's avatar
Gregory Ashton committed
39
  script:
40
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
41 42 43 44

    # Run pyflakes
    - flake8 .

Gregory Ashton's avatar
Gregory Ashton committed
45
    # Run tests and collect coverage data
Colm Talbot's avatar
Colm Talbot committed
46
    - pytest --cov=bilby
47 48
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
49 50 51

    # Make the documentation
    - cd docs
52
    - conda install -y make
Gregory Ashton's avatar
Gregory Ashton committed
53
    - make clean
54 55
    - make html

Gregory Ashton's avatar
Gregory Ashton committed
56 57 58
  artifacts:
    paths:
      - htmlcov/
59
      - coverage_badge.svg
60
      - docs/_build/html/
Gregory Ashton's avatar
Gregory Ashton committed
61 62 63 64

pages:
  stage: deploy
  dependencies:
Colm Talbot's avatar
Colm Talbot committed
65 66
    - python-3
    - python-2
Gregory Ashton's avatar
Gregory Ashton committed
67
  script:
68
    - mkdir public/
Gregory Ashton's avatar
Gregory Ashton committed
69
    - mv htmlcov/ public/
70
    - mv coverage_badge.svg public/
71
    - mv docs/_build/html/* public/
Gregory Ashton's avatar
Gregory Ashton committed
72 73 74 75
  artifacts:
    paths:
      - public
    expire_in: 30 days
76 77
  only:
    - master