using check diffs output

This commit is contained in:
Sydney Runkle 2025-05-29 09:52:44 -04:00
parent a2988c6f0b
commit bfeab8e2b5
2 changed files with 33 additions and 38 deletions

View File

@ -119,7 +119,9 @@ def _get_configs_for_single_dir(job: str, dir_: str) -> List[Dict[str, str]]:
if job == "test-pydantic": if job == "test-pydantic":
return _get_pydantic_test_configs(dir_) return _get_pydantic_test_configs(dir_)
if dir_ == "libs/core": if job == "codspeed":
py_versions = ["3.12"] # 3.13 is not yet supported
elif dir_ == "libs/core":
py_versions = ["3.9", "3.10", "3.11", "3.12", "3.13"] py_versions = ["3.9", "3.10", "3.11", "3.12", "3.13"]
# custom logic for specific directories # custom logic for specific directories
elif dir_ == "libs/partners/milvus": elif dir_ == "libs/partners/milvus":
@ -210,6 +212,8 @@ def _get_configs_for_multi_dirs(
) )
elif job == "extended-tests": elif job == "extended-tests":
dirs = list(dirs_to_run["extended-test"]) dirs = list(dirs_to_run["extended-test"])
elif job == "codspeed":
dirs = list(dirs_to_run["codspeed"])
else: else:
raise ValueError(f"Unknown job: {job}") raise ValueError(f"Unknown job: {job}")
@ -225,6 +229,7 @@ if __name__ == "__main__":
"lint": set(), "lint": set(),
"test": set(), "test": set(),
"extended-test": set(), "extended-test": set(),
"codspeed": set(),
} }
docs_edited = False docs_edited = False
@ -248,6 +253,8 @@ if __name__ == "__main__":
dirs_to_run["extended-test"].update(LANGCHAIN_DIRS) dirs_to_run["extended-test"].update(LANGCHAIN_DIRS)
dirs_to_run["lint"].add(".") dirs_to_run["lint"].add(".")
if file.startswith("libs/core"):
dirs_to_run["codspeed"].add(f"libs/core")
if any(file.startswith(dir_) for dir_ in LANGCHAIN_DIRS): if any(file.startswith(dir_) for dir_ in LANGCHAIN_DIRS):
# add that dir and all dirs after in LANGCHAIN_DIRS # add that dir and all dirs after in LANGCHAIN_DIRS
# for extended testing # for extended testing
@ -286,6 +293,7 @@ if __name__ == "__main__":
if not filename.startswith(".") if not filename.startswith(".")
] != ["README.md"]: ] != ["README.md"]:
dirs_to_run["test"].add(f"libs/partners/{partner_dir}") dirs_to_run["test"].add(f"libs/partners/{partner_dir}")
dirs_to_run["codspeed"].add(f"libs/partners/{partner_dir}")
# Skip if the directory was deleted or is just a tombstone readme # Skip if the directory was deleted or is just a tombstone readme
elif file == "libs/packages.yml": elif file == "libs/packages.yml":
continue continue
@ -311,6 +319,7 @@ if __name__ == "__main__":
"compile-integration-tests", "compile-integration-tests",
"dependencies", "dependencies",
"test-pydantic", "test-pydantic",
"codspeed",
] ]
} }
map_job_to_configs["test-doc-imports"] = ( map_job_to_configs["test-doc-imports"] = (

View File

@ -20,29 +20,28 @@ env:
FIREWORKS_API_KEY: foo FIREWORKS_API_KEY: foo
jobs: jobs:
# build: prepare_matrix:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - uses: actions/checkout@v4 - uses: actions/checkout@v4
# - name: Install uv - name: Install uv
# uses: astral-sh/setup-uv@v6 uses: astral-sh/setup-uv@v6
# with: with:
# python-version: "3.12" python-version: "3.12"
# - id: files - id: files
# uses: Ana06/get-changed-files@v2.3.0 uses: Ana06/get-changed-files@v2.3.0
# - id: set-matrix - id: set-matrix
# run: | run: |
# uv pip install packaging requests uv pip install packaging requests
# uv run .github/scripts/check_diff.py ${{ steps.files.outputs.all }} >> $GITHUB_OUTPUT uv run .github/scripts/check_diff.py ${{ steps.files.outputs.all }} >> $GITHUB_OUTPUT
codspeed: codspeed:
name: Run benchmarks name: Run benchmarks
needs: [ prepare_matrix ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
- working-directory: libs/core job-configs: ${{ fromJson(needs.build.outputs.codspeed) }}
mode: walltime fail-fast: false
- working-directory: libs/partners/openai
- working-directory: libs/partners/anthropic
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -51,39 +50,26 @@ jobs:
- name: Install uv - name: Install uv
uses: astral-sh/setup-uv@v6 uses: astral-sh/setup-uv@v6
with: with:
python-version: "3.12" python-version: ${{ matrix.job-configs.python-version }}
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.12" python-version: ${{ matrix.job-configs.python-version }}
- name: Install dependencies - name: Install dependencies
run: uv sync --group test run: uv sync --group test
working-directory: ${{ matrix.working-directory }} working-directory: ${{ matrix.job-configs.python-version }}
- name: Run benchmarks - name: Run benchmarks
uses: CodSpeedHQ/action@v3 uses: CodSpeedHQ/action@v3
with: with:
token: ${{ secrets.CODSPEED_TOKEN }} token: ${{ secrets.CODSPEED_TOKEN }}
run: | run: |
cd ${{ matrix.working-directory }} cd ${{ matrix.job-configs.working-directory }}
if [ "${{ matrix.working-directory }}" = "libs/core" ]; then if [ "${{ matrix.job-configs.working-directory }}" = "libs/core" ]; then
uv run --no-sync pytest ./tests/benchmarks --codspeed uv run --no-sync pytest ./tests/benchmarks --codspeed
else else
uv run --no-sync pytest ./tests/ --codspeed uv run --no-sync pytest ./tests/ --codspeed
fi fi
mode: ${{ matrix.mode || 'instrumentation' }} mode: ${{ matrix.job-configs.working-directory == 'libs/core' && 'walltime' || 'instrumentation' }}
# codspeed:
# name: cd ${{ matrix.job-configs.working-directory }}
# needs: [ build ]
# if: ${{ needs.build.outputs.codspeed != '[]' }}
# strategy:
# matrix:
# job-configs: ${{ fromJson(needs.build.outputs.codspeed) }}
# fail-fast: false
# uses: ./.github/workflows/codspeed.yml
# with:
# working-directory: ${{ matrix.job-configs.working-directory }}
# python-version: ${{ matrix.job-configs.python-version }}
# secrets: inherit