milou 0.0.9 → 1.0.1
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/lib/watchdog/detox.rb +21 -28
- data/lib/watchdog/utils.rb +4 -4
- data/lib/watchdog/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4be82578a6455e2a956a342787142d11877e559ebe7470131b0d3dc5f8817c7e
|
4
|
+
data.tar.gz: 16e13904db4cfdd71cf56f902d8b5ce54b9fabe45e55590d8e0a4fc901295419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4300c4c297c0066c6702a011b66f8e5ed6af9993605f08d3f7fc9e4c69e66e2a4db996a68b98b41a8e3a8a9708f3f2f8de9d00527cb6b650080b99c4ec31ff18
|
7
|
+
data.tar.gz: 5b424fd13b097eefc374555f015c35471b1741c5425332654214b69ad1eab5665f862afc3916b737b2ca76e0da928e6df19a3838f17e0f4d69b9b4d521e34ce4
|
data/lib/watchdog/detox.rb
CHANGED
@@ -10,40 +10,32 @@ module Watchdog
|
|
10
10
|
def run
|
11
11
|
build_detox
|
12
12
|
|
13
|
-
|
13
|
+
detox_out, detox_err = run_detox
|
14
14
|
|
15
|
-
run_watchdog(
|
15
|
+
run_watchdog(detox_out, detox_err)
|
16
16
|
end
|
17
17
|
|
18
18
|
def build_detox
|
19
19
|
detox_cmd = 'yarn run detox-build'
|
20
20
|
|
21
|
-
Watchdog::Utils.run_cmd
|
22
|
-
|
23
|
-
# %x[ #{detox_cmd} 2>&1 ]
|
21
|
+
Watchdog::Utils.run_cmd(detox_cmd)
|
24
22
|
end
|
25
23
|
|
26
24
|
# Detox runner
|
27
25
|
def run_detox
|
28
26
|
detox_cmd = 'yarn run detox-test'
|
29
27
|
|
30
|
-
Watchdog::Utils.run_cmd(detox_cmd)
|
31
|
-
|
32
|
-
# %x[ #{detox_cmd} 2>&1 ]
|
28
|
+
Watchdog::Utils.run_cmd(detox_cmd)
|
33
29
|
end
|
34
30
|
|
35
31
|
# Watchdog runner
|
36
|
-
def run_watchdog(
|
32
|
+
def run_watchdog(detox_out, detox_err)
|
37
33
|
|
38
34
|
status_regex = /(FAIL|PASS) (.*\.js) \((.*)\)/
|
39
35
|
|
40
|
-
commit_branch = Watchdog::Utils.run_cmd('git symbolic-ref --short HEAD').chomp
|
41
|
-
commit_sha = Watchdog::Utils.run_cmd('git --no-pager show -s --format=%H').chomp
|
42
|
-
commit_timestamp = Watchdog::Utils.run_cmd('git --no-pager log -1 --format=%cd').chomp
|
43
|
-
|
44
|
-
# commit_branch = %x[ #{'git symbolic-ref --short HEAD'} 2>&1 ]
|
45
|
-
# commit_sha = %x[ #{'git --no-pager show -s --format=%H'} 2>&1 ]
|
46
|
-
# commit_timestamp = %x[ #{'git --no-pager log -1 --format=%cd'} 2>&1 ]
|
36
|
+
commit_branch = Watchdog::Utils.run_cmd('git symbolic-ref --short HEAD')[0].chomp
|
37
|
+
commit_sha = Watchdog::Utils.run_cmd('git --no-pager show -s --format=%H')[0].chomp
|
38
|
+
commit_timestamp = Watchdog::Utils.run_cmd('git --no-pager log -1 --format=%cd')[0].chomp
|
47
39
|
|
48
40
|
run = {
|
49
41
|
test_run: {
|
@@ -55,16 +47,18 @@ module Watchdog
|
|
55
47
|
}
|
56
48
|
}
|
57
49
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
50
|
+
[detox_out, detox_err].each do |output|
|
51
|
+
output&.chomp&.each_line do |line|
|
52
|
+
line_match = line.match(status_regex)
|
53
|
+
|
54
|
+
if line_match
|
55
|
+
run[:test_run][:test_results] << {
|
56
|
+
status: line_match[1],
|
57
|
+
test: line_match[2],
|
58
|
+
time: line_match[3]
|
59
|
+
}
|
60
|
+
puts "Status: #{line_match[1]} | Test: #{line_match[2]} | Time: #{line_match[3]}"
|
61
|
+
end
|
68
62
|
end
|
69
63
|
end
|
70
64
|
|
@@ -72,8 +66,7 @@ module Watchdog
|
|
72
66
|
'Content-Type' => 'application/json',
|
73
67
|
'X-API-KEY' => ENV['WATCHDOG_AUTH_TOKEN']
|
74
68
|
}
|
75
|
-
|
76
|
-
puts run
|
69
|
+
|
77
70
|
response = HTTParty.post(
|
78
71
|
ENV['WATCHDOG_API_URL'],
|
79
72
|
:body => run.to_json,
|
data/lib/watchdog/utils.rb
CHANGED
@@ -6,12 +6,12 @@ module Watchdog
|
|
6
6
|
if $watchdog_relative_dir
|
7
7
|
Dir.chdir($watchdog_relative_dir){
|
8
8
|
# %x[ #{cmd} ]
|
9
|
-
|
10
|
-
return
|
9
|
+
out, err, _sts = Open3.capture3(cmd)
|
10
|
+
return out, err
|
11
11
|
}
|
12
12
|
else
|
13
|
-
|
14
|
-
return
|
13
|
+
out, err, _sts = Open3.capture3(cmd)
|
14
|
+
return out, err
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/watchdog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milou
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
88
|
+
rubygems_version: 3.0.6
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Watchdog SDK
|