optimal-ci 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/optimal/ci.rb +1 -0
- data/lib/optimal/ci/logger.rb +11 -0
- data/lib/optimal/ci/queue.rb +11 -1
- data/lib/optimal/ci/runner.rb +18 -5
- data/lib/optimal/ci/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2318277197a7ce20da7a7258789259644f06023b02710fff36f3b88729fde7f3
|
4
|
+
data.tar.gz: 4b33a271f965c9f5a11129eddc5c9949c1cb59d6f43e931a3b901bbbac084b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 796b3d64090a9d1dde4565098fe4b506e8d1e847f0d12d6ffba51c808aabb7db5a9eaf4712b785042f13d63adfd8aaac4691cb6c0a91fb90521c6cd516a0dcc6
|
7
|
+
data.tar.gz: 10be10ba8eb411613e861502f23f60579460316962201d5e5e15a72f41667bfc477893c339d4518c65aace42d76b0b4a0f6d1dec05a0abc364fbd546038aff28
|
data/Gemfile.lock
CHANGED
data/lib/optimal/ci.rb
CHANGED
data/lib/optimal/ci/queue.rb
CHANGED
@@ -14,7 +14,8 @@ module Optimal
|
|
14
14
|
build_number: @provider.build_number,
|
15
15
|
total_files: files,
|
16
16
|
ci: @provider.name,
|
17
|
-
command_arguments_string: @command_arguments_string
|
17
|
+
command_arguments_string: @command_arguments_string,
|
18
|
+
total_nodes: @provider.total_nodes
|
18
19
|
}
|
19
20
|
|
20
21
|
response = ::RestClient.post(ENV['OPTIMAL_CI_URL'] + '/builds', params, { Authorization: ENV['OPTIMAL_CI_TOKEN'] })
|
@@ -34,6 +35,15 @@ module Optimal
|
|
34
35
|
rescue RestClient::NotFound
|
35
36
|
return nil
|
36
37
|
end
|
38
|
+
|
39
|
+
def report_duration(duration)
|
40
|
+
params = {
|
41
|
+
duration: duration,
|
42
|
+
node_index: @provider.node_index
|
43
|
+
}
|
44
|
+
|
45
|
+
::RestClient.patch(ENV['OPTIMAL_CI_URL'] + "/builds/#{@provider.build_number}/report_duration", params, { Authorization: ENV['OPTIMAL_CI_TOKEN'] })
|
46
|
+
end
|
37
47
|
end
|
38
48
|
end
|
39
49
|
end
|
data/lib/optimal/ci/runner.rb
CHANGED
@@ -14,12 +14,25 @@ module Optimal
|
|
14
14
|
|
15
15
|
def run
|
16
16
|
provider = Optimal::CI::Provider.detect
|
17
|
-
queue = Optimal::CI::Queue.new(provider, @command_arguments_string)
|
18
17
|
|
19
|
-
|
18
|
+
if provider
|
19
|
+
queue = Optimal::CI::Queue.new(provider, @command_arguments_string)
|
20
|
+
queue.push(total_files)
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
start_time = Time.now.to_i
|
23
|
+
|
24
|
+
while files = queue.pop
|
25
|
+
system("#{command} #{files.join(' ')}")
|
26
|
+
end
|
27
|
+
|
28
|
+
duration = Time.now.to_i - start_time
|
29
|
+
|
30
|
+
queue.report_duration(duration)
|
31
|
+
|
32
|
+
Optimal::CI::Logger.info("reporting duration : #{duration}")
|
33
|
+
else
|
34
|
+
Optimal::CI::Logger.info("provider not found")
|
35
|
+
system("#{command} #{@args.join(' ')}")
|
23
36
|
end
|
24
37
|
end
|
25
38
|
|
@@ -32,7 +45,7 @@ module Optimal
|
|
32
45
|
if path.end_with?(files_end_with)
|
33
46
|
@total_files << path
|
34
47
|
else
|
35
|
-
@total_files << Dir.glob("#{path}/**/*#{files_end_with}")
|
48
|
+
@total_files << Dir.glob("#{path.chomp("/")}/**/*#{files_end_with}")
|
36
49
|
end
|
37
50
|
end
|
38
51
|
|
data/lib/optimal/ci/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optimal-ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mohsen Alizadeh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- bin/setup
|
58
58
|
- exe/optimal-rspec
|
59
59
|
- lib/optimal/ci.rb
|
60
|
+
- lib/optimal/ci/logger.rb
|
60
61
|
- lib/optimal/ci/provider.rb
|
61
62
|
- lib/optimal/ci/provider/base.rb
|
62
63
|
- lib/optimal/ci/provider/circle.rb
|