Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Install Codeflash optimizer github action #5350

Merged
34 changes: 34 additions & 0 deletions .github/workflows/codeflash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Codeflash

on:
pull_request:
paths:
- "src/backend/base/langflow/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
optimize:
name: Optimize new Python code in this PR
if: ${{ github.actor != 'codeflash-ai[bot]' }}
runs-on: ubuntu-latest
env:
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
CODEFLASH_PR_NUMBER: ${{ github.event.number }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: "3.12"
- run: uv sync --extra dev
- name: Run Codeflash Optimizer
working-directory: ./src/backend/base
run: uv run codeflash
- name: Minimize uv cache
run: uv cache prune --ci
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ dev-dependencies = [
"pytest-codspeed>=3.0.0",
"blockbuster>=1.5.2,<1.6",
"types-aiofiles>=24.1.0.20240626",
"codeflash>=0.8.4",
]


Expand Down
12 changes: 11 additions & 1 deletion src/backend/base/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ dev-dependencies = [
"pytest-github-actions-annotate-failures>=0.2.0",
"types-aiofiles>=24.1.0.20240626",
]
[tool.codeflash]
# All paths are relative to this pyproject.toml's directory.
module-root = "langflow"
tests-root = "../tests/unit"
test-framework = "pytest"
ignore-paths = []
formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]
#disable plugins that might interfere with runtime measurement
pytest-cmd = "pytest -p no:profiling -p no:sugar -p no:xdist -p no:cov -p no:split"

[build-system]
requires = ["hatchling"]
Expand Down Expand Up @@ -222,7 +231,8 @@ dev = [
"pytest-split>=0.9.0",
"devtools>=0.12.2",
"pytest-flakefinder>=1.1.0",
"types-markdown>=3.7.0.20240822"
"types-markdown>=3.7.0.20240822",
"codeflash>=0.8.4"
]

[project.scripts]
Expand Down
Loading
Loading