From 9b9b19d144afa76019de79ab8751a4eb2f6ac930 Mon Sep 17 00:00:00 2001 From: Mohit Tomar Date: Tue, 11 Oct 2022 18:15:34 +0530 Subject: [PATCH 1/3] Added Jenkinsfile Signed-off-by: Mohit Tomar --- Jenkinsfile | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fbf230a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,62 @@ +timestamps { + node("ubuntu18-agent") { + catchError { + checkout scm + dir_exists = sh ( + script: "test -d 'tests' && echo 'Y' || echo 'N' ", + returnStdout: true + ).trim() + + if (dir_exists == 'N'){ + currentBuild.result= 'FAILURE' + echo "No tests directory found! Exiting." + return + } + + try { + stage("Prerequisites"){ + // Change to corresponding CORE_BRANCH as required + // e.g. FOGL-xxxx, main etc. + sh ''' + CORE_BRANCH='develop' + ${HOME}/buildFledge ${CORE_BRANCH} ${WORKSPACE} + ''' + } + } catch (e) { + currentBuild.result = 'FAILURE' + echo "Failed to build Fledge; required to run the tests!" + return + } + + try { + stage("Run Tests"){ + echo "Executing tests..." + sh ''' + . ${WORKSPACE}/PLUGIN_PR_ENV/bin/activate + export FLEDGE_ROOT=$HOME/fledge && export PYTHONPATH=$HOME/fledge/python + cd tests && python3 -m pytest -vv --ignore=system --ignore=api --junit-xml=test_result.xml + ''' + echo "Done." + } + } catch (e) { + result = "TESTS FAILED" + currentBuild.result = 'FAILURE' + echo "Tests failed!" + } + + try { + stage("Publish Test Report"){ + junit "tests/test_result.xml" + } + } catch (e) { + result = "TEST REPORT GENERATION FAILED" + currentBuild.result = 'FAILURE' + echo "Failed to generate test reports!" + } + } + stage ("Cleanup"){ + // Add here if any cleanup is required + echo "Done." + } + } +} From 9fca789cccc362b9536891f9d5ba827481766ea0 Mon Sep 17 00:00:00 2001 From: Mohit Tomar Date: Thu, 13 Oct 2022 20:26:38 +0530 Subject: [PATCH 2/3] Fixed module import path and updated requrements.sh file Signed-off-by: Mohit Tomar --- requirements.sh | 2 +- tests/__init__.py | 0 tests/test_north_s7_python.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 tests/__init__.py diff --git a/requirements.sh b/requirements.sh index f4d3726..9b08a82 100755 --- a/requirements.sh +++ b/requirements.sh @@ -46,7 +46,7 @@ elif apt --version 2>/dev/null; then sudo apt install -y wget sudo apt install -y p7zip wget --content-disposition -c https://sourceforge.net/projects/snap7/files/1.4.2/snap7-full-1.4.2.7z/download - p7zip -d snap7-full-1.4.2.7z + echo "A" |p7zip -d snap7-full-1.4.2.7z cd snap7-full-1.4.2/build/unix make -f "$(uname -m)_linux.mk" install else diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_north_s7_python.py b/tests/test_north_s7_python.py index e4ddd07..a2342c3 100644 --- a/tests/test_north_s7_python.py +++ b/tests/test_north_s7_python.py @@ -13,7 +13,7 @@ import logging from unittest.mock import patch, MagicMock, ANY -from fledge.plugins.north.s7_python import s7_python as s7 +from python.fledge.plugins.north.s7_python import s7_python as s7 import asyncio From 1cd98ecc9dbfd7e6273194ddb37f77292f26f8a4 Mon Sep 17 00:00:00 2001 From: dianomicbot Date: Thu, 20 Oct 2022 11:21:36 +0000 Subject: [PATCH 3/3] VERSION changed Signed-off-by: dianomicbot --- VERSION.north.s7_python | 2 +- python/fledge/plugins/north/s7_python/s7_python.py | 2 +- tests/test_north_s7_python.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.north.s7_python b/VERSION.north.s7_python index b56dd86..6b07320 100644 --- a/VERSION.north.s7_python +++ b/VERSION.north.s7_python @@ -1,2 +1,2 @@ -fledge_north_s7_python_version=2.0.0 +fledge_north_s7_python_version=2.0.1 fledge_version>=2.0 diff --git a/python/fledge/plugins/north/s7_python/s7_python.py b/python/fledge/plugins/north/s7_python/s7_python.py index 6b2f135..8806cd3 100644 --- a/python/fledge/plugins/north/s7_python/s7_python.py +++ b/python/fledge/plugins/north/s7_python/s7_python.py @@ -160,7 +160,7 @@ def plugin_info(): return { 'name': 's7_north_python', - 'version': '2.0.0', + 'version': '2.0.1', 'type': 'north', 'interface': '1.0', 'config': _DEFAULT_CONFIG diff --git a/tests/test_north_s7_python.py b/tests/test_north_s7_python.py index a2342c3..ac0d5af 100644 --- a/tests/test_north_s7_python.py +++ b/tests/test_north_s7_python.py @@ -119,7 +119,7 @@ def test_plugin_info(self): assert plugin_info == { 'name': 's7_north_python', - 'version': '2.0.0', + 'version': '2.0.1', 'type': 'north', 'interface': '1.0', 'config': s7._DEFAULT_CONFIG