.gitlab-ci.yml 1.81 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
# 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:
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
MoritzThomasHuebner's avatar
MoritzThomasHuebner committed
26
    - pytest --ignore=test/gw_example_test.py
Colm Talbot's avatar
Colm Talbot committed
27 28 29

# test example on python 3
python-3:
Gregory Ashton's avatar
Gregory Ashton committed
30
  stage: test
31
  image: bilbydev/test-suite-py3
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
MoritzThomasHuebner's avatar
MoritzThomasHuebner committed
42
    - pytest --cov=tupak --ignore=test/gw_example_test.py
43 44
    - coverage html
    - coverage-badge -o coverage_badge.svg -f
45 46 47

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

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

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