forked from CenturyLinkCloud/clc-ansible-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
75 lines (70 loc) · 3.63 KB
/
build.py
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
34
35
36
37
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
# Copyright 2015 CenturyLink
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pybuilder.core import init, use_plugin, Author, before
# declare specific plugins we need to use:
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin("filter_resources")
use_plugin("copy_resources")
use_plugin("source_distribution")
use_plugin("python.sonarqube")
use_plugin("exec")
# define project level attributes:
name = 'clc-ansible-module'
version = '1.1.16'
summary = "Centurylink Cloud Ansible Modules"
description = "Ansible extension modules which allow users to interact with Centurylink Cloud to define and manage cloud components."
authors = [Author ("CenturyLink Cloud", "[email protected]")]
url = 'http://www.centurylinkcloud.com'
license = "CTL Corporate License"
keywords = "centurylink cloud clc ansible modules"
# targets are:
# clean compile_sources init package prepare
# publish run_integration_tests run_unit_tests verify
default_task="publish"
@init
def initialize( project ):
# define unit test preferences and behavours:
# project.set_property("run_unit_tests_command", "export PYTHONPATH=%s:$PYTHONPATH nosetests -w src/unittest/python" % project.expand_path("$dir_source_main_python"))
project.set_property("run_unit_tests_command", "export PYTHONPATH=$PYTHONPATH:%s;PYTHONPATH=src/main/python nosetests -w %s --exe -v --with-xunit --xunit-file=target/reports/nosetests_results.xml" % (project.expand_path("$dir_source_main_python"), project.expand_path("$dir_source_unittest_python")))
project.set_property("run_unit_tests_propagate_stdout", True)
project.set_property("run_unit_tests_propagate_stderr", True)
project.set_property('unittest_module_glob','test_*')
project.set_property('coverage_threshold_warn',0)
project.set_property('coverage_break_build', False)
# ----------------
# identify all the module source locations:
project.get_property('filter_resources_glob').append('**/clc_ansible_module/*.py')
# ----------------
# install clc-sdk during installation
project.depends_on("clc-sdk", "==2.45")
# ----------------
# execute some installation scripts
project.set_property('dir_source_main_scripts', 'src/main/python')
# ----------------
project.set_property('sonar.projectKey', 'com.ctlts:clc-ansible-module')
project.set_property('sonar.projectName', name)
project.set_property('sonar.projectVersion', version)
project.set_property('sonar.sources','src/main/python/clc-ansible-module')
project.set_property('sonar.tests','src/unittests')
project.set_property('sonar.python.coverage.reportPath','target/reports/coverage.xml')
project.set_property('sonar.python.coveragePlugin','cobertura')
# identify resource files which should be part of the distribution
# TODO: would like to include the exampls in the distro but it is currently not working as expected.
# project.set_property('copy_resources_target', '$dir_target')
# project.get_property('copy_resources_glob').append('**/example-playbooks/__init__.py')
# project.include_file('clc-ansible-module-0.0.4','deploy-servers-to-maint-grp-size.yml')
# ----------------