Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: separate type check from integration tests #4881

Merged
merged 98 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 96 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
0f41788
ci: fix tox.ini for integration tests
RogerHYang Oct 4, 2024
ff46076
clean up
RogerHYang Oct 4, 2024
ab9c3b2
clean up
RogerHYang Oct 4, 2024
6e01375
clean up
RogerHYang Oct 4, 2024
f950d82
clean up
RogerHYang Oct 4, 2024
bac9893
let github handle line-ending
RogerHYang Oct 4, 2024
8ffeb51
clean up
RogerHYang Oct 4, 2024
6912ef1
clean up
RogerHYang Oct 4, 2024
5dafb6a
clean up
RogerHYang Oct 4, 2024
9cc7164
clean up
RogerHYang Oct 4, 2024
7a1bf12
clean up
RogerHYang Oct 4, 2024
6e36bab
clean up
RogerHYang Oct 4, 2024
79c8206
clean up
RogerHYang Oct 4, 2024
35f1dc6
clean up
RogerHYang Oct 4, 2024
7e79ee1
clean up
RogerHYang Oct 4, 2024
55dcdfb
ci: add caching for integration tests (#4875)
RogerHYang Oct 4, 2024
019b69e
clean up
RogerHYang Oct 4, 2024
9218709
clean up
RogerHYang Oct 4, 2024
253a57b
clean up
RogerHYang Oct 4, 2024
854f44f
clean up
RogerHYang Oct 4, 2024
5f763b1
clean up
RogerHYang Oct 4, 2024
eaab9f1
Merge branch 'main' into fix-tox-ini
RogerHYang Oct 5, 2024
68c3980
ci: use tox for unit tests
RogerHYang Oct 4, 2024
ade8f6d
clean up
RogerHYang Oct 4, 2024
bcbc511
fix pydantic for uv
RogerHYang Oct 4, 2024
b0e9713
ci: one ruff to rule them all
RogerHYang Oct 4, 2024
4b8eec3
separate sqlite and postgresql
RogerHYang Oct 5, 2024
b72ffd9
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 5, 2024
d3b2581
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 5, 2024
601ac70
ci: separate type check from integration tests
RogerHYang Oct 5, 2024
c01ca52
sparse checkout
RogerHYang Oct 6, 2024
f74de43
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
f634165
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
b49a9e0
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
81af4db
sparse checkout
RogerHYang Oct 6, 2024
4c6ee59
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
13b807c
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
8d3a5cb
sparse checkout
RogerHYang Oct 6, 2024
b2428a4
remove symlinks
RogerHYang Oct 6, 2024
92cc38c
remove symlinks
RogerHYang Oct 6, 2024
2b52927
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
9391438
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
5a63a27
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
d0469a8
fix typo
RogerHYang Oct 6, 2024
019a991
fix typo
RogerHYang Oct 6, 2024
03a8992
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
6ba1141
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
d2ac995
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
75ce794
fix typo
RogerHYang Oct 6, 2024
b0ee6c2
fix typo
RogerHYang Oct 6, 2024
e2af5ec
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
34fcca3
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
a9e674d
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
a6bf746
remove file in windows
RogerHYang Oct 6, 2024
c053567
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
d49adc3
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
7f124f9
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
ab50581
remove file in windows
RogerHYang Oct 6, 2024
1ac556f
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
fe2b10e
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
32c643b
remove symbolic links
RogerHYang Oct 6, 2024
9702df1
remove symbolic links
RogerHYang Oct 6, 2024
d0ef778
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
6f5e581
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
b8d1a66
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
b94a367
remove symbolic links
RogerHYang Oct 6, 2024
2e9a13d
clean up
RogerHYang Oct 6, 2024
cb0a85e
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
e278ab0
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
5947657
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
7bf8831
clean up
RogerHYang Oct 6, 2024
69ee206
clean up
RogerHYang Oct 6, 2024
e6f36b7
clean up
RogerHYang Oct 6, 2024
465327b
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
55b9ef6
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
d9b1322
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
706ee4f
clean up
RogerHYang Oct 6, 2024
3b4cc82
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
7540f3f
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
9657a9d
clean up
RogerHYang Oct 6, 2024
bddf3b3
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
0f6fb17
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
76f3e3b
clean up
RogerHYang Oct 6, 2024
2007fb7
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
9cd1a57
clean up
RogerHYang Oct 6, 2024
7d199fa
clean up
RogerHYang Oct 6, 2024
5c3ed4c
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 6, 2024
5b8b03a
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
aa00878
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
e04e55e
clean up
RogerHYang Oct 6, 2024
081a9ef
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 6, 2024
3c6cd73
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 6, 2024
4d94ba6
clean up
RogerHYang Oct 7, 2024
a29cb98
Merge branch 'fix-tox-ini' into tox-for-unit-tests
RogerHYang Oct 7, 2024
24ca26c
Merge branch 'tox-for-unit-tests' into one-ruff-for-everything
RogerHYang Oct 7, 2024
2fcaba1
Merge branch 'one-ruff-for-everything' into run-mypy-separately
RogerHYang Oct 7, 2024
88a02c9
Merge branch 'main' into run-mypy-separately
RogerHYang Oct 9, 2024
5166655
clean up
RogerHYang Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: uv pip install --system -q ../. uvloop
- run: uv pip install --system ../. uvloop
- run: uv pip list
- name: Run Playwright tests
run: pnpm exec playwright test
Expand Down
186 changes: 156 additions & 30 deletions .github/workflows/python-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
if: ${{ needs.changes.outputs.phoenix_evals == 'true' }}
strategy:
matrix:
py: [ 3.9, 3.12 ]
os: [macos-12, windows-latest, ubuntu-latest]
py: [ 3.8, 3.12 ]
os: [ ubuntu-latest, windows-latest, macos-13 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -67,16 +67,17 @@ jobs:
with:
version: 0.4.18
- run: uv tool install tox --with tox-uv
- run: tox run -e phoenix_evals
- run: tox run -e phoenix_evals -- -ra -x

phoenix-otel:
name: Phoenix OTel
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.phoenix_otel == 'true' }}
strategy:
matrix:
py: [ 3.9, 3.12 ]
py: [ 3.8, 3.12 ]
os: [ ubuntu-latest, windows-latest, macos-13 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -86,7 +87,7 @@ jobs:
with:
version: 0.4.18
- run: uv tool install tox --with tox-uv
- run: tox run -e phoenix_otel
- run: tox run -e phoenix_otel -- -ra -x

lint:
name: Lint Phoenix
Expand Down Expand Up @@ -127,50 +128,150 @@ jobs:
hatch run notebooks:clean
git diff --exit-code

unit-test:
ruff:
name: Ruff
runs-on: ${{ matrix.os }}
strategy:
matrix:
py: [ 3.12 ]
os: [ ubuntu-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Set up `uv`
uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
- name: Install `ruff`
run: uv tool install ruff@0.6.8
- name: Check format
run: uv tool run ruff format --diff
- name: Check lint
run: uv tool run ruff check --no-fix

unit-tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.phoenix == 'true' }}
strategy:
matrix:
py: ["3.9"]
os: [macos-12, windows-latest, ubuntu-latest]
py: [ 3.9, 3.12 ]
os: [ ubuntu-latest, windows-latest, macos-13 ]
steps:
- name: Checkout Repository
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.py }}
with:
sparse-checkout: |
requirements/
src/phoenix/
tests/unit/
tests/conftest.py
- name: Remove symbolic links (non-Windows)
run: find . -type l -delete
if: runner.os != 'Windows'
- name: Remove symbolic links (Windows)
run: |
Remove-Item src/phoenix/evals
Remove-Item src/phoenix/otel
shell: powershell
if: runner.os == 'Windows'
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip==${{ env.pip-version }}
pip install hatch
- name: Install PostgreSQL (Ubuntu)
- name: Set up `uv`
uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
enable-cache: true
cache-dependency-glob: |
pyproject.toml
requirements/ci.txt
requirements/unit-tests.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up `tox` with `tox-uv`
run: uv tool install tox --with tox-uv
- name: Install PostgreSQL (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get -yqq install postgresql
- name: Run tests with PostgreSQL
run: sudo apt-get -yqq install postgresql
- name: Run tests with PostgreSQL (Linux)
if: runner.os == 'Linux'
run: hatch run test:tests --run-postgres
- name: Run tests without PostgreSQL
run: tox run -e unit_tests -- -ra -x --run-postgres
- name: Run tests without PostgreSQL (non-Linux)
if: runner.os != 'Linux'
run: hatch run test:tests
run: tox run -e unit_tests -- -ra -x

integration-test:
type-check-integration-tests:
name: Type Check Integration Tests
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.phoenix == 'true' }}
strategy:
matrix:
py: [ 3.9, 3.12 ]
os: [ ubuntu-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: |
requirements/
src/phoenix/
tests/integration/
- name: Remove symbolic links (Non-Windows)
run: find . -type l -delete
if: runner.os != 'Windows'
- name: Remove symbolic links (Windows)
run: |
Remove-Item src/phoenix/evals
Remove-Item src/phoenix/otel
shell: powershell
if: runner.os == 'Windows'
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Set up `uv`
uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
enable-cache: true
cache-dependency-glob: |
pyproject.toml
requirements/ci.txt
requirements/integration-tests.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up `tox` with `tox-uv`
run: uv tool install tox --with tox-uv
- name: Check types on integration tests
run: tox run -e type_check_integration_tests

integration-tests:
name: Integration Tests
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.phoenix == 'true' }}
strategy:
matrix:
py: [ 3.9, 3.12 ]
os: [ubuntu-latest, windows-latest, macos-12]
db: [ sqlite, postgresql ]
os: [ ubuntu-latest, windows-latest, macos-13 ]
exclude:
- db: postgresql
os: windows-latest
- db: postgresql
os: macos-13
env:
CI_TEST_DB_BACKEND: ${{ matrix.db }}
services:
postgres:
# Applying this workaround: https://github.com/actions/runner/issues/822
image: ${{ (matrix.os == 'ubuntu-latest') && 'postgres:12' || '' }}
image: ${{ (matrix.db == 'postgresql') && 'postgres:12' || '' }}
env:
POSTGRES_PASSWORD: phoenix
options: >-
Expand All @@ -181,12 +282,37 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: |
requirements/
src/phoenix/
tests/integration/
- name: Remove symbolic links (non-Windows)
run: find . -type l -delete
if: runner.os != 'Windows'
- name: Remove symbolic links (Windows)
run: |
Remove-Item src/phoenix/evals
Remove-Item src/phoenix/otel
shell: powershell
if: runner.os == 'Windows'
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- uses: astral-sh/setup-uv@v3
- name: Set up `uv`
uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
- run: uv tool install tox --with tox-uv
- run: tox run -e integration_tests
enable-cache: true
cache-dependency-glob: |
pyproject.toml
requirements/ci.txt
requirements/integration-tests.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up `tox` with `tox-uv`
run: uv tool install tox --with tox-uv
- name: Run integration tests
run: tox run -e integration_tests -- -ra -x -n auto
10 changes: 9 additions & 1 deletion .github/workflows/python-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
integration-test:
runs-on: ubuntu-latest
env:
CI_TEST_DB_BACKEND: postgresql
services:
postgres:
image: postgres:12
Expand All @@ -30,8 +32,14 @@ jobs:
- uses: astral-sh/setup-uv@v3
with:
version: 0.4.18
enable-cache: true
cache-dependency-glob: |
pyproject.toml
requirements/ci.txt
requirements/integration-tests.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: uv tool install tox --with tox-uv
- run: tox run -e integration_tests
- run: tox run -e ci_integration_tests
- uses: slackapi/slack-github-action@v1
if: failure()
env:
Expand Down
2 changes: 1 addition & 1 deletion packages/phoenix-evals/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ force-single-line = false
"*.ipynb" = ["E402", "E501"]

[tool.ruff.format]
line-ending = "lf"
line-ending = "native"

[tool.mypy]
explicit_package_bases = true
Expand Down
2 changes: 1 addition & 1 deletion packages/phoenix-otel/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ force-single-line = false
"*.ipynb" = ["E402", "E501"]

[tool.ruff.format]
line-ending = "lf"
line-ending = "native"

[tool.mypy]
explicit_package_bases = true
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dev = [
"uv==0.4.8",
"jupyter",
"nbqa",
"ruff==0.6.8",
"ruff==0.6.9",
"mypy==1.11.2",
"pandas>=1.0",
"tabulate", # used by DataFrame.to_markdown()
Expand Down Expand Up @@ -244,7 +244,7 @@ python = ["3.9", "3.12"]
[tool.hatch.envs.style]
detached = true
dependencies = [
"ruff==0.6.8",
"ruff==0.6.9",
]

[[tool.hatch.envs.style.matrix]]
Expand Down Expand Up @@ -443,7 +443,7 @@ exclude = [
"docs/",
]
line-length = 100
target-version = "py38"
target-version = "py39"

[tool.ruff.lint.per-file-ignores]
"*.ipynb" = ["E402", "E501"]
Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.txt → requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mypy==1.11.2
ruff==0.6.8
pytest==8.3.3
pytest-xdist==3.6.1
pytest-asyncio==0.23.8
pytest-asyncio==0.24.0
uvloop; platform_system != 'Windows'
pydantic>=1.0,!=2.0.*,<3
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-r ci.txt
beautifulsoup4
faker
httpx
openinference-semantic-conventions
opentelemetry-sdk
pandas-stubs
portpicker
psutil
pyjwt
Expand Down
19 changes: 19 additions & 0 deletions requirements/unit-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-r ci.txt
Faker>=30.1.0
arize
asgi-lifespan
asyncpg
grpc-interceptor[testing]
httpx # For OpenAI testing
litellm>=1.0.3
nest-asyncio # for executor testing
numpy
openai>=1.0.0
protobuf==3.20 # version minimum (for tests)
psycopg[binary,pool]
pytest-postgresql
responses
respx # For OpenAI testing
tenacity
tiktoken
typing-extensions==4.7.0
8 changes: 1 addition & 7 deletions tests/integration/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,7 @@ def _random_schema(
url: URL,
) -> Iterator[str]:
engine = create_engine(url.set(drivername="postgresql+psycopg"))
try:
engine.connect().close()
except OperationalError as exc:
if "too many clients" in str(exc):
pass
else:
pytest.skip(f"PostgreSQL unavailable: {exc}")
engine.connect().close()
engine.dispose()
schema = f"_{secrets.token_hex(15)}"
yield schema
Expand Down
Loading
Loading