.gitlab-ci.yml 1.62 KB
Newer Older
James Clark's avatar
James Clark committed
1 2 3 4 5 6 7 8
variables:
  BRANCH: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
  COMMIT: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  NIGHTLY: $CI_REGISTRY_IMAGE:nightly
  TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
  BUILD_DIR: test-install
  BUILD_TARGET: ${CI_PROJECT_DIR}/${BUILD_DIR}
  TEST_OUTPUT: test-output
James Clark's avatar
James Clark committed
9 10

stages:
James Clark's avatar
James Clark committed
11
  - build
James Clark's avatar
James Clark committed
12 13
  - docker
  - deploy
James Clark's avatar
James Clark committed
14 15 16 17

before_script:
  -  docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY

James Clark's avatar
James Clark committed
18 19
docker:tags:
  stage: docker
James Clark's avatar
James Clark committed
20
  only:
James Clark's avatar
James Clark committed
21 22 23 24 25 26 27 28 29
    - tags@james-clark/gwrucio
  before_script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
  script:
    - docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG  --file Dockerfile ./
    - docker run -u $(id -u):$(id -g) $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG "/usr/bin/gwrucio_registrar --help"
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG

docs:
James Clark's avatar
James Clark committed
30
  stage: build
James Clark's avatar
James Clark committed
31 32 33 34 35 36 37 38 39 40 41
  image: python:3.7-slim-stretch
  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  before_script:
    # install pandoc >= 2.0.0
    - apt-get -yqq update
    - apt-get -yqq install curl
    - curl --location --output pandoc.deb https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb
    - dpkg --install pandoc.deb || { apt-get -y -f install; dpkg --install pandoc.deb; }
    # install python dependencies
    - python3 -m pip install -r doc/requirements.txt
James Clark's avatar
James Clark committed
42
  script:
James Clark's avatar
James Clark committed
43 44 45 46 47 48 49
    - bash -ex doc/build.sh
  artifacts:
    paths:
      - doc/_build
  cache:
    paths:
      - .cache/pip
James Clark's avatar
James Clark committed
50

James Clark's avatar
James Clark committed
51 52 53 54
pages:
  stage: deploy
  dependencies:
    - docs
James Clark's avatar
James Clark committed
55
  only:
James Clark's avatar
James Clark committed
56 57
    - master@james-clark/gwrucio
    - tags@james-clark/gwrucio
James Clark's avatar
James Clark committed
58
  script:
James Clark's avatar
James Clark committed
59 60 61 62
    - mv doc/_build/html public
  artifacts:
    paths:
      - public