@@ -11,7 +11,7 @@ show_help() {
1111Usage: $SCRIPT_NAME <command> [options]
1212
1313Commands:
14- collect-data <toolchain> <test_output> [functional_output]
14+ collect-data <toolchain> <commit_sha> <commit_short> <github_repo> < test_output> [functional_output]
1515 Extract and store test data from CI outputs
1616
1717 aggregate <results_dir> <output_file>
@@ -27,7 +27,7 @@ Commands:
2727 Print clean TOML report
2828
2929Examples:
30- $SCRIPT_NAME collect-data gnu "\$ test_output" "\$ functional_output"
30+ $SCRIPT_NAME collect-data gnu "\$ COMMIT_SHA" " \$ COMMIT_SHORT" " \$ GITHUB_REPO" " \$ test_output" "\$ functional_output"
3131 $SCRIPT_NAME aggregate all-test-results test-summary.toml
3232 $SCRIPT_NAME format-comment test-summary.toml
3333 $SCRIPT_NAME post-comment test-summary.toml 123
3838# Data collection function
3939collect_data () {
4040 local toolchain=${1:- unknown}
41- local test_output=${2:- }
42- local functional_output=${3:- }
41+ local commit_sha=${2:- }
42+ local commit_short=${3:- }
43+ local github_repo=${4:- }
44+ local test_output=${5:- }
45+ local functional_output=${6:- }
4346
4447 if [ -z " $test_output " ]; then
4548 echo " Error: test_output required"
@@ -48,6 +51,9 @@ collect_data() {
4851
4952 mkdir -p test-results
5053 echo " $toolchain " > test-results/toolchain
54+ echo " $commit_sha " > test-results/commit_sha
55+ echo " $commit_short " > test-results/commit_short
56+ echo " $github_repo " > test-results/github_repo
5157
5258 # Extract app data
5359 echo " $test_output " | grep " APP_STATUS:" | sed ' s/APP_STATUS://' > test-results/apps_data || touch test-results/apps_data
@@ -103,6 +109,7 @@ aggregate_results() {
103109 llvm_build=" failed" llvm_crash=" failed" llvm_functional=" failed"
104110 overall=" failed"
105111 apps_data=" " functional_data=" " functional_criteria_data=" "
112+ commit_sha=" " commit_short=" " github_repo=" "
106113
107114 # Process artifacts
108115 for artifact_dir in " $results_dir " /test-results-* ; do
@@ -112,6 +119,13 @@ aggregate_results() {
112119 crash_exit=$( cat " $artifact_dir /crash_exit_code" 2> /dev/null || echo " 1" )
113120 functional_exit=$( cat " $artifact_dir /functional_exit_code" 2> /dev/null || echo " 1" )
114121
122+ # Read commit info from first artifact (same across all toolchains)
123+ if [ -z " $commit_sha " ]; then
124+ commit_sha=$( cat " $artifact_dir /commit_sha" 2> /dev/null || echo " " )
125+ commit_short=$( cat " $artifact_dir /commit_short" 2> /dev/null || echo " " )
126+ github_repo=$( cat " $artifact_dir /github_repo" 2> /dev/null || echo " " )
127+ fi
128+
115129 build_status=" passed"
116130 # Handle skipped tests
117131 if [ " $crash_exit " = " skipped" ]; then
@@ -174,6 +188,9 @@ aggregate_results() {
174188[summary]
175189status = "$overall "
176190timestamp = "$( date -Iseconds) "
191+ commit_sha = "$commit_sha "
192+ commit_short = "$commit_short "
193+ github_repo = "$github_repo "
177194
178195[info]
179196architecture = "riscv32"
@@ -275,6 +292,9 @@ format_comment() {
275292 # Extract basic info
276293 overall_status=$( get_value " summary" " status" " $toml_file " )
277294 timestamp=$( get_value " summary" " timestamp" " $toml_file " )
295+ commit_sha=$( get_value " summary" " commit_sha" " $toml_file " )
296+ commit_short=$( get_value " summary" " commit_short" " $toml_file " )
297+ github_repo=$( get_value " summary" " github_repo" " $toml_file " )
278298 gnu_build=$( get_value " gnu" " build" " $toml_file " )
279299 gnu_crash=$( get_value " gnu" " crash" " $toml_file " )
280300 gnu_functional=$( get_value " gnu" " functional" " $toml_file " )
@@ -283,11 +303,21 @@ format_comment() {
283303 llvm_functional=$( get_value " llvm" " functional" " $toml_file " )
284304
285305 # Generate comment
306+ # Build commit link if we have repo and SHA
307+ commit_info=" "
308+ if [ -n " $github_repo " ] && [ -n " $commit_sha " ] && [ -n " $commit_short " ]; then
309+ commit_url=" https://github.com/$github_repo /commit/$commit_sha "
310+ commit_info=" **Commit:** [\` $commit_short \` ]($commit_url )"
311+ else
312+ commit_info=" **Commit:** (not available)"
313+ fi
314+
286315 cat << EOF
287316## Linmo CI Test Results
288317
289318**Overall Status:** $( get_symbol " $overall_status " ) $overall_status
290319**Timestamp:** $timestamp
320+ $commit_info
291321
292322### Toolchain Results
293323
0 commit comments