Skip to content

Commit 4a15907

Browse files
authored
Merge pull request #8 from codeflash-ai/github-actions
end to end test with prod aiserver
2 parents ffc9700 + 758f1d2 commit 4a15907

11 files changed

+638
-2
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CodeFlash
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "**"
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
optimize:
15+
name: Optimize new code in this PR
16+
if: ${{ github.actor != 'codeflash-ai[bot]' }}
17+
runs-on: ubuntu-latest
18+
env:
19+
CODEFLASH_AIS_SERVER: prod
20+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
21+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
22+
CODEFLASH_PR_NUMBER: ${{ github.event.number }}
23+
COLUMNS: 110
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Python 3.11 for CLI
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
python-version: 3.11.6
33+
34+
- name: Install dependencies (CLI)
35+
run: |
36+
uv tool install poetry
37+
uv venv
38+
source .venv/bin/activate
39+
poetry install --with dev
40+
41+
- name: Run Codeflash to optimize code
42+
id: optimize_code
43+
run: |
44+
source .venv/bin/activate
45+
poetry run codeflash
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: end-to-end-test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
bubble-sort-optimization-pytest-no-git:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
COLUMNS: 110
15+
MAX_RETRIES: 3
16+
RETRY_DELAY: 5
17+
EXPECTED_IMPROVEMENT_PCT: 300
18+
CODEFLASH_END_TO_END: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Python 3.11 for CLI
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
python-version: 3.11.6
29+
30+
- name: Install dependencies (CLI)
31+
run: |
32+
uv tool install poetry
33+
uv venv
34+
source .venv/bin/activate
35+
poetry install --with dev
36+
37+
- name: Remove .git
38+
run: |
39+
if [ -d ".git" ]; then
40+
echo ".git directory exists!"
41+
sudo rm -rf .git
42+
if [ -d ".git" ]; then
43+
echo ".git directory still exists after removal attempt!"
44+
exit 1
45+
else
46+
echo ".git directory successfully removed."
47+
fi
48+
else
49+
echo ".git directory does not exist. Nothing to remove."
50+
exit 1
51+
fi
52+
53+
- name: Run Codeflash to optimize code
54+
id: optimize_code
55+
run: |
56+
source .venv/bin/activate
57+
poetry run python tests/scripts/end_to_end_test_bubblesort_pytest.py
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: end-to-end-test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
bubble-sort-optimization-unittest:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
COLUMNS: 110
15+
MAX_RETRIES: 3
16+
RETRY_DELAY: 5
17+
EXPECTED_IMPROVEMENT_PCT: 300
18+
CODEFLASH_END_TO_END: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Python 3.11 for CLI
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
python-version: 3.11.6
29+
30+
- name: Install dependencies (CLI)
31+
run: |
32+
uv tool install poetry
33+
uv venv
34+
source .venv/bin/activate
35+
poetry install --with dev
36+
37+
- name: Run Codeflash to optimize code
38+
id: optimize_code
39+
run: |
40+
source .venv/bin/activate
41+
poetry run python tests/scripts/end_to_end_test_bubblesort_unittest.py
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Coverage E2E
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
end-to-end-test-coverage:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
MAX_RETRIES: 3
15+
RETRY_DELAY: 5
16+
CODEFLASH_END_TO_END: 1
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up Python 3.11 for CLI
24+
uses: astral-sh/setup-uv@v5
25+
with:
26+
python-version: 3.11.6
27+
28+
- name: Install dependencies (CLI)
29+
run: |
30+
uv tool install poetry
31+
uv venv
32+
source .venv/bin/activate
33+
poetry install --with dev
34+
poetry add black # my-best-repo in end_to_end_test_coverage.py is configured to use black
35+
36+
- name: Run Codeflash to optimize code
37+
id: optimize_code
38+
run: |
39+
source .venv/bin/activate
40+
poetry run python tests/scripts/end_to_end_test_coverage.py
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: end-to-end-test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
futurehouse-structure:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
COLUMNS: 110
15+
MAX_RETRIES: 3
16+
RETRY_DELAY: 5
17+
EXPECTED_IMPROVEMENT_PCT: 10
18+
CODEFLASH_END_TO_END: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Python 3.11 for CLI
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
python-version: 3.11.6
29+
30+
- name: Install dependencies (CLI)
31+
run: |
32+
uv tool install poetry
33+
uv venv
34+
source .venv/bin/activate
35+
poetry install --with dev
36+
37+
- name: Run Codeflash to optimize code
38+
id: optimize_code
39+
run: |
40+
source .venv/bin/activate
41+
poetry run python tests/scripts/end_to_end_test_futurehouse.py
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: end-to-end-test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
init-optimization:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
COLUMNS: 110
15+
MAX_RETRIES: 3
16+
RETRY_DELAY: 5
17+
EXPECTED_IMPROVEMENT_PCT: 300
18+
CODEFLASH_END_TO_END: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Python 3.11 for CLI
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
python-version: 3.11.6
29+
30+
- name: Install dependencies (CLI)
31+
run: |
32+
uv tool install poetry
33+
uv venv
34+
source .venv/bin/activate
35+
poetry install --with dev
36+
37+
- name: Run Codeflash to optimize code
38+
id: optimize_code
39+
run: |
40+
source .venv/bin/activate
41+
poetry run python tests/scripts/end_to_end_test_init_optimization.py
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: end-to-end-test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
tracer-replay:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
COLUMNS: 110
15+
MAX_RETRIES: 3
16+
RETRY_DELAY: 5
17+
EXPECTED_IMPROVEMENT_PCT: 10
18+
CODEFLASH_END_TO_END: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Python 3.11 for CLI
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
python-version: 3.11.6
29+
30+
- name: Install dependencies (CLI)
31+
run: |
32+
uv tool install poetry
33+
uv venv
34+
source .venv/bin/activate
35+
poetry install --with dev
36+
37+
- name: Run Codeflash to optimize code
38+
id: optimize_code
39+
run: |
40+
source .venv/bin/activate
41+
poetry run python tests/scripts/end_to_end_test_tracer_replay.py
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: end-to-end-test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
topological-sort-optimization:
9+
runs-on: ubuntu-latest
10+
env:
11+
CODEFLASH_AIS_SERVER: prod
12+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
13+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
14+
COLUMNS: 110
15+
MAX_RETRIES: 3
16+
RETRY_DELAY: 5
17+
EXPECTED_IMPROVEMENT_PCT: 5
18+
CODEFLASH_END_TO_END: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Set up Python 3.11 for CLI
26+
uses: astral-sh/setup-uv@v5
27+
with:
28+
python-version: 3.11.6
29+
30+
- name: Install dependencies (CLI)
31+
run: |
32+
uv tool install poetry
33+
uv venv
34+
source .venv/bin/activate
35+
poetry install --with dev
36+
37+
- name: Run Codeflash to optimize code
38+
id: optimize_code
39+
run: |
40+
source .venv/bin/activate
41+
poetry run python tests/scripts/end_to_end_test_topological_sort.py

.github/workflows/mypy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Mypy Type Checking for CLI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
type-check-cli:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
with:
22+
version: "0.5.30"
23+
24+
- name: install poetry as a tool
25+
run: uv tool install poetry
26+
27+
- name: install dependencies
28+
run: uvx poetry install --with dev
29+
30+
- name: Run mypy on allowlist
31+
run: uvx poetry run mypy --non-interactive --config-file pyproject.toml @mypy_allowlist.txt

0 commit comments

Comments
 (0)