collect_reports.sh 743 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. # Save all important reports into (project-root)/reports
  3. # This folder will be saved by circleci and available after test runs.
  4. set -e
  5. #Enable '**' support
  6. shopt -s globstar
  7. REPORTS_DIR=./reports
  8. mkdir -p $REPORTS_DIR >/dev/null 2>&1
  9. cp /tmp/hs_err_pid*.log $REPORTS_DIR || true
  10. function save_reports () {
  11. project_to_save=$1
  12. echo "saving reports for $project_to_save"
  13. report_path=$REPORTS_DIR/$project_to_save
  14. mkdir -p $report_path
  15. cp -r workspace/$project_to_save/build/reports/* $report_path/
  16. }
  17. shopt -s globstar
  18. for report_path in workspace/**/build/reports; do
  19. report_path=${report_path//workspace\//}
  20. report_path=${report_path//\/build\/reports/}
  21. save_reports $report_path
  22. done