Commit 792670f4 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Merge knapsack reports and upload them to external server

parent 95c3a927
......@@ -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:
......
#!/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}."
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment