Skip to content

Commit 79be5ff

Browse files
author
n0mad
committed
Consolidate CI Python deps through utils/requirements.txt
- rewrite `utils/requirements.txt` to direct exact pins - replace scattered workflow `pip install` commands with `pip install -r utils/requirements.txt` - add `setup-python` and pip caching to affected ubuntu-latest jobs - widen targeted test workflow triggers for requirements changes - clean up a few simple workflow shellcheck issues
1 parent 0315c31 commit 79be5ff

8 files changed

Lines changed: 106 additions & 30 deletions

File tree

.github/workflows/collect-evals.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,24 @@ jobs:
2727
path: eval_results/
2828
pattern: ${{ inputs.result-prefix && format('eval_{0}_*', inputs.result-prefix) || 'eval_*' }}
2929

30+
- name: Set up Python
31+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
32+
with:
33+
python-version: '3.12'
34+
cache: 'pip'
35+
cache-dependency-path: utils/requirements.txt
36+
37+
- name: Install dependencies
38+
run: |
39+
pip install -r utils/requirements.txt
40+
3041
- name: Summarize evals
3142
run: |
32-
pip install tabulate
33-
echo "## Eval Summary" >> $GITHUB_STEP_SUMMARY
34-
echo "" >> $GITHUB_STEP_SUMMARY
35-
python3 utils/collect_eval_results.py eval_results/ ${{ inputs.result-prefix || 'all' }} >> $GITHUB_STEP_SUMMARY
43+
{
44+
echo "## Eval Summary"
45+
echo ""
46+
python3 utils/collect_eval_results.py eval_results/ "${{ inputs.result-prefix || 'all' }}"
47+
} >> "$GITHUB_STEP_SUMMARY"
3648
3749
- name: Upload aggregated evals
3850
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/collect-results.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,22 @@ jobs:
2828
path: results/
2929
pattern: ${{ inputs.result-prefix && format('{0}_*', inputs.result-prefix) || '*' }}
3030

31-
- name: Print summary
31+
- name: Set up Python
32+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
33+
with:
34+
python-version: '3.12'
35+
cache: 'pip'
36+
cache-dependency-path: utils/requirements.txt
37+
38+
- name: Install dependencies
3239
run: |
33-
pip install tabulate
34-
python3 utils/summarize.py results/ >> $GITHUB_STEP_SUMMARY
40+
pip install -r utils/requirements.txt
41+
42+
- name: Print summary
43+
run: python3 utils/summarize.py results/ >> "$GITHUB_STEP_SUMMARY"
3544

3645
- name: Aggregate results
37-
run: |
38-
pip install tabulate
39-
python3 utils/collect_results.py results/ ${{ inputs.result-prefix || 'all' }}
46+
run: python3 utils/collect_results.py results/ ${{ inputs.result-prefix || 'all' }}
4047

4148
- name: Upload aggregated results
4249
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/e2e-tests.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,19 @@ jobs:
4949
if: ${{ !inputs.ref || inputs.ref == '' }}
5050
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5151

52+
- name: Set up Python
53+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
54+
with:
55+
python-version: '3.12'
56+
cache: 'pip'
57+
cache-dependency-path: utils/requirements.txt
58+
59+
- name: Install dependencies
60+
run: |
61+
pip install -r utils/requirements.txt
62+
5263
- id: get-jobs
5364
run: |
54-
pip install pydantic
5565
CONFIG_JSON=$(python3 ${GITHUB_WORKSPACE}/utils/matrix_logic/generate_sweep_configs.py \
5666
${{ inputs.generate-cli-command || github.event.inputs.generate-cli-command }})
5767
SINGLE=$(echo "$CONFIG_JSON" | python3 -c "import sys,json; d=json.load(sys.stdin); print(json.dumps([x for x in d if 'prefill' not in x and not x.get('eval-only', False)]))")
@@ -196,11 +206,19 @@ jobs:
196206
path: ${{ env.RESULTS_DIR }}
197207
pattern: results_*
198208

209+
- name: Set up Python
210+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
211+
with:
212+
python-version: '3.12'
213+
cache: 'pip'
214+
cache-dependency-path: utils/requirements.txt
215+
199216
- name: Install python dependencies
200-
run: pip install PyGithub
217+
run: |
218+
pip install -r utils/requirements.txt
201219
202220
- name: Calculate success rate
203-
run: python3 utils/calc_success_rate.py $STATS_FILENAME
221+
run: python3 utils/calc_success_rate.py "$STATS_FILENAME"
204222

205223
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
206224
with:

.github/workflows/profile.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,20 @@ jobs:
5050
with:
5151
ref: ${{ inputs.ref || github.ref }}
5252

53+
- name: Set up Python
54+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
55+
with:
56+
python-version: '3.12'
57+
cache: 'pip'
58+
cache-dependency-path: utils/requirements.txt
59+
60+
- name: Install dependencies
61+
run: |
62+
pip install -r utils/requirements.txt
63+
5364
- id: gen
5465
name: Generate matrix via script
5566
run: |
56-
pip install pydantic
5767
CLI_ARGS="test-config --config-files ${{ inputs.config-file }} --config-keys ${{ inputs.config-key }} --conc ${{ inputs.conc }}"
5868
CONFIG_JSON=$(python3 ${GITHUB_WORKSPACE}/utils/matrix_logic/generate_sweep_configs.py $CLI_ARGS)
5969
echo "raw=$CONFIG_JSON" >> $GITHUB_OUTPUT

.github/workflows/run-sweep.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,19 @@ jobs:
5050
with:
5151
fetch-depth: 0
5252

53-
- id: setup
53+
- name: Set up Python
54+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
55+
with:
56+
python-version: '3.12'
57+
cache: 'pip'
58+
cache-dependency-path: utils/requirements.txt
59+
60+
- name: Install dependencies
5461
run: |
55-
pip install pydantic
62+
pip install -r utils/requirements.txt
5663
64+
- id: setup
65+
run: |
5766
if [ "${{ github.event_name }}" == "pull_request" ]; then
5867
BASE_REF="origin/${{ github.base_ref }}"
5968
HEAD_REF="${{ github.event.pull_request.head.sha }}"
@@ -251,11 +260,20 @@ jobs:
251260
path: ${{ env.RESULTS_DIR }}
252261
pattern: results_*
253262

263+
- name: Set up Python
264+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
265+
with:
266+
python-version: '3.12'
267+
cache: 'pip'
268+
cache-dependency-path: utils/requirements.txt
269+
254270
- name: Install python dependencies
255-
run: pip install PyGithub
271+
run: |
272+
python -m pip install --upgrade pip
273+
pip install -r utils/requirements.txt
256274
257275
- name: Calculate success rate
258-
run: python3 utils/calc_success_rate.py $STATS_FILENAME
276+
run: python3 utils/calc_success_rate.py "$STATS_FILENAME"
259277

260278
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
261279
with:
@@ -286,11 +304,20 @@ jobs:
286304
path: results/
287305
pattern: results_bmk
288306

307+
- name: Set up Python
308+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
309+
with:
310+
python-version: '3.12'
311+
cache: 'pip'
312+
cache-dependency-path: utils/requirements.txt
313+
289314
- name: Install dependencies
290-
run: pip install psycopg2-binary tabulate
315+
run: |
316+
python -m pip install --upgrade pip
317+
pip install -r utils/requirements.txt
291318
292319
- name: Compare results against main
293-
run: python3 utils/compare_results.py results/ >> $GITHUB_STEP_SUMMARY
320+
run: python3 utils/compare_results.py results/ >> "$GITHUB_STEP_SUMMARY"
294321

295322
trigger-ingest:
296323
needs:

.github/workflows/test-matrix-logic.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
pull_request:
66
paths:
77
- 'utils/matrix_logic/**'
8+
- 'utils/requirements.txt'
89

910
permissions:
1011
contents: read
@@ -24,11 +25,13 @@ jobs:
2425
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2526
with:
2627
python-version: '3.12'
28+
cache: 'pip'
29+
cache-dependency-path: utils/requirements.txt
2730

2831
- name: Install dependencies
2932
run: |
3033
python -m pip install --upgrade pip
31-
pip install pytest pydantic pyyaml
34+
pip install -r utils/requirements.txt
3235
3336
- name: test_generate_sweep_configs tests
3437
run: |

.github/workflows/test-process-result.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- 'utils/process_result.py'
77
- 'utils/test_process_result.py'
8+
- 'utils/requirements.txt'
89

910
permissions:
1011
contents: read
@@ -24,11 +25,13 @@ jobs:
2425
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2526
with:
2627
python-version: '3.12'
28+
cache: 'pip'
29+
cache-dependency-path: utils/requirements.txt
2730

2831
- name: Install dependencies
2932
run: |
3033
python -m pip install --upgrade pip
31-
pip install pytest
34+
pip install -r utils/requirements.txt
3235
3336
- name: Run pytest
3437
run: |

utils/requirements.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
annotated-types==0.7.0
2-
iniconfig==2.3.0
3-
packaging==26.1
4-
pluggy==1.6.0
1+
# Direct dependencies for utils/ scripts and CI tests.
2+
# Exact pins for deterministic resolution on Python 3.12 in CI.
53
pydantic==2.13.0
6-
pydantic_core==2.46.0
7-
Pygments==2.20.0
4+
PyGithub==2.8.1
5+
psycopg2-binary==2.9.11
86
pytest==9.0.3
97
PyYAML==6.0.3
108
tabulate==0.10.0
11-
typing-inspection==0.4.2
12-
typing_extensions==4.15.0

0 commit comments

Comments
 (0)