Skip to content
Snippets Groups Projects
Forked from gwinc / pygwinc
53 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
This GitLab CI configuration is valid. Learn more
.gitlab-ci.yml 3.93 KiB
stages:
  - dist
  - test
  - review
  - deploy

# have to specify this so that all jobs execute for all commits
# including merge requests
workflow:
  rules:
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_BRANCH

variables:
  GIT_STRATEGY: clone

# 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-gitlab python3-setuptools-scm python3-yaml python3-scipy python3-matplotlib python3-pypdf2 python3-h5py python3-inspiral-range python3-lalsimulation
      EOF
    - docker build --no-cache -t $IMAGE_TAG .
    - docker push $IMAGE_TAG

# create plots for the canonical IFOs
generate_budgets:
  stage: test
  image: $CI_REGISTRY_IMAGE/gwinc/base:$CI_COMMIT_REF_NAME
  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 -s ifo/$ifo.h5
      - done
      - python3 -m gwinc.ifo -s ifo/all_compare.png
  artifacts:
    when: always
    paths:
      - ifo

# this is a special job intended to run only for merge requests.
# budgets are compared against those from the target branch.  if the
# merge request has not yet been approved and noise changes are found,
# the job will fail.  once the merge request is approved the job can
# be re-run, at which point the pipeline should succeed allowing the
# merge to be merged.
noise_change_approval:
  stage: review
  rules:
    # - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
    - if: $CI_MERGE_REQUEST_ID
  image: $CI_REGISTRY_IMAGE/gwinc/base:$CI_COMMIT_REF_NAME
  script:
    - export PYTHONPATH=/inspiral_range
    - |
      cat <<EOF > merge_info_env.py
      import gitlab
      project_id = $CI_MERGE_REQUEST_PROJECT_ID
      mr_iid = $CI_MERGE_REQUEST_IID
      # this only works for public repos, otherwise need to specify