From 9e474ade7b1a07d0613e37155b59e4748092e081 Mon Sep 17 00:00:00 2001 From: Kevin Turcios <106575910+KRRT7@users.noreply.github.com> Date: Mon, 17 Mar 2025 06:54:32 +0000 Subject: [PATCH] =?UTF-8?q?Codeflash=20GHA=20=E2=9A=A1=20(#1928)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codeflash.yaml | 43 ++++++++++++++++++++++++++++++++ pyproject.toml | 8 ++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/codeflash.yaml diff --git a/.github/workflows/codeflash.yaml b/.github/workflows/codeflash.yaml new file mode 100644 index 00000000..557e27c5 --- /dev/null +++ b/.github/workflows/codeflash.yaml @@ -0,0 +1,43 @@ +name: Codeflash + +on: + pull_request: + paths: + # So that this workflow only runs when code within the target module is modified + - "skyvern/**" + workflow_dispatch: + +concurrency: + # Any new push to the PR will cancel the previous run, so that only the latest code is optimized + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + optimize: + name: Optimize new Python code in this PR + # Don't run codeflash on codeflash-ai[bot] commits, prevent duplicate optimizations + 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 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install Project Dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install --all-extras + poetry add codeflash + + - name: Run Codeflash to optimize code + run: | + poetry env use python + poetry run codeflash diff --git a/pyproject.toml b/pyproject.toml index 8f0961d2..7985961d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,3 +135,11 @@ plugins = "sqlalchemy.ext.mypy.plugin" [tool.poetry.scripts] skyvern = "skyvern.cli.commands:app" + +[tool.codeflash] +# All paths are relative to this pyproject.toml's directory. +module-root = "skyvern" +tests-root = "tests" +test-framework = "pytest" +ignore-paths = ["skyvern/client"] +formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"] \ No newline at end of file