Skip to content

Commit 01ebb66

Browse files
committed
Find universally skipped tests across wheel test configurations
1 parent 63ca53a commit 01ebb66

2 files changed

Lines changed: 286 additions & 110 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -433,116 +433,7 @@ jobs:
433433
env:
434434
GH_TOKEN: ${{ github.token }}
435435
run: |
436-
set -euo pipefail
437-
438-
REPO="${GITHUB_REPOSITORY}"
439-
WORKDIR=$(mktemp -d)
440-
trap 'rm -rf "${WORKDIR}"' EXIT
441-
442-
mkdir -p "${WORKDIR}/configs"
443-
444-
# Collect all jobs for this run and group matrix jobs into wheel
445-
# test configurations from ci.yml.
446-
jobs_json=$(gh api --paginate \
447-
"repos/${REPO}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=100" \
448-
| jq -s '[.[].jobs[]]')
449-
450-
declare -A CONFIG_PATTERNS=(
451-
[test-linux-64]='^Test linux-64 / '
452-
[test-linux-aarch64]='^Test linux-aarch64 / '
453-
[test-windows]='^Test (win-64|windows) / '
454-
)
455-
456-
configs=(
457-
test-linux-64
458-
test-linux-aarch64
459-
test-windows
460-
)
461-
462-
for cfg in "${configs[@]}"; do
463-
cfg_dir="${WORKDIR}/configs/${cfg}"
464-
mkdir -p "${cfg_dir}/logs"
465-
job_ids=$(echo "${jobs_json}" | jq -r \
466-
--arg pat "${CONFIG_PATTERNS[$cfg]}" \
467-
'.[] | select(.name | test($pat)) | .id')
468-
469-
if [[ -z "${job_ids}" ]]; then
470-
echo "No matrix jobs found for ${cfg}" >&2
471-
: > "${cfg_dir}/skipped.txt"
472-
continue
473-
fi
474-
475-
for job_id in ${job_ids}; do
476-
logfile="${cfg_dir}/logs/${job_id}.log"
477-
# Prefer the job log API; fall back to gh run view if needed.
478-
if ! gh api "repos/${REPO}/actions/jobs/${job_id}/logs" > "${logfile}" 2>/dev/null; then
479-
gh run view "${GITHUB_RUN_ID}" --job "${job_id}" --log > "${logfile}" || true
480-
fi
481-
done
482-
483-
# Extract pytest node IDs from SKIPPED lines. This tolerates
484-
# timestamped logs, ANSI escapes, and trailing skip reasons.
485-
grep -h 'SKIPPED' "${cfg_dir}/logs/"*.log 2>/dev/null \
486-
| sed -E 's/\x1B\[[0-9;]*[[:alpha:]]//g' \
487-
| sed 's#\\#/#g' \
488-
| sed -nE 's#.*(tests/[[:graph:]]+\.py::[^[:space:]]+).*SKIPPED.*#\1#p' \
489-
| sort -u > "${cfg_dir}/skipped.txt" || true
490-
491-
echo "${cfg}: $(wc -l < "${cfg_dir}/skipped.txt") skipped tests"
492-
done
493-
494-
{
495-
echo "## Universally-skipped tests"
496-
echo ""
497-
} >> "${GITHUB_STEP_SUMMARY}"
498-
499-
available_configs=0
500-
missing_configs=()
501-
for cfg in "${configs[@]}"; do
502-
if [[ -s "${WORKDIR}/configs/${cfg}/skipped.txt" || -n "$(ls -A "${WORKDIR}/configs/${cfg}/logs" 2>/dev/null || true)" ]]; then
503-
available_configs=$((available_configs + 1))
504-
else
505-
missing_configs+=("${cfg}")
506-
fi
507-
done
508-
509-
if [[ ${available_configs} -eq 0 ]]; then
510-
echo "_No test job logs found in this run._" >> "${GITHUB_STEP_SUMMARY}"
511-
exit 0
512-
fi
513-
514-
if [[ ${#missing_configs[@]} -gt 0 ]]; then
515-
{
516-
echo "_Warning: missing logs for configuration(s): ${missing_configs[*]}_"
517-
echo ""
518-
} >> "${GITHUB_STEP_SUMMARY}"
519-
fi
520-
521-
# Start intersection from the first wheel configuration, then narrow.
522-
cp "${WORKDIR}/configs/${configs[0]}/skipped.txt" "${WORKDIR}/intersection.txt"
523-
for cfg in "${configs[@]:1}"; do
524-
comm -12 \
525-
"${WORKDIR}/intersection.txt" \
526-
"${WORKDIR}/configs/${cfg}/skipped.txt" \
527-
> "${WORKDIR}/intersection_new.txt"
528-
mv "${WORKDIR}/intersection_new.txt" "${WORKDIR}/intersection.txt"
529-
done
530-
531-
count=$(wc -l < "${WORKDIR}/intersection.txt")
532-
{
533-
echo "Tests skipped across wheel test configurations (${#configs[@]}):"
534-
echo ""
535-
if [[ ${count} -eq 0 ]]; then
536-
echo "_No tests were skipped in all configurations._"
537-
else
538-
echo "| Test |"
539-
echo "| --- |"
540-
while IFS= read -r test; do
541-
[[ -z "${test}" ]] && continue
542-
echo "| \`${test}\` |"
543-
done < "${WORKDIR}/intersection.txt"
544-
fi
545-
} >> "${GITHUB_STEP_SUMMARY}"
436+
python ci/tools/report_universally_skipped_tests.py
546437
547438
- name: Exit
548439
run: |

0 commit comments

Comments
 (0)