119 lines
3.2 KiB
YAML
119 lines
3.2 KiB
YAML
name: R2R Light Python Integration Test (ubuntu)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'py/**'
|
|
- '.github/workflows/**'
|
|
- 'tests/**'
|
|
pull_request:
|
|
branches:
|
|
- dev
|
|
- dev-minor
|
|
- main
|
|
paths:
|
|
- 'py/**'
|
|
- '.github/workflows/**'
|
|
- 'tests/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
integration-test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
AZURE_API_KEY: ${{ secrets.AZURE_API_KEY }}
|
|
AZURE_API_BASE: ${{ secrets.AZURE_API_BASE }}
|
|
AZURE_API_VERSION: ${{ secrets.AZURE_API_VERSION }}
|
|
TELEMETRY_ENABLED: 'false'
|
|
R2R_POSTGRES_HOST: localhost
|
|
R2R_POSTGRES_DBNAME: postgres
|
|
R2R_POSTGRES_PORT: '5432'
|
|
R2R_POSTGRES_PASSWORD: postgres
|
|
R2R_POSTGRES_USER: postgres
|
|
R2R_PROJECT_NAME: r2r_default
|
|
PYTHONUNBUFFERED: '1'
|
|
PYTEST_ADDOPTS: '--color=yes'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Poppler
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y poppler-utils
|
|
|
|
- name: Set up Python and install dependencies
|
|
uses: ./.github/actions/setup-python-light
|
|
with:
|
|
os: ubuntu-latest
|
|
python-version: '3.12'
|
|
poetry-version: '1.7.1'
|
|
r2r-version: 'latest'
|
|
|
|
- name: Setup and start PostgreSQL
|
|
uses: ./.github/actions/setup-postgres-ext
|
|
with:
|
|
os: ubuntu-latest
|
|
|
|
- name: Verify PostgreSQL and Vector Extension
|
|
run: |
|
|
pg_isready -h localhost -p 5432
|
|
sudo -u postgres psql -c "\dx vector;"
|
|
|
|
- name: Start R2R Light server
|
|
uses: ./.github/actions/start-r2r-light
|
|
id: start-server
|
|
|
|
- name: Wait for server to be ready
|
|
run: |
|
|
timeout=300 # 5 minutes timeout
|
|
while ! curl -s http://localhost:7272/health > /dev/null; do
|
|
if [ $timeout -le 0 ]; then
|
|
echo "Server failed to start within timeout"
|
|
exit 1
|
|
fi
|
|
echo "Waiting for server to be ready..."
|
|
sleep 5
|
|
timeout=$((timeout - 5))
|
|
done
|
|
|
|
- name: Run R2R Light Python Integration Test
|
|
run: |
|
|
cd py && poetry run pytest tests/unit \
|
|
--verbose \
|
|
--capture=no \
|
|
--log-cli-level=INFO \
|
|
--junit-xml=test-results/junit.xml \
|
|
--html=test-results/report.html
|
|
- name: Run R2R Full Python Integration Test
|
|
run: |
|
|
cd py && poetry run pytest tests/integration \
|
|
--verbose \
|
|
--capture=no \
|
|
--log-cli-level=INFO \
|
|
--junit-xml=test-results/junit.xml \
|
|
--html=test-results/report.html
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: test-results
|
|
path: |
|
|
test-results/
|
|
pytest-logs/
|
|
|
|
- name: Check for test failures
|
|
if: failure()
|
|
run: |
|
|
echo "::error::Integration tests failed. Check the test results artifact for details."
|
|
exit 1
|