Skip to content

Commit 1917dd1

Browse files
benchmarks: always run (not conditional on changes) (#31409)
1 parent 49eeb0f commit 1917dd1

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

.github/workflows/codspeed.yml

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
branches:
66
- master
77
pull_request:
8-
paths:
9-
- 'libs/core/**'
10-
- 'libs/partners/**'
11-
128
workflow_dispatch:
139

1410
env:
@@ -20,31 +16,21 @@ env:
2016
FIREWORKS_API_KEY: foo
2117

2218
jobs:
23-
prepare_matrix:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
- name: Install uv
28-
uses: astral-sh/setup-uv@v6
29-
with:
30-
python-version: "3.12"
31-
- id: files
32-
uses: Ana06/[email protected]
33-
- id: set-matrix
34-
run: |
35-
uv venv
36-
uv pip install packaging requests
37-
uv run .github/scripts/check_diff.py ${{ steps.files.outputs.all }} >> $GITHUB_OUTPUT
38-
outputs:
39-
codspeed: ${{ steps.set-matrix.outputs.codspeed }}
4019
codspeed:
4120
name: Run benchmarks
42-
needs: [ prepare_matrix ]
43-
if: ${{ needs.prepare_matrix.outputs.codspeed != '[]' }}
4421
runs-on: ubuntu-latest
4522
strategy:
4623
matrix:
47-
job-configs: ${{ fromJson(needs.prepare_matrix.outputs.codspeed) }}
24+
include:
25+
- working-directory: libs/core
26+
mode: walltime
27+
- working-directory: libs/partners/openai
28+
- working-directory: libs/partners/anthropic
29+
- working-directory: libs/partners/deepseek
30+
- working-directory: libs/partners/fireworks
31+
- working-directory: libs/partners/xai
32+
- working-directory: libs/partners/mistralai
33+
- working-directory: libs/partners/groq
4834
fail-fast: false
4935

5036
steps:
@@ -54,26 +40,26 @@ jobs:
5440
- name: Install uv
5541
uses: astral-sh/setup-uv@v6
5642
with:
57-
python-version: ${{ matrix.job-configs.python-version }}
43+
python-version: "3.12"
5844

5945
- uses: actions/setup-python@v5
6046
with:
61-
python-version: ${{ matrix.job-configs.python-version }}
47+
python-version: "3.12"
6248

6349
- name: Install dependencies
6450
run: uv sync --group test
65-
working-directory: ${{ matrix.job-configs.working-directory }}
51+
working-directory: ${{ matrix.working-directory }}
6652

67-
- name: Run benchmarks ${{ matrix.job-configs.working-directory }}
53+
- name: Run benchmarks ${{ matrix.working-directory }}
6854
uses: CodSpeedHQ/action@v3
6955
with:
7056
token: ${{ secrets.CODSPEED_TOKEN }}
7157
run: |
72-
cd ${{ matrix.job-configs.working-directory }}
73-
if [ "${{ matrix.job-configs.working-directory }}" = "libs/core" ]; then
58+
cd ${{ matrix.working-directory }}
59+
if [ "${{ matrix.working-directory }}" = "libs/core" ]; then
7460
uv run --no-sync pytest ./tests/benchmarks --codspeed
7561
else
7662
uv run --no-sync pytest ./tests/ --codspeed
7763
fi
78-
mode: ${{ matrix.job-configs.working-directory == 'libs/core' && 'walltime' || 'instrumentation' }}
64+
mode: ${{ matrix.mode || 'instrumentation' }}
7965

libs/standard-tests/langchain_tests/unit_tests/chat_models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,4 +1012,9 @@ def test_init_time(self, benchmark: BenchmarkFixture) -> None:
10121012
"""Test initialization time of the chat model. If this test fails, check that
10131013
we are not introducing undue overhead in the model's initialization.
10141014
"""
1015-
_ = benchmark(self.chat_model_class, **self.chat_model_params)
1015+
1016+
def _init_in_loop() -> None:
1017+
for _ in range(10):
1018+
self.chat_model_class(**self.chat_model_params)
1019+
1020+
benchmark(_init_in_loop)

0 commit comments

Comments
 (0)