Files
findutils/.github/workflows/comment.yml
Sylvestre Ledru bb6a5ba53e ci: per-test GNU/bfs comparison and comment, like uutils sed/grep
The old comparison only commented when the PASS/FAIL/ERROR/SKIP *counts*
changed vs main, so it was blind to net-zero changes (one test fixed, one
broken). diff-gnu.sh also compared against an unextracted (empty) baseline,
flagging every current failure as a regression, and the published baseline
could be stale.

Adopt the sed/grep design:

- build-gnu.sh / build-bfs.sh now emit a per-test JSON summary
  (findutils-gnu-full-result.json / bfs-full-result.json) listing every
  test's name + PASS/FAIL/SKIP, via the new gnu_json_result.py /
  bfs_json_result.py.
- compare_test_results.py diffs the set of failing test names against a
  reference, writing a human-readable result file (empty when nothing
  changed) and exiting non-zero only on new, non-intermittent failures.
- compat.yml fetches the reference *-full-result.json from the default
  branch's latest run (dawidd6/action-download-artifact) and uploads a
  comparison artifact per suite.
- comment.yml posts a PR comment whenever the comparison is non-empty,
  i.e. on any per-test improvement or regression regardless of net count.
- ignore-intermittent.txt lists known-flaky tests, reported but not
  failing the job.

Remove the superseded compare_gnu_result.py / compare_bfs_result.py /
diff-gnu.sh / diff-bfs.sh.
2026-06-13 09:10:55 +02:00

94 lines
3.0 KiB
YAML

on:
workflow_run:
workflows: [External-testsuites]
types: [completed]
name: Comment Test results on the PR
permissions: {}
jobs:
upload-pr-comment:
if: ${{ github.event.workflow_run.event == 'pull_request' }}
name: Upload PR comment
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: write
steps:
- name: Download comparison artifacts
uses: actions/github-script@v9
with:
script: |
let fs = require('fs');
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
for (let wanted of ["comment-gnu", "comment-bfs"]) {
let match = artifacts.data.artifacts.find((a) => a.name === wanted);
if (!match) {
console.log(`Artifact ${wanted} not found`);
continue;
}
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: match.id,
archive_format: 'zip',
});
fs.writeFileSync(`${{ github.workspace }}/${wanted}.zip`, Buffer.from(download.data));
}
- name: Extract artifacts
run: |
for a in comment-gnu comment-bfs; do
if test -f "$a.zip"; then
mkdir -p "$a"
unzip -o "$a.zip" -d "$a" || echo "Failed to unzip $a.zip"
fi
done
- name: Comment on PR
uses: actions/github-script@v9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
function read(path) {
try { return fs.readFileSync(path, 'utf8'); } catch (e) { return ''; }
}
// The PR number is written to NR by both jobs.
let nr = read('comment-gnu/NR').trim() || read('comment-bfs/NR').trim();
if (!nr) {
console.log('No PR number found; skipping comment');
return;
}
let gnu = read('comment-gnu/result-gnu.txt').trim();
let bfs = read('comment-bfs/result-bfs.txt').trim();
let sections = [];
if (gnu) sections.push('GNU findutils testsuite:\n```\n' + gnu + '\n```');
if (bfs) sections.push('bfs testsuite:\n```\n' + bfs + '\n```');
if (sections.length === 0) {
console.log('No test result changes; skipping comment');
return;
}
let body = 'Commit ${{ github.event.workflow_run.head_sha }} has test result changes:\n\n'
+ sections.join('\n\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number(nr),
body: body,
});