diff --git a/.github/workflows/sdk-e2e-tests.yaml b/.github/workflows/sdk-e2e-tests.yaml index 3549598f04..5f5d7ad6ee 100644 --- a/.github/workflows/sdk-e2e-tests.yaml +++ b/.github/workflows/sdk-e2e-tests.yaml @@ -2,11 +2,73 @@ name: SDK E2E Tests run-name: "SDK E2E Tests ${{ github.ref_name }} by @${{ github.actor }}" on: workflow_dispatch: + pull_request: + paths: + - 'sdks/python/**' + - 'apps/opik-backend/**' + push: + branches: + - 'main' + paths: + - 'sdks/python/**' + - 'apps/opik-backend/**' jobs: run-e2e: - name: SDK E2E Tests + name: SDK E2E Tests ${{matrix.python_version}} runs-on: ubuntu-latest + defaults: + run: + working-directory: sdks/python + + strategy: + fail-fast: false + matrix: + python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: - - name: echo - run: echo + - name: Checkout + uses: actions/checkout@v4.1.1 + + - name: Setup Python ${{matrix.python_version}} + uses: actions/setup-python@v5 + with: + python-version: ${{matrix.python_version}} + + - name: Install opik SDK + run: | + pip install -r tests/test_requirements.txt + pip install . + + - name: Run latest opik server + run: | + cd ../../deployment/docker-compose + docker compose up -d + cd - + + - name: Run tests + run: | + echo "Waiting for server to come up..." + sleep 30 + export OPIK_URL_OVERRIDE=http://localhost:5173/api + pytest tests/e2e -vv + + - name: Keep BE log in case of failure + if: failure() + run: | + docker logs opik-backend-1 > opik-backend_p${{matrix.python_version}}.log + + - name: Attach BE log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: opik-backend-log-p${{matrix.python_version}} + path: sdks/python/opik-backend_p${{matrix.python_version}}.log + + - name: Stop opik server + if: always() + run: | + cd ../../deployment/docker-compose + docker compose down + cd - + diff --git a/.gitignore b/.gitignore index f4470010dd..a1015f6db0 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ pip-log.txt # charts deployment/helm_chart/opik/charts +deployment/helm_chart/opik/values-cloud-test.yaml +deployment/helm_chart/opik/values-test.yaml +temp diff --git a/sdks/python/tests/e2e/test_experiment.py b/sdks/python/tests/e2e/test_experiment.py index 49a14523f9..d9d1f70783 100644 --- a/sdks/python/tests/e2e/test_experiment.py +++ b/sdks/python/tests/e2e/test_experiment.py @@ -8,8 +8,7 @@ def test_experiment_creation_via_evaluate_function__happyflow( opik_client: opik.Opik, dataset_name: str, experiment_name: str ): - # TODO: this test is not finished, it only checks that the script is not failing - + # TODO: this test is not finished, it does not check experiment items content dataset = opik_client.create_dataset(dataset_name) dataset.insert(