From 375b979d6b386f3263cd6bd7931df35f59a53c91 Mon Sep 17 00:00:00 2001 From: "afik.cohen" Date: Thu, 14 Dec 2023 21:48:12 -0800 Subject: [PATCH] add workflow --- .github/workflows/codeflash.yml | 2 +- .github/workflows/optimize.yml | 33 +++++++++++++++++++++++++++++++++ pyproject.toml | 22 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/optimize.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/codeflash.yml b/.github/workflows/codeflash.yml index 366b6a3..efb0045 100644 --- a/.github/workflows/codeflash.yml +++ b/.github/workflows/codeflash.yml @@ -30,4 +30,4 @@ jobs: id: optimize_code run: | poetry env use python - poetry run codeflash --test-framework unittest --test-root code_to_optimize/tests/unittest + poetry run codeflash diff --git a/.github/workflows/optimize.yml b/.github/workflows/optimize.yml new file mode 100644 index 0000000..366b6a3 --- /dev/null +++ b/.github/workflows/optimize.yml @@ -0,0 +1,33 @@ +name: CodeFlash + +on: + pull_request: + workflow_dispatch: + +jobs: + optimize: + name: Optimize new code in this PR + runs-on: ubuntu-latest + env: + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + CODEFLASH_AI_KEY: ${{ secrets.CODEFLASH_AI_KEY }} + PR_NUMBER: ${{ github.event.number }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11.6 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + - name: Run CodeFlash to optimize code + id: optimize_code + run: | + poetry env use python + poetry run codeflash --test-framework unittest --test-root code_to_optimize/tests/unittest diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b923efb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[tool.poetry] +name = "my-best-repo" +version = "0.1.0" +description = "" +authors = ["afik.cohen "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +codeflash = {url = "https://www.dropbox.com/scl/fi/nif03u6oj327bn476h11i/codeflash-0.4.3.post1.dev0-50ba298-py3-none-any.whl?rlkey=uoy9h6wcjtktds84idqjkdmza&dl=1"} + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + + +[tool.codeflash] +root = "/Users/afik_cohen/repos/tacit/my-best-repo" +test-root = "/Users/afik_cohen/repos/tacit/my-best-repo/tests/pytests/" +test-framework = "pytest" +ignore-paths = ["tests/"]