UCL/snappysonic

View on GitHub
.gitlab-ci.yml

Summary

Maintainability
Test Coverage
#Tell Gitlab to load these environental vars from the variables list
variables:
  PYPI_USER: SECURE
  PYPI_PASS: SECURE

stages:
  - build
  - test
  - deploy

# Define a template stage with common settings
# that can be extended by specific stages.
# The except block will skip this stage if the commit
# message contains [skip build]
.build-skip-template: &build-skip-template
  stage: build
  except:
    variables:
      - $CI_COMMIT_MESSAGE =~ /\[skip[ _-]build?\]/i

build docs:
  <<: *build-skip-template
  script:
    - tox -e docs
  tags:
    - shared-linux
  artifacts:
    paths:
      - doc/
    expire_in: 1 week

test Linux:
  stage: test
  variables:
    LD_LIBRARY_PATH: ${CI_PROJECT_DIR}/.tox/py36/lib/python3.6/site-packages/PySide2/Qt/plugins/platforms
    DISPLAY: localhost:1
  script:
    - tox
  tags:
    - shared-linux, gui
  coverage: '/^TOTAL.*\s+(\d+\%)$/'

test macOS:
  stage: test
  script:
    - tox
  tags:
    - shared-mac, gui

test Windows:
  stage: test
  script:
    - tox
  tags:
    - shared-win, gui

deploy pip to PyPI:
  stage: deploy
  when: manual
  only:
    - tags

  environment:
    name: PyPI
    url: https://pypi.python.org/pypi/snappytorsosimulator

  tags:
    - pip-production

  artifacts:
    paths:
      - dist/

  script:
    # Install packages required to build/publish
    # remove any previous distribution files
    - pip install wheel twine setuptools
    - rm -rf dist

    # bundle installer
    - python setup.py bdist_wheel

    # Upload to pypi
    - twine upload --repository pypi dist/* --username $PYPI_USER --password $PYPI_PASS