|
| 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