Skip to content

Commit ff61015

Browse files
committed
ci: replace per-PR weight check with weekly auto-update workflow
Remove the --output-durations capture and check-session-weights job from the checks workflow. Add a new update-session-weights workflow that runs weekly (Monday 06:00 UTC) or on manual dispatch. It measures all nox session durations on ubuntu/3.13, checks for drift, and opens a PR updating session-weights.json when any session drifts beyond 50%.
1 parent 04d5563 commit ff61015

File tree

2 files changed

+79
-24
lines changed

2 files changed

+79
-24
lines changed

.github/workflows/checks.yaml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,7 @@ jobs:
7878
- name: Run nox tests (shard ${{ matrix.shard }}/4)
7979
shell: bash
8080
run: |
81-
mise exec python@${{ matrix.python-version }} -- python ./py/scripts/nox-matrix.py ${{ matrix.shard }} 4 \
82-
${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && format('--output-durations measured-durations-{0}.json', matrix.shard) || '' }}
83-
- name: Upload measured durations
84-
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
85-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
86-
with:
87-
name: session-durations-shard-${{ matrix.shard }}
88-
path: measured-durations-${{ matrix.shard }}.json
89-
retention-days: 5
90-
91-
check-session-weights:
92-
needs: [nox]
93-
if: always() && needs.nox.result == 'success'
94-
runs-on: ubuntu-latest
95-
timeout-minutes: 5
96-
steps:
97-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
98-
- name: Download measured durations
99-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
100-
with:
101-
pattern: session-durations-shard-*
102-
merge-multiple: true
103-
- name: Check session weight drift
104-
run: python ./py/scripts/check-session-weights.py measured-durations-*.json
81+
mise exec python@${{ matrix.python-version }} -- python ./py/scripts/nox-matrix.py ${{ matrix.shard }} 4
10582
10683
adk-py:
10784
uses: ./.github/workflows/adk-py-test.yaml
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: update-session-weights
2+
3+
on:
4+
schedule:
5+
# Every Monday at 06:00 UTC
6+
- cron: "0 6 * * 1"
7+
workflow_dispatch: {}
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
measure:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
shard: [0, 1, 2, 3]
22+
23+
steps:
24+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
25+
- name: Setup Python environment
26+
uses: ./.github/actions/setup-python-env
27+
with:
28+
python-version: "3.13"
29+
- name: Run nox tests (shard ${{ matrix.shard }}/4)
30+
run: |
31+
mise exec python@3.13 -- python ./py/scripts/nox-matrix.py ${{ matrix.shard }} 4 \
32+
--output-durations measured-durations-${{ matrix.shard }}.json
33+
- name: Upload measured durations
34+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
35+
with:
36+
name: session-durations-shard-${{ matrix.shard }}
37+
path: measured-durations-${{ matrix.shard }}.json
38+
retention-days: 5
39+
40+
update:
41+
needs: [measure]
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 5
44+
steps:
45+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
46+
- name: Download measured durations
47+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
48+
with:
49+
pattern: session-durations-shard-*
50+
merge-multiple: true
51+
- name: Check for drift
52+
id: check
53+
run: |
54+
if python ./py/scripts/check-session-weights.py measured-durations-*.json; then
55+
echo "drifted=false" >> "$GITHUB_OUTPUT"
56+
else
57+
echo "drifted=true" >> "$GITHUB_OUTPUT"
58+
fi
59+
- name: Update weights
60+
if: steps.check.outputs.drifted == 'true'
61+
run: |
62+
python ./py/scripts/check-session-weights.py --update measured-durations-*.json
63+
- name: Create pull request
64+
if: steps.check.outputs.drifted == 'true'
65+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
66+
with:
67+
commit-message: "ci: update nox session weights"
68+
branch: auto/update-session-weights
69+
title: "ci: update nox session weights"
70+
body: |
71+
Automated weekly update of `py/scripts/session-weights.json`.
72+
73+
Session durations were re-measured on `ubuntu-latest` with Python 3.13
74+
and at least one session drifted beyond the 50% threshold.
75+
76+
This keeps nox shard balancing accurate.
77+
labels: ci
78+
delete-branch: true

0 commit comments

Comments
 (0)