.gitlab-ci.yml 1.76 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
# test example on python 2
17
python-2.7:
Colm Talbot's avatar
Colm Talbot committed
18
  stage: test
19
  image: bilbydev/bilby-test-suite-python27
Colm Talbot's avatar
Colm Talbot committed
20
  before_script:
21
    # Install the dependencies specified in the Pipfile
22
    - pipenv install --two --python=/opt/conda/bin/python2 --system --deploy
Colm Talbot's avatar
Colm Talbot committed
23 24 25
  script:
    - python setup.py install
    # Run tests without finding coverage
26
    - pytest --ignore=test/utils_py3_test.py
Colm Talbot's avatar
Colm Talbot committed
27 28

# test example on python 3
29
python-3.7:
Gregory Ashton's avatar
Gregory Ashton committed
30
  stage: test
31
  image: bilbydev/bilby-test-suite-python37
Gregory Ashton's avatar
Gregory Ashton committed
32
  before_script:
33
    # Install the dependencies specified in the Pipfile
34
    - pipenv install --three --python=/opt/conda/bin/python --system --deploy
Gregory Ashton's avatar
Gregory Ashton committed
35
  script:
36
    - python setup.py install
Gregory Ashton's avatar
Gregory Ashton committed
37 38 39 40

    # Run pyflakes
    - flake8 .

Gregory Ashton's avatar
Gregory Ashton committed
41
    # Run tests and collect coverage data
Colm Talbot's avatar
Colm Talbot committed
42
    - pytest --cov=bilby
43 44
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
45 46 47

    # Make the documentation
    - cd docs
Gregory Ashton's avatar
Gregory Ashton committed
48
    - make clean
49 50
    - make html

Gregory Ashton's avatar
Gregory Ashton committed
51 52 53
  artifacts:
    paths:
      - htmlcov/
54
      - coverage_badge.svg
55
      - docs/_build/html/
Gregory Ashton's avatar
Gregory Ashton committed
56 57 58 59

pages:
  stage: deploy
  dependencies:
60 61
    - python-3.7
    - python-2.7
Gregory Ashton's avatar
Gregory Ashton committed
62
  script:
63
    - mkdir public/
Gregory Ashton's avatar
Gregory Ashton committed
64
    - mv htmlcov/ public/
65
    - mv coverage_badge.svg public/
66
    - mv docs/_build/html/* public/
Gregory Ashton's avatar
Gregory Ashton committed
67 68 69 70
  artifacts:
    paths:
      - public
    expire_in: 30 days
71 72
  only:
    - master