.gitlab-ci.yml 1.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
stages:
  - build
  - test
  - deploy

gen_package:
  image: obci-image:u1604
  stage: build
  script:
    - python3 setup.py bdist_wheel
  artifacts:
    name: "{$CI_BUILD_NAME_$CI_BUILD_REF_NAME}"
    paths:
    - ./dist/*
  tags:
    - docker

gen_docs:
  image: obci-image:u1604
  stage: build
  script:
    - sphinx-apidoc --separate -o docs/apidoc obci_readmanager && cd docs && make html
  artifacts:
    name: "{$CI_BUILD_NAME_$CI_BUILD_REF_NAME}"
    paths:
    - ./docs/_build/html/*
  tags:
    - docker

test:
  image: obci-image:u1604
  stage: test
  before_script:
34
    - pip3 install -e .[test]
35 36
    - apt-get -qq -y install python3-tk
  script:
37
    - xvfb-run -e/tmp/xvfb.err -a -s "-screen 0 1400x900x24 -ac +extension RANDR +extension GLX +render -noreset" -- py.test ./test/
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  artifacts:
    name: "{$CI_BUILD_NAME_$CI_BUILD_REF_NAME}"
    paths:
    - ./coverage_html/*
  tags:
    - docker

deploy_pypi:
  image: obci-image:u1604
  stage: deploy
  only:
    - master
  when: manual
  before_script:
    - pip3 install twine
  dependencies:
    - gen_package
  script:
    - twine upload -u $PYPI_USER -p $PYPI_PASS dist/*
  environment:
    name: pypi-production
    url: https://pypi.python.org/pypi/obci-readmanager/
  tags:
    - docker


deploy_testpypi:
  image: obci-image:u1604
  stage: deploy
  when: manual
  before_script:
    - pip3 install twine
  dependencies:
    - gen_package
  script:
    - twine upload --repository-url 'https://test.pypi.org/legacy/' -u $TESTPYPI_USER -p $TESTPYPI_PASS dist/*
  environment:
    name: testpypi-production
    url: https://test.pypi.org/project/obci-readmanager/
  tags:
    - docker