From e1781b638a008f557bc47efe00d01084ecce5303 Mon Sep 17 00:00:00 2001 From: "codeflash-ai[bot]" <148906541+codeflash-ai[bot]@users.noreply.github.com> Date: Sat, 25 Apr 2026 16:59:23 +0000 Subject: [PATCH] Add CodeFlash GitHub Actions workflow --- .github/workflows/codeflash.yaml | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 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 0000000..d76ea16 --- /dev/null +++ b/.github/workflows/codeflash.yaml @@ -0,0 +1,53 @@ +name: Codeflash + +on: + pull_request: + paths: + # So that this workflow only runs when code within the target module is modified + - '**' + 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 + # 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 }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('uv.lock') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install system packages + run: | + sudo apt-get update + sudo apt-get install -y build-essential libpq-dev libsqlite3-dev + - name: Install build tooling and project dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + # install the package (will use pyproject build system uv_build) + python -m pip install --no-cache-dir . + # install dev/test dependencies required by CI + - name: ⚡️Codeflash Optimization + run: uv run codeflash \ No newline at end of file