Skip to content
Snippets Groups Projects
Forked from lscsoft / bilby
2692 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 2.06 KiB
# 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

# test example on python 2
python-2:
  stage: test
  image: continuumio/anaconda
  before_script:
    - apt-get update
    - apt-get install gcc -y
    - apt install -y libgl1-mesa-glx
    - pip install -r requirements.txt
    - pip install -r optional_requirements.txt
    - pip install enum
  script:
    - python setup.py install
    # Run tests without finding coverage
    - pytest --ignore=test/gw_example_test.py

# test example on python 3
python-3:
  stage: test
  image: continuumio/anaconda3
  before_script:
    - apt-get update
    - apt-get install gcc -y
    - apt install -y libgl1-mesa-glx
    - pip install -r requirements.txt
    - pip install -r optional_requirements.txt
    - pip install 'coverage>=4.5'
    - pip install coverage-badge
    - pip install flake8
    - pip install pytest-cov
  script:
    - python setup.py install

    # Run pyflakes
    - flake8 .

    # Run tests and collect coverage data
    - pytest --cov=tupak --ignore=test/gw_example_test.py
    - coverage html
    - coverage-badge -o coverage_badge.svg -f

    # Make the documentation
    - pip install -r docs/requirements.txt
    - cd docs
    - conda install -y make
    - make clean
    - make html

  artifacts:
    paths:
      - htmlcov/
      - coverage_badge.svg
      - docs/_build/html/

pages:
  stage: deploy
  dependencies:
    - python-3
    - python-2
  script:
    - mkdir public/
    - mv htmlcov/ public/
    - mv /builds/Monash/tupak/coverage_badge.svg public/
    - mv docs/_build/html/* public/
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master