Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.43 KiB
Newer Older
Christopher Wipf's avatar
Christopher Wipf committed
stages:
  - dist
  - test
  - gen_cache
  - update_cache
  - deploy

# build the docker image we will use in all the jobs, with all
# dependencies pre-installed/configured.
gwinc/base:
  stage: dist
  variables:
    IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_JOB_NAME:$CI_COMMIT_REF_NAME
    GIT_STRATEGY: none
  script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - |
      cat <<EOF > Dockerfile
      FROM igwn/base:buster
      RUN apt-get update -qq
      RUN apt-get -y install --no-install-recommends git python3 python3-yaml python3-scipy python3-matplotlib python3-ipython lalsimulation-python3 python3-pypdf2 python3-h5py
      RUN git clone https://gitlab-ci-token:ci_token@git.ligo.org/gwinc/inspiral_range.git
      EOF
    - docker build -t $IMAGE_TAG .
    - docker push $IMAGE_TAG

# run the tests and generate the test report on failure
Christopher Wipf's avatar
Christopher Wipf committed
test:
  stage: test
  image: $CI_REGISTRY_IMAGE/gwinc/base:$CI_COMMIT_REF_NAME
Christopher Wipf's avatar
Christopher Wipf committed
  script:
    - rm -f gwinc_test_report.pdf
    - export MPLBACKEND=agg
    - python3 -m gwinc.test -r gwinc_test_report.pdf
  artifacts:
    when: on_failure
    paths:
      - gwinc_test_report.pdf
    expose_as: 'GWINC test failure report PDF'

# create plots for the canonical IFOs
ifo:
  stage: docs
  image: $CI_REGISTRY_IMAGE/gwinc/base:$CI_COMMIT_REF_NAME
Christopher Wipf's avatar
Christopher Wipf committed
  script:
      - mkdir -p ifo
      - export PYTHONPATH=/inspiral_range
      - for ifo in $(python3 -c "import gwinc; print(' '.join(gwinc.IFOS))"); do
      -     python3 -m gwinc $ifo -s ifo/$ifo.png
      -     python3 -m gwinc $ifo -s ifo/$ifo.h5
      - python3 -m gwinc.ifo -s ifo/all_compare.png
Christopher Wipf's avatar
Christopher Wipf committed
  artifacts:
Christopher Wipf's avatar
Christopher Wipf committed
    paths:

# generate the html doc web pages
html:
  stage: docs
  image: $CI_REGISTRY_IMAGE/gwinc/base:$CI_COMMIT_REF_NAME
    - rm -rf public
    - apt-get install -y -qq python3-sphinx-rtd-theme
    - cd docs
    - make html
    - cd ..
    - mv ./build/sphinx/html public
  artifacts:
    when: always
    paths:
      - public

# the "pages" job has special meaning, as it's "public" artifact
# becomes the directory served through gitlab static pages
pages:
  stage: deploy
  needs:
    - job: ifo
      artifacts: true
    - job: html
      artifacts: true
  image: $CI_REGISTRY_IMAGE/gwinc/base:$CI_COMMIT_REF_NAME
  script:
    - mv ifo public/