summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml19
-rwxr-xr-xscripts/merge-reports29
2 files changed, 47 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf85820abdf..6fc410b4b51 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,6 +28,7 @@ before_script:
stages:
- prepare
- test
+- post-test
- notifications
prepare:
@@ -36,7 +37,7 @@ prepare:
USE_DB: "false"
script:
- bundle exec rake assets:precompile
- - mkdir knapsack/
+ - mkdir -p knapsack/
- echo "{}" > knapsack/rspec_report.json
- echo "{}" > knapsack/spinach_report.json
artifacts:
@@ -57,6 +58,22 @@ prepare:
paths:
- knapsack/
+post-tests:
+ stage: post-test
+ variables:
+ USE_DB: "false"
+ script:
+ - scripts/merge-reports knapsack/rspec_report.json knapsack/rspec_node_*.json
+ - scripts/merge-reports knapsack/spinach_report.json knapsack/spinach_node_*.json
+ - rm -f knapsack/*_node_*.json
+ cache:
+ key: "knapsack"
+ paths:
+ - knapsack/
+ artifacts:
+ paths:
+ - knapsack/
+
.exec: &exec
stage: test
script:
diff --git a/scripts/merge-reports b/scripts/merge-reports
new file mode 100755
index 00000000000..f7b574001ac
--- /dev/null
+++ b/scripts/merge-reports
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+
+require 'json'
+require 'yaml'
+
+main_report_file = ARGV.shift
+unless main_report_file
+ puts 'usage: merge_reports <main-report> [extra reports...]'
+ exit 1
+end
+
+puts "Loading #{main_report_file}..."
+main_report = JSON.parse(File.read(main_report_file))
+new_report = main_report.dup
+
+ARGV.each do |report_file|
+ report = JSON.parse(File.read(report_file))
+
+ # Remove existing values
+ updates = report.delete_if do |key, value|
+ main_report[key] && main_report[key] == value
+ end
+ new_report.merge!(updates)
+
+ puts "Merged #{report_file} adding #{updates.size} results."
+end
+
+File.write(main_report_file, JSON.pretty_generate(new_report))
+puts "Saved #{main_report_file}."