Commit c4ffdc17 authored by Carlo Baffa's avatar Carlo Baffa
Browse files

Merge branch 'publish_python_package' into 'master'

Publish python package

See merge request ska-telescope/csp-lmc-subelement!6
parents 732b22a0 63f6ed20
Loading
Loading
Loading
Loading
Loading
+41 −5
Original line number Diff line number Diff line
# GitLab CI in conjunction with GitLab Runner can use Docker Engine to test and build any application.
# Docker, when used with GitLab CI, runs each job in a separate and isolated container using the predefined image that is set up in .gitlab-ci.yml.
# In this case we use the latest python docker image to build and test this project.
image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest
image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:9.3.2

# cache is used to specify a list of files and directories which should be cached between jobs. You can only use paths that are within the project workspace.
# If cache is defined outside the scope of jobs, it means it is set globally and all jobs will use that definition
@@ -16,7 +16,9 @@ before_script:
stages:
  - test
  - linting
  - deploy
  - build
  - publish
  - pages 

# The YAML file defines a set of jobs with constraints stating when they should be run. 
# You can specify an unlimited number of jobs which are defined as top-level elements with an arbitrary name and always
@@ -26,8 +28,8 @@ stages:
#  job. TODO: possibly a candidate for refactor / renaming later on.
test:
  stage: test
#  tags:
#   - docker-executor
  tags:
   - docker-executor
  script:
  #  - pipenv run python setup.py test
   - python3 setup.py test
@@ -39,6 +41,8 @@ test:

list_dependencies:
  stage: test
  tags:
   - docker-executor
  script:
    # - pipenv graph >> pipenv_deps.txt
    - pipdeptree --json >> pip_deps.json
@@ -66,8 +70,40 @@ linting:
    paths:
      - ./build

build_dev_package:
  stage: build
  tags:
    - docker-executor
  script:
    - python3 setup.py egg_info -b+dev.$CI_COMMIT_SHORT_SHA sdist bdist_wheel
  artifacts:
    paths:
      - ./dist

build_package:
  stage: build
  tags:
    - docker-executor
  script:
    - python setup.py egg_info -b.$CI_COMMIT_SHORT_SHA sdist bdist_wheel
  only: [master]
  artifacts:
    paths:
      - ./dist

publish_package:        
  stage: publish
  tags:
    - docker-executor
  variables:
    TWINE_USERNAME: $TWINE_USERNAME
    TWINE_PASSWORD: $TWINE_PASSWORD
  script:
    - pip3 install twine
    - twine upload --repository-url $PYPI_REPOSITORY_URL dist/*

pages:
  stage: deploy
  stage: pages 
  tags:
   - docker-executor
  dependencies:
+1 −1
Original line number Diff line number Diff line
@@ -15,4 +15,4 @@ sphinx-rtd-theme
sphinxcontrib-websupport
pipdeptree
pylint_junit
csp-lmc-common >= 0.5.3
csp-lmc-common < 0.6.0
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ setup(
    install_requires=[
        'pytango >=9.3.1',
        'future',
        'csp-lmc-common',
        'csp-lmc-common < 0.6.0',
    ],  
    setup_requires=[
        # dependency for `python setup.py test`
+0 −3
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ class TestCspSubElementMaster(object):
        # reinitialize the device to return to
        # adminMode =ONLINE and State=INIT
        tango_context.device.Init()
        time.sleep(2)
        assert tango_context.device.adminMode == AdminMode.ONLINE
        assert tango_context.device.State() == DevState.INIT
        with pytest.raises(DevFailed) as df:
@@ -257,8 +256,6 @@ class TestCspSubElementMaster(object):
        tango_context.device.onCmdDurationExpected = 20
        tango_context.device.offCmdDurationExpected = 20
        tango_context.device.standbyCmdDurationExpected = 20
        # wait to let the polling thread update the attrs value
        time.sleep(3)
        assert tango_context.device.onCmdDurationExpected == 20
        assert tango_context.device.offCmdDurationExpected == 20
        assert tango_context.device.standbyCmdDurationExpected == 20
+0 −2
Original line number Diff line number Diff line
@@ -190,8 +190,6 @@ class TestCspSubElementSubarray(object):
    def test_set_command_duration_expected(self, tango_context):
        """Test xxxCmdDurationExpected attributes"""
        tango_context.device.goToIdleDurationExpected = 20
        # wait to let the polling thread update the attrs value
        time.sleep(3)
        assert tango_context.device.goToIdleDurationExpected == 20