From b28afb68725db2c570e4c219624d7b8feab3ae04 Mon Sep 17 00:00:00 2001 From: softir Date: Thu, 21 May 2020 09:02:14 +0200 Subject: [PATCH 1/6] publish_python_package: publish the python package under nexus repo. --- .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++++++++++-- tests/test_se_master.py | 3 --- tests/test_se_subarray.py | 2 -- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4bbc1e0..9152b0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 @@ -66,8 +68,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: + path: + - ./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: + path: + - ./dist + +publish: + 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: diff --git a/tests/test_se_master.py b/tests/test_se_master.py index f24cffd..e18d5d2 100644 --- a/tests/test_se_master.py +++ b/tests/test_se_master.py @@ -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 diff --git a/tests/test_se_subarray.py b/tests/test_se_subarray.py index 786d2d7..985b2b6 100644 --- a/tests/test_se_subarray.py +++ b/tests/test_se_subarray.py @@ -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 -- GitLab From 83fafd4b068897a56527f28fccd0571f2a85f28a Mon Sep 17 00:00:00 2001 From: softir Date: Thu, 21 May 2020 09:32:21 +0200 Subject: [PATCH 2/6] publish_python_package: fix bug in .gitalb-ci.yaml file. --- .gitlab-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9152b0e..30bb7ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -75,7 +75,7 @@ build_dev_package: script: - python3 setup.py egg_info -b+dev.$CI_COMMIT_SHORT_SHA sdist bdist_wheel artifacts: - path: + paths: - ./dist build_package: @@ -86,14 +86,14 @@ build_package: - python setup.py egg_info -b.$CI_COMMIT_SHORT_SHA sdist bdist_wheel only: [master] artifacts: - path: + paths: - ./dist -publish: - stage: publish - tags: - - docker-executor - variables: +publish_package: + stage: publish + tags: + - docker-executor + variables: TWINE_USERNAME: $TWINE_USERNAME TWINE_PASSWORD: $TWINE_PASSWORD script: -- GitLab From 4ee8e752fcc51c72ff44ff3a76bde1323f0acfc0 Mon Sep 17 00:00:00 2001 From: softir Date: Thu, 1 Oct 2020 12:45:50 +0200 Subject: [PATCH 3/6] The csp/subelement-classes relies on SKA Base Classes ver < 0.6.0. --- docker-requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-requirements.txt b/docker-requirements.txt index 92273ec..6379878 100644 --- a/docker-requirements.txt +++ b/docker-requirements.txt @@ -15,4 +15,4 @@ sphinx-rtd-theme sphinxcontrib-websupport pipdeptree pylint_junit -csp-lmc-common >= 0.5.3 +csp-lmc-common < 0.6.0 diff --git a/setup.py b/setup.py index ffdd470..985e838 100644 --- a/setup.py +++ b/setup.py @@ -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` -- GitLab From 36e5068927e195eb0adbf38c1cdd8605326141d9 Mon Sep 17 00:00:00 2001 From: softir Date: Thu, 1 Oct 2020 13:46:38 +0200 Subject: [PATCH 4/6] Use version number instead of latest for ska python docker image. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30bb7ee..d4db0f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ # 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 -- GitLab From 2187c7967b0b18b3ec5a5850c3e4a5e60b86d3ee Mon Sep 17 00:00:00 2001 From: softir Date: Thu, 1 Oct 2020 14:13:45 +0200 Subject: [PATCH 5/6] publish_python_package: add tags to test stage --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4db0f0..66049b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,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 -- GitLab From 63f6ed205f1aaaaf4c91d9043c9b6437dd300a45 Mon Sep 17 00:00:00 2001 From: softir Date: Thu, 1 Oct 2020 14:30:37 +0200 Subject: [PATCH 6/6] publish_python_package: try to fix issue in gitlab runners. --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 66049b3..0f78083 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,6 +41,8 @@ test: list_dependencies: stage: test + tags: + - docker-executor script: # - pipenv graph >> pipenv_deps.txt - pipdeptree --json >> pip_deps.json -- GitLab