diff --git a/.github/workflows/codeflash.yaml b/.github/workflows/codeflash.yaml new file mode 100644 index 0000000000..122c86061c --- /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 + - 'api\**' + 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@v6 + with: + python-version: "3.10" + architecture: x64 + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential pkg-config libgl1-mesa-dev libsm6 libxext6 libxrender-dev libpangocairo-1.0-0 + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Install Python dependencies + - name: ⚡️Codeflash Optimization + run: codeflash \ No newline at end of file