1- desc "Starts all backing services and run all tests"
2- task :test do
3- sh "docker-compose up -d | cat"
4- begin
5- sh "tox"
6- ensure
7- sh "docker-compose kill"
8- end
9- sh "python -m tests.benchmark"
10- end
11-
12- desc 'CI dependent task; tests in parallel'
13- task :test_parallel do
14-
15- begin
16- test_cassandra = sh "git diff-tree --no-commit-id --name-only -r HEAD | grep ddtrace/contrib/cassandra"
17- rescue StandardError => e
18- test_cassandra = false
19- end
20-
21- sh "docker-compose up -d | cat"
22-
23- # If cassandra hasn't been changed ignore cassandra tests
24- if not test_cassandra
25- n_total_envs = `tox -l | grep -v cassandra | wc -l` . to_i
26- envs = 'tox -l | grep -v cassandra | tr \'\n\' \',\''
27- else
28- n_total_envs = `tox -l | wc -l` . to_i
29- envs = 'tox -l | tr \'\n\' \',\''
30- end
31-
32- circle_node_tot = ENV [ 'CIRCLE_NODE_TOTAL' ] . to_i
33- n_envs_chunk = n_total_envs / circle_node_tot
34- env_list_start = 1
35- env_list_end = n_envs_chunk
36- begin
37- for node_index in 0 ..circle_node_tot
38- if ENV [ 'CIRCLE_NODE_INDEX' ] . to_i == node_index then
39- # Node 0 already does as second task wait test, the others will require it to ensure db connections
40- if node_index >= 1 then
41- sh "tox -e wait"
42- end
43- sh "#{ envs } | cut -d, -f#{ env_list_start } -#{ env_list_end } | xargs tox -e"
44- end
45- env_list_start = env_list_end + 1
46- env_list_end = env_list_end + n_envs_chunk
47- end
48- ensure
49- sh "docker-compose kill"
50- end
51-
52- sh "python -m tests.benchmark"
53- end
54-
55- desc "Run tests with envs matching the given pattern."
56- task :"test:envs" , [ :grep ] do |t , args |
57- pattern = args [ :grep ]
58- if !pattern
59- puts 'specify a pattern like rake test:envs["py27.*mongo"]'
60- else
61- sh "tox -l | grep '#{ pattern } ' | xargs tox -e"
62- end
63- end
64-
65- namespace :docker do
66- task :up do
67- sh "docker-compose up -d | cat"
68- end
69-
70- task :down do
71- sh "docker-compose down"
72- end
73- end
74-
75-
76- desc "install the library in dev mode"
77- task :dev do
78- sh "pip uninstall -y ddtrace"
79- sh "pip install -e ."
80- end
81-
82- desc "remove artifacts"
83- task :clean do
84- sh 'python setup.py clean'
85- sh 'rm -rf build *egg* *.whl dist'
86- end
87-
881desc "build the docs"
892task :docs do
903 sh "pip install sphinx"
@@ -94,7 +7,6 @@ task :docs do
947end
958
969# Deploy tasks
97- S3_BUCKET = 'pypi.datadoghq.com'
9810S3_DIR = ENV [ 'S3_DIR' ]
9911
10012desc "release the a new wheel"
@@ -105,7 +17,8 @@ task :'release:wheel' do
10517 # - aws s3 cp dist/*.whl s3://pypi.datadoghq.com/#{s3_dir}/
10618 fail "Missing environment variable S3_DIR" if !S3_DIR or S3_DIR . empty?
10719
108- sh "mkwheelhouse s3://#{ S3_BUCKET } /#{ S3_DIR } / ."
20+ # Use custom mkwheelhouse script to build and upload an sdist to S3 bucket
21+ sh "scripts/mkwheelhouse"
10922end
11023
11124desc "release the docs website"
@@ -169,60 +82,3 @@ namespace :pypi do
16982 sh "twine upload #{ build } "
17083 end
17184end
172-
173- namespace :version do
174-
175- def get_version ( )
176- return `python setup.py --version` . strip ( )
177- end
178-
179- def set_version ( old , new )
180- branch = `git name-rev --name-only HEAD` . strip ( )
181- if branch != "master"
182- puts "you should only tag the master branch"
183- return
184- end
185- msg = "bumping version #{ old } => #{ new } "
186- path = "ddtrace/__init__.py"
187- sh "sed -i 's/#{ old } /#{ new } /' #{ path } "
188- sh "git commit -m '#{ msg } ' #{ path } "
189- sh "git tag v#{ new } "
190- puts "Verify everything looks good, then `git push && git push --tags`"
191- end
192-
193- def inc_version_num ( version , type )
194- split = version . split ( "." ) . map { |v | v . to_i }
195- if type == 'bugfix'
196- split [ 2 ] += 1
197- elsif type == 'minor'
198- split [ 1 ] += 1
199- split [ 2 ] = 0
200- elsif type == 'major'
201- split [ 0 ] += 1
202- split [ 1 ] = 0
203- split [ 2 ] = 0
204- end
205- return split . join ( "." )
206- end
207-
208- def inc_version ( type )
209- old = get_version ( )
210- new = inc_version_num ( old , type )
211- set_version ( old , new )
212- end
213-
214- desc "Cut a new bugfix release"
215- task :bugfix do
216- inc_version ( "bugfix" )
217- end
218-
219- desc "Cut a new minor release"
220- task :minor do
221- inc_version ( "minor" )
222- end
223-
224- task :major do
225- inc_version ( "major" )
226- end
227-
228- end
0 commit comments