.gitlab-ci.yml 1.51 KB
Newer Older
Leo Pound Singer's avatar
Leo Pound Singer committed
1
include:
2 3 4 5
  - project: computing/gitlab-ci-templates
    file: python/lint.yml
  - project: computing/gitlab-ci-templates
    file: workflow/sccb.yml
Leo Pound Singer's avatar
Leo Pound Singer committed
6

Leo Pound Singer's avatar
Leo Pound Singer committed
7 8 9 10 11
stages:
  - dist
  - test
  - deploy

Leo Pound Singer's avatar
Leo Pound Singer committed
12 13
image: python:slim

Leo Pound Singer's avatar
Leo Pound Singer committed
14 15 16
# Build Python packages
dist:
  stage: dist
Leo Pound Singer's avatar
Leo Pound Singer committed
17 18 19 20
  before_script:
    # Versioneer will need access to the git tool.
    - apt-get -q update
    - apt-get -yq install --no-install-recommends git
Leo Pound Singer's avatar
Leo Pound Singer committed
21 22 23 24 25 26 27 28 29 30
  script:
    - python setup.py sdist bdist_wheel
    - mv *.egg-info/requires.txt requirements.txt
    - mv dist/* .
  artifacts:
    paths:
      - '*.tar.gz'
      - '*.whl'
      - requirements.txt

Leo Pound Singer's avatar
Leo Pound Singer committed
31 32 33
# Template for test stage jobs
.test: &test
  stage: test
Leo Pound Singer's avatar
Leo Pound Singer committed
34 35
  variables:
    GIT_STRATEGY: none
Leo Pound Singer's avatar
Leo Pound Singer committed
36 37 38 39
  before_script:
    - pip install -r requirements.txt
    - rm requirements.txt *.whl
    - tar --strip-components 1 -xf *.tar.*
Leo Pound Singer's avatar
Leo Pound Singer committed
40 41 42 43 44
  dependencies:
    - dist

# Generate documentation
doc:
Leo Pound Singer's avatar
Leo Pound Singer committed
45
  <<: *test
Leo Pound Singer's avatar
Leo Pound Singer committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
  script:
    - python setup.py build_sphinx -W
  artifacts:
    paths:
      - build/sphinx/html

# Publish docs and coverage
pages:
  stage: deploy
  script:
    - mv build/sphinx/html public/
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master

Leo Pound Singer's avatar
Leo Pound Singer committed
64 65 66 67
# SCCB request
sccb:
  stage: deploy

Leo Pound Singer's avatar
Leo Pound Singer committed
68 69
# Upload package to PyPI.
# Place your PyPI API token in the repository's GitLab CI secrets.
Leo Pound Singer's avatar
Leo Pound Singer committed
70 71 72 73 74 75
pypi:
  stage: deploy
  variables:
    GIT_STRATEGY: none
  script:
    - pip install twine
Leo Pound Singer's avatar
Leo Pound Singer committed
76
    - twine upload --username __token__ --password $PYPI_API_TOKEN *.tar.* *.whl
Leo Pound Singer's avatar
Leo Pound Singer committed
77 78 79 80
  dependencies:
    - dist
  only:
    - tags@emfollow/sleek-lvalert