Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 17.26 KiB
workflow:
  rules:
    # Don't create a pipeline if commit is on a branch with open merge requests
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - when: always

variables:
  TEST_HBA_DATASET_NAME: "test_data.tar.gz"
  TEST_LBA_DATASET_NAME: "test_data_lba.tar.gz"
  CALIBRATOR_HBA_RESULTS_NAME: "results_calibrator.tar.gz"
  CALIBRATOR_LBA_RESULTS_NAME: 'results_calibrator_lba.tar.gz'
  TARGET_HBA_RESULTS_NAME: "results_target.tar.gz"
  TARGET_LBA_RESULTS_NAME: "results_target_lba.tar.gz"
  TARGET_HBA_SELFCAL_RESULTS_NAME: "results_target_selfcal.tar.gz"
  TARGET_HBA_VLBI_RESULTS_NAME: "results_target_VLBI.tar.gz"
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  BUILD_DOCKER_IMAGE: "0"
  GIT_STRATEGY: clone  # ensure every job starts with a pristine working copy
  GIT_DEPTH: 0  # do not do shallow clones, needed for `git describe --tags`

stages:
  - initialize
  - versioning
  - build
  - install
  - prepare_tests
  - run_tests
  - docs
  - deploy
  - finalize

.release:
  before_script:
    # Make sure release branch is checked out when building a release
    - export RELEASE=$(echo -n $CI_COMMIT_BRANCH | sed -n 's,^releases/,,p')
    - |
      if test -n "$RELEASE"
      then
        echo "Checking out branch '$CI_COMMIT_BRANCH'"
        git checkout $CI_COMMIT_BRANCH
      fi

.versioning:
  image: python
  before_script:
    - !reference [.release, before_script]
    - pip install setuptools_scm
  script:
    # Determine the LINC version, and the docker image tag. If RELEASE is set,
    # check if it adheres to the PEP-440 naming conventions, and if so, set the LINC
    # version string.  If RELEASE is not set, then determine the LINC version string
    # using `setuptools_scm`. For the docker image tag, replace all the characters
    # in the LINC version string that are not allowed in a tag string with a dash.
    - |
      if test -n "$RELEASE"
      then
        LINC_VERSION=$(python -c 'import os; from packaging.version import Version; print(Version(os.getenv("RELEASE")))')
      else
        LINC_VERSION=$(python -m setuptools_scm)
      fi
    - LINC_TAG=${LINC_VERSION//[^[:alnum:]_.-]/-}
    - echo "LINC_VERSION=$LINC_VERSION" >> versions.env
    - echo "LINC_TAG=$LINC_TAG" >> versions.env
  artifacts:
    reports:
      dotenv: versions.env

.setup_git:
  image: bitnami/git