.gitlab-ci.yml 3.03 KB
Newer Older
Sean Leavey's avatar
Sean Leavey committed
1 2
# https://git.ligo.org/lscsoft/example-ci-project/wikis/automatically-produce-documentation
# https://wiki.ligo.org/viewauth/DASWG/GitLigoOrg#Accessing_GitLab_Pages
3

Sean Leavey's avatar
Sean Leavey committed
4 5 6 7 8 9 10
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"

cache:
  paths:
    - .cache/

11 12 13 14
stages:
  - test
  - deploy

Sean Leavey's avatar
Sean Leavey committed
15
.template:test:unit: &template-test-unit
Sean Leavey's avatar
Sean Leavey committed
16
  script:
Sean Leavey's avatar
Sean Leavey committed
17
    - python --version
Sean Leavey's avatar
Sean Leavey committed
18
    - apt update -qy
Sean Leavey's avatar
Sean Leavey committed
19 20
    - apt install --assume-yes python-pip
    - pip install .
Sean Leavey's avatar
Sean Leavey committed
21
    - make test-unit
22

Sean Leavey's avatar
Sean Leavey committed
23
.template:test:integration: &template-test-integration
24
  script:
Sean Leavey's avatar
Sean Leavey committed
25
    - python --version
Sean Leavey's avatar
Sean Leavey committed
26
    - apt update -qy
Sean Leavey's avatar
Sean Leavey committed
27 28
    - apt install --assume-yes python-pip
    - pip install .
Sean Leavey's avatar
Sean Leavey committed
29
    - make test-integration
30

Sean Leavey's avatar
Sean Leavey committed
31
.template:test:validation: &template-test-validation
Sean Leavey's avatar
Sean Leavey committed
32 33 34 35
  only:
    variables:
      - $LISO_GIT_ARCHIVE_ACCESS_TOKEN
      - $LISO_GIT_ARCHIVE_URL
Sean Leavey's avatar
Sean Leavey committed
36
  script:
37 38 39 40
    - mkdir liso
    - cd liso
    - wget -O liso.tar.gz ${LISO_GIT_ARCHIVE_URL}
    - tar -xvf liso.tar.gz -C . --wildcards liso-linux*/ --strip-components=1
Sean Leavey's avatar
Sean Leavey committed
41
    - chmod +x fil_static
42
    - cd ..
43 44
    - export LISO_DIR=$(pwd)/liso
    - export LISO_PATH=$LISO_DIR/fil_static
Sean Leavey's avatar
Sean Leavey committed
45
    - python --version
Sean Leavey's avatar
Sean Leavey committed
46
    - apt update -qy
Sean Leavey's avatar
Sean Leavey committed
47 48
    - apt install --assume-yes python-pip
    - pip install .
Sean Leavey's avatar
Sean Leavey committed
49
    - make test-validation
Sean Leavey's avatar
Sean Leavey committed
50

Sean Leavey's avatar
Sean Leavey committed
51 52 53 54 55 56 57 58 59 60
test unit:latest:
  image: python:latest
  stage: test
  <<: *template-test-unit

test unit:3.6:
  image: python:3.6
  stage: test
  <<: *template-test-unit

61 62 63 64 65
test unit:3.7:
  image: python:3.7
  stage: test
  <<: *template-test-unit

Sean Leavey's avatar
Sean Leavey committed
66 67 68 69 70 71 72 73 74 75
test integration:latest:
  image: python:latest
  stage: test
  <<: *template-test-integration

test integration:3.6:
  image: python:3.6
  stage: test
  <<: *template-test-integration

76 77 78 79 80
test integration:3.7:
  image: python:3.7
  stage: test
  <<: *template-test-integration

Sean Leavey's avatar
Sean Leavey committed
81 82 83 84 85 86 87 88 89 90
test validation:latest:
  image: python:latest
  stage: test
  <<: *template-test-validation

test validation:3.6:
  image: python:3.6
  stage: test
  <<: *template-test-validation

91 92 93 94 95
test validation:3.7:
  image: python:3.7
  stage: test
  <<: *template-test-validation

96
# Generate the documentation only on creation of new tags.
97
pages:
98
  image: python:3.8
Sean Leavey's avatar
Sean Leavey committed
99 100
  stage: deploy
  only:
Sean Leavey's avatar
Sean Leavey committed
101 102 103 104 105
    refs:
      - tags
    variables:
      - $LISO_GIT_ARCHIVE_ACCESS_TOKEN
      - $LISO_GIT_ARCHIVE_URL
Sean Leavey's avatar
Sean Leavey committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
  script:
    - mkdir liso
    - cd liso
    - wget -O liso.tar.gz ${LISO_GIT_ARCHIVE_URL}
    - tar -xvf liso.tar.gz -C . --wildcards liso-linux*/ --strip-components=1
    - chmod +x fil_static
    - cd ..
    - export LISO_DIR=$(pwd)/liso
    - export LISO_PATH=$LISO_DIR/fil_static
    - python --version
    - apt update -qy
    - apt install --assume-yes python-pip
    - pip install .[dev]
    - cd docs
    - make html
    - mv _build/html ../public
  artifacts:
    paths:
    - public

# Generate PyPI release only on creation of new tags.
127
pypi:
128
  image: python:3.8
Sean Leavey's avatar
Sean Leavey committed
129
  stage: deploy
130
  only:
Sean Leavey's avatar
Sean Leavey committed
131 132 133 134 135
    refs:
      - tags
    variables:
      - $TWINE_USERNAME
      - $TWINE_PASSWORD
Sean Leavey's avatar
Sean Leavey committed
136 137 138 139 140 141 142
  script:
    - python --version
    - apt update -qy
    - apt install --assume-yes python-pip
    - pip install twine
    - python setup.py sdist bdist_wheel
    - python -m twine upload dist/zero-*