|
87 | 87 | cat tensorflow-core/tensorflow-core-api/.tf_configure.bazelrc |
88 | 88 |
|
89 | 89 | - name: Build Android ARM64 Native Libraries |
| 90 | + id: build_android |
90 | 91 | shell: bash |
91 | 92 | run: | |
92 | 93 | set -o pipefail |
@@ -114,6 +115,62 @@ jobs: |
114 | 115 | -am \ |
115 | 116 | package 2>&1 | tee "${GITHUB_WORKSPACE}/artifacts/build.log" |
116 | 117 |
|
| 118 | + - name: Summarize First Build Failure |
| 119 | + if: failure() && steps.build_android.outcome == 'failure' |
| 120 | + shell: bash |
| 121 | + run: | |
| 122 | + python3 - <<'PY' |
| 123 | + import re |
| 124 | + from pathlib import Path |
| 125 | +
|
| 126 | + log_path = Path("artifacts/build.log") |
| 127 | + if not log_path.exists(): |
| 128 | + print("::error::build.log was not produced") |
| 129 | + raise SystemExit(0) |
| 130 | +
|
| 131 | + lines = log_path.read_text(encoding="utf-8", errors="ignore").splitlines() |
| 132 | + patterns = [ |
| 133 | + re.compile(r"^(ERROR: .+)$"), |
| 134 | + re.compile(r"^(FAILED: .+)$"), |
| 135 | + re.compile(r"^(.+?:\d+(?::\d+)?: (?:fatal )?error: .+)$"), |
| 136 | + re.compile(r"^(.+?UnsatisfiedLinkError.+)$"), |
| 137 | + re.compile(r"^(.+?NoSuch.+)$"), |
| 138 | + ] |
| 139 | +
|
| 140 | + skip = ( |
| 141 | + "Failed to execute goal org.bytedeco:javacpp", |
| 142 | + "Execution javacpp-build of goal", |
| 143 | + "Process exited with an error: 1", |
| 144 | + "BUILD FAILURE", |
| 145 | + ) |
| 146 | +
|
| 147 | + hit = None |
| 148 | + for i, line in enumerate(lines): |
| 149 | + if any(token in line for token in skip): |
| 150 | + continue |
| 151 | + if any(p.search(line) for p in patterns): |
| 152 | + hit = i |
| 153 | + break |
| 154 | +
|
| 155 | + if hit is None: |
| 156 | + hit = max(0, len(lines) - 80) |
| 157 | +
|
| 158 | + start = max(0, hit - 8) |
| 159 | + end = min(len(lines), hit + 20) |
| 160 | + snippet = "\n".join(lines[start:end]).strip() |
| 161 | + if not snippet: |
| 162 | + snippet = "\n".join(lines[-40:]).strip() |
| 163 | +
|
| 164 | + summary_path = Path("artifacts/first_failure_summary.txt") |
| 165 | + summary_path.write_text(snippet + "\n", encoding="utf-8") |
| 166 | +
|
| 167 | + headline = lines[hit].strip() if lines else "Build failed without captured output" |
| 168 | + headline = headline.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A") |
| 169 | + print(f"::error::{headline[:400]}") |
| 170 | + print("First failure summary:") |
| 171 | + print(snippet) |
| 172 | + PY |
| 173 | +
|
117 | 174 | - name: Collect Artifacts |
118 | 175 | if: always() |
119 | 176 | shell: bash |
|
0 commit comments