|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 6 | +repo_root="$(cd "${script_dir}/.." && pwd)" |
| 7 | +project_dir="${1:-${repo_root}}" |
| 8 | +timestamp="$(date +%Y-%m-%dT%H-%M-%S)" |
| 9 | +report_root="${RALPH_RELEASE_GATE_OUTDIR:-${project_dir}/.ralph-runtime/reports/release-gate}" |
| 10 | +report_dir="${report_root}/${timestamp}" |
| 11 | +latest_dir="${report_root}/latest" |
| 12 | + |
| 13 | +mkdir -p "${report_dir}" |
| 14 | +rm -rf "${latest_dir}" |
| 15 | +mkdir -p "${latest_dir}" |
| 16 | + |
| 17 | +run_step() { |
| 18 | + local name="$1" |
| 19 | + shift |
| 20 | + local logfile="${report_dir}/${name}.log" |
| 21 | + echo "==> ${name}" | tee -a "${report_dir}/summary.log" |
| 22 | + if "$@" >"${logfile}" 2>&1; then |
| 23 | + echo "status: pass" | tee -a "${report_dir}/summary.log" |
| 24 | + echo "${name}=pass" >>"${report_dir}/results.env" |
| 25 | + else |
| 26 | + echo "status: fail" | tee -a "${report_dir}/summary.log" |
| 27 | + echo "${name}=fail" >>"${report_dir}/results.env" |
| 28 | + return 1 |
| 29 | + fi |
| 30 | +} |
| 31 | + |
| 32 | +pushd "${repo_root}" >/dev/null |
| 33 | + |
| 34 | +run_step internal_tests env GOCACHE=/tmp/ralph-gocache CGO_ENABLED=0 go test ./internal/ralph -count=1 |
| 35 | +run_step cli_tests env GOCACHE=/tmp/ralph-gocache CGO_ENABLED=0 go test ./cmd/ralphctl/... -count=1 |
| 36 | +run_step eval env GOCACHE=/tmp/ralph-gocache CGO_ENABLED=0 go run ./cmd/ralphctl --project-dir "${project_dir}" eval |
| 37 | +run_step intent_eval env GOCACHE=/tmp/ralph-gocache CGO_ENABLED=0 go run ./cmd/ralphctl --project-dir "${project_dir}" cp intent-eval |
| 38 | +run_step competitive_eval env GOCACHE=/tmp/ralph-gocache CGO_ENABLED=0 go run ./cmd/ralphctl --project-dir "${project_dir}" cp competitive-eval |
| 39 | + |
| 40 | +popd >/dev/null |
| 41 | + |
| 42 | +cat >"${report_dir}/summary.md" <<EOF |
| 43 | +# Public Release Gate Summary |
| 44 | +
|
| 45 | +- date: \`${timestamp}\` |
| 46 | +- repo_root: \`${repo_root}\` |
| 47 | +- project_dir: \`${project_dir}\` |
| 48 | +
|
| 49 | +## Results |
| 50 | +
|
| 51 | +\`\`\`text |
| 52 | +$(cat "${report_dir}/results.env") |
| 53 | +\`\`\` |
| 54 | +
|
| 55 | +## Attachments |
| 56 | +
|
| 57 | +- \`internal_tests.log\` |
| 58 | +- \`cli_tests.log\` |
| 59 | +- \`eval.log\` |
| 60 | +- \`intent_eval.log\` |
| 61 | +- \`competitive_eval.log\` |
| 62 | +EOF |
| 63 | + |
| 64 | +cp "${report_dir}/summary.md" "${latest_dir}/summary.md" |
| 65 | +cp "${report_dir}/summary.log" "${latest_dir}/summary.log" |
| 66 | +cp "${report_dir}/results.env" "${latest_dir}/results.env" |
| 67 | +cp "${report_dir}"/*.log "${latest_dir}/" |
| 68 | + |
| 69 | +cat <<EOF |
| 70 | +release_gate_report_dir=${report_dir} |
| 71 | +release_gate_latest_dir=${latest_dir} |
| 72 | +release_gate_summary=${latest_dir}/summary.md |
| 73 | +EOF |
0 commit comments