Unverified 提交 4c27eb9b authored 作者: Will Dean's avatar Will Dean 提交者: GitHub

Update test time action (#1219)

上级 bc6c78f4
......@@ -7,8 +7,19 @@ repo=pytensor
issue_number=1124
title="Speed up test times :rocket:"
workflow=Tests
latest_id=$(gh run list --workflow $workflow --status success --limit 1 --json databaseId --jq '.[0].databaseId')
jobs=$(gh api /repos/$owner/$repo/actions/runs/$latest_id/jobs --jq '.jobs | map({name: .name, run_id: .run_id, id: .id, started_at: .started_at, completed_at: .completed_at})')
latest_id=$(gh run list --branch main --limit 1 --workflow $workflow --status success --json databaseId,startedAt,updatedAt --jq '
. | map({
databaseId: .databaseId,
startedAt: .startedAt,
updatedAt: .updatedAt,
minutes: (((.updatedAt | fromdate) - (.startedAt | fromdate)) / 60)
} | select(.minutes > 10))
| .[0].databaseId
')
jobs=$(gh api /repos/$owner/$repo/actions/runs/$latest_id/jobs --jq '
.jobs
| map({name: .name, run_id: .run_id, id: .id, started_at: .started_at, completed_at: .completed_at})
')
# Skip 3.10, float32, and Benchmark tests
function skip_job() {
......@@ -31,7 +42,7 @@ function skip_job() {
# Remove common prefix from the name
function remove_prefix() {
name=$1
echo $name | sed -e 's/^ubuntu-latest test py3.12 : fast-compile 0 : float32 0 : //'
echo $name | sed -e 's/^ubuntu-latest test py3.13 numpy>=2.0 : fast-compile 0 : float32 0 : //'
}
function human_readable_time() {
......@@ -64,7 +75,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do
fi
echo "Processing job: $name (ID: $id, Run ID: $run_id)"
times=$(gh run view --job $id --log | python extract-slow-tests.py)
# Seeing a bit more stabilty with the API rather than the CLI
# https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run
times=$(gh api /repos/$owner/$repo/actions/jobs/$id/logs | python extract-slow-tests.py)
# times=$(gh run view --job $id --log | python extract-slow-tests.py)
if [ -z "$times" ]; then
# Some of the jobs are non-test jobs, so we skip them
......@@ -89,6 +104,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do
fi
done
if [ -z "$all_times" ]; then
echo "No slow tests found, exiting"
exit 1
fi
run_date=$(date +"%Y-%m-%d")
body=$(cat << EOF
If you are motivated to help speed up some tests, we would appreciate it!
......@@ -100,7 +120,8 @@ $all_times
You can find more information on how to contribute [here](https://pytensor.readthedocs.io/en/latest/dev_start_guide.html)
Automatically generated by [GitHub Action](https://github.com/pymc-devs/pytensor/blob/main/.github/workflows/slow-tests-issue.yml)
Latest run date: $run_date
Latest run date: $run_date
Run logs: [$latest_id](https://github.com/pymc-devs/pytensor/actions/runs/$latest_id)
EOF
)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论