flaky-friend 0.2.1 → 0.3.0
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/flaky/commands/fetch.rb +2 -1
- data/lib/flaky/commands/history.rb +4 -3
- data/lib/flaky/commands/rank.rb +1 -0
- data/lib/flaky/database.rb +7 -2
- data/lib/flaky/providers/base.rb +1 -1
- data/lib/flaky/providers/github_actions.rb +2 -1
- data/lib/flaky/providers/semaphore.rb +1 -0
- data/lib/flaky/repository.rb +7 -5
- data/lib/flaky/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c996492175a4e470f3ea4c08890a4626c90e4de13e35e33a1d919ef41a5b04b6
|
|
4
|
+
data.tar.gz: a7a08059d87983af6e0b163177cee5db2f659201f92267a338355e6b6df71024
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7282d21702ca0d52b80c74c01dc6bf8fce827f4543bd082a45f57d2080b04d9cbc8b866b10aee1352a74ca1f0279cc3ba73d1baed98911b6843428bb5a184662
|
|
7
|
+
data.tar.gz: 5201e17baf1732b2cd21879c391021ba96d0a38a0a9b59970225c6b8f2cba52aaf4b72697e6ac052d9af17cc67bbb28336eb3685dcbb19e2daa0e1ef721e743b
|
data/lib/flaky/commands/fetch.rb
CHANGED
|
@@ -60,7 +60,8 @@ module Flaky
|
|
|
60
60
|
|
|
61
61
|
@repo.insert_ci_run(
|
|
62
62
|
workflow_id: wf[:id], pipeline_id: wf[:pipeline_id],
|
|
63
|
-
branch: wf[:branch], result: pipeline_result, created_at: wf[:created_at]
|
|
63
|
+
branch: wf[:branch], result: pipeline_result, created_at: wf[:created_at],
|
|
64
|
+
commit_sha: wf[:commit_sha]
|
|
64
65
|
)
|
|
65
66
|
|
|
66
67
|
puts "#{jobs.length} test jobs (#{pipeline_result})"
|
|
@@ -22,11 +22,12 @@ module Flaky
|
|
|
22
22
|
first = rows.first
|
|
23
23
|
puts "Failure history for #{first['spec_file']}:#{first['line_number']}"
|
|
24
24
|
puts " #{first['description']}\n\n"
|
|
25
|
-
puts format("%-20s %-8s %-30s %s", "Date", "Seed", "Job", "Workflow")
|
|
26
|
-
puts "-" *
|
|
25
|
+
puts format("%-20s %-8s %-10s %-30s %s", "Date", "Seed", "Commit", "Job", "Workflow")
|
|
26
|
+
puts "-" * 110
|
|
27
27
|
|
|
28
28
|
rows.each do |row|
|
|
29
|
-
|
|
29
|
+
sha = row["commit_sha"] ? row["commit_sha"][0..6] : " "
|
|
30
|
+
puts format("%-20s %-8d %-10s %-30s %s", row["failed_at"], row["seed"], sha, row["job_name"], row["workflow_id"])
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
puts "\nTotal failures: #{rows.length}"
|
data/lib/flaky/commands/rank.rb
CHANGED
data/lib/flaky/database.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "sqlite3"
|
|
|
4
4
|
|
|
5
5
|
module Flaky
|
|
6
6
|
class Database
|
|
7
|
-
SCHEMA_VERSION =
|
|
7
|
+
SCHEMA_VERSION = 2
|
|
8
8
|
|
|
9
9
|
def initialize(path = nil)
|
|
10
10
|
@path = path || Flaky.configuration.resolved_db_path
|
|
@@ -87,9 +87,14 @@ module Flaky
|
|
|
87
87
|
CREATE INDEX IF NOT EXISTS idx_ci_runs_branch ON ci_runs(branch);
|
|
88
88
|
CREATE INDEX IF NOT EXISTS idx_job_results_workflow ON job_results(workflow_id);
|
|
89
89
|
|
|
90
|
-
PRAGMA user_version =
|
|
90
|
+
PRAGMA user_version = 2;
|
|
91
91
|
SQL
|
|
92
92
|
end
|
|
93
|
+
|
|
94
|
+
if version < 2
|
|
95
|
+
db.execute("ALTER TABLE ci_runs ADD COLUMN commit_sha TEXT")
|
|
96
|
+
db.execute("PRAGMA user_version = 2")
|
|
97
|
+
end
|
|
93
98
|
end
|
|
94
99
|
end
|
|
95
100
|
end
|
data/lib/flaky/providers/base.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Flaky
|
|
|
10
10
|
def fetch_workflows(age: "24h")
|
|
11
11
|
cutoff = Time.now - AgeParser.to_seconds(age)
|
|
12
12
|
|
|
13
|
-
output = run_cmd("gh run list --branch #{config.branch} --limit 100 --json databaseId,conclusion,createdAt,headBranch,workflowName")
|
|
13
|
+
output = run_cmd("gh run list --branch #{config.branch} --limit 100 --json databaseId,conclusion,createdAt,headBranch,headSha,workflowName")
|
|
14
14
|
runs = JSON.parse(output)
|
|
15
15
|
|
|
16
16
|
runs.filter_map do |run|
|
|
@@ -21,6 +21,7 @@ module Flaky
|
|
|
21
21
|
id: run["databaseId"].to_s,
|
|
22
22
|
pipeline_id: run["databaseId"].to_s,
|
|
23
23
|
branch: run["headBranch"],
|
|
24
|
+
commit_sha: run["headSha"],
|
|
24
25
|
result: map_conclusion(run["conclusion"]),
|
|
25
26
|
created_at: run["createdAt"]
|
|
26
27
|
}
|
data/lib/flaky/repository.rb
CHANGED
|
@@ -18,10 +18,10 @@ module Flaky
|
|
|
18
18
|
!!connection.get_first_value("SELECT 1 FROM ci_runs WHERE workflow_id = ?", workflow_id)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def insert_ci_run(workflow_id:, pipeline_id:, branch:, result:, created_at:)
|
|
21
|
+
def insert_ci_run(workflow_id:, pipeline_id:, branch:, result:, created_at:, commit_sha: nil)
|
|
22
22
|
connection.execute(
|
|
23
|
-
"INSERT INTO ci_runs (workflow_id, pipeline_id, branch, result, created_at) VALUES (?, ?, ?, ?, ?)",
|
|
24
|
-
[workflow_id, pipeline_id, branch, result, created_at]
|
|
23
|
+
"INSERT INTO ci_runs (workflow_id, pipeline_id, branch, result, created_at, commit_sha) VALUES (?, ?, ?, ?, ?, ?)",
|
|
24
|
+
[workflow_id, pipeline_id, branch, result, created_at, commit_sha]
|
|
25
25
|
)
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -53,7 +53,8 @@ module Flaky
|
|
|
53
53
|
tf.description,
|
|
54
54
|
COUNT(*) as failure_count,
|
|
55
55
|
MAX(tf.failed_at) as last_failure,
|
|
56
|
-
GROUP_CONCAT(DISTINCT tf.seed) as seeds
|
|
56
|
+
GROUP_CONCAT(DISTINCT tf.seed) as seeds,
|
|
57
|
+
GROUP_CONCAT(DISTINCT cr.commit_sha) as commit_shas
|
|
57
58
|
FROM test_failures tf
|
|
58
59
|
JOIN ci_runs cr ON cr.workflow_id = tf.workflow_id
|
|
59
60
|
WHERE cr.branch = ?
|
|
@@ -91,7 +92,8 @@ module Flaky
|
|
|
91
92
|
tf.job_name,
|
|
92
93
|
tf.branch,
|
|
93
94
|
tf.failed_at,
|
|
94
|
-
cr.workflow_id
|
|
95
|
+
cr.workflow_id,
|
|
96
|
+
cr.commit_sha
|
|
95
97
|
FROM test_failures tf
|
|
96
98
|
JOIN ci_runs cr ON cr.workflow_id = tf.workflow_id
|
|
97
99
|
WHERE #{conditions.join(" AND ")}
|
data/lib/flaky/version.rb
CHANGED