From 65542ecec7fdc13dcdfbee8888aaddce969a9024 Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Tue, 26 Aug 2025 21:05:30 +0200 Subject: [PATCH] refactor: Make CI/CD faster add more OS tests --- .github/workflows/e2e_tests.yml | 25 ----- ...l => test_different_operating_systems.yml} | 95 ++++++++++++++++++- .github/workflows/test_suites.yml | 12 +-- 3 files changed, 96 insertions(+), 36 deletions(-) rename .github/workflows/{python_version_tests.yml => test_different_operating_systems.yml} (52%) diff --git a/.github/workflows/e2e_tests.yml b/.github/workflows/e2e_tests.yml index 54a7cf98c..af3a3ff44 100644 --- a/.github/workflows/e2e_tests.yml +++ b/.github/workflows/e2e_tests.yml @@ -153,31 +153,6 @@ jobs: EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} run: uv run python ./cognee/tests/test_deduplication.py - run-deletion-test: - name: Deletion Test - runs-on: ubuntu-22.04 - steps: - - name: Check out - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Cognee Setup - uses: ./.github/actions/cognee_setup - with: - python-version: '3.11.x' - - - name: Run Deletion Tests - env: - ENV: 'dev' - LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} - EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} - EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} - EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} - run: uv run python ./cognee/tests/test_deletion.py - run-s3-bucket-test: name: S3 Bucket Test runs-on: ubuntu-22.04 diff --git a/.github/workflows/python_version_tests.yml b/.github/workflows/test_different_operating_systems.yml similarity index 52% rename from .github/workflows/python_version_tests.yml rename to .github/workflows/test_different_operating_systems.yml index 5b556fd8b..11b3d5245 100644 --- a/.github/workflows/python_version_tests.yml +++ b/.github/workflows/test_different_operating_systems.yml @@ -1,4 +1,4 @@ -name: Reusable Python Version Tests +name: Tests to run on different Operating Systems on: workflow_call: @@ -34,13 +34,13 @@ env: ENV: 'dev' jobs: - run-python-version-tests: - name: Python ${{ matrix.python-version }} on ${{ matrix.os }} + run-unit-tests: + name: Unit tests ${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: python-version: ${{ fromJSON(inputs.python-versions) }} - os: [ubuntu-22.04, macos-13, macos-15] + os: [ubuntu-22.04, macos-13, macos-15, windows-latest] fail-fast: false steps: - name: Check out @@ -69,6 +69,24 @@ jobs: EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} + run-integration-tests: + name: Integration tests ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ${{ fromJSON(inputs.python-versions) }} + os: [ ubuntu-22.04, macos-13, macos-15, windows-latest ] + fail-fast: false + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: ${{ matrix.python-version }} - name: Run integration tests shell: bash @@ -87,6 +105,25 @@ jobs: EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} + run-library-test: + name: Library test ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ${{ fromJSON(inputs.python-versions) }} + os: [ ubuntu-22.04, macos-13, macos-15, windows-latest ] + fail-fast: false + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: ${{ matrix.python-version }} + - name: Run default basic pipeline shell: bash env: @@ -104,12 +141,60 @@ jobs: EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} run: uv run python ./cognee/tests/test_library.py + run-build-test: + name: Build test ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ${{ fromJSON(inputs.python-versions) }} + os: [ ubuntu-22.04, macos-13, macos-15, windows-latest ] + fail-fast: false + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: ${{ matrix.python-version }} + - name: Build with uv shell: bash run: uv build - name: Install Package - if: ${{ !contains(matrix.os, 'windows') }} run: | cd dist pip install *.whl + + run-deletion-test: + name: Deletion test ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ${{ fromJSON(inputs.python-versions) }} + os: [ ubuntu-22.04, macos-13, macos-15, windows-latest ] + fail-fast: false + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cognee Setup + uses: ./.github/actions/cognee_setup + with: + python-version: ${{ matrix.python-version }} + + - name: Run Deletion Tests + env: + ENV: 'dev' + LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Test needs OpenAI endpoint to handle multimedia + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} + EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} + EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} + EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} + run: uv run python ./cognee/tests/test_deletion.py diff --git a/.github/workflows/test_suites.yml b/.github/workflows/test_suites.yml index ec56012ac..aa3337c81 100644 --- a/.github/workflows/test_suites.yml +++ b/.github/workflows/test_suites.yml @@ -68,10 +68,10 @@ jobs: uses: ./.github/workflows/notebooks_tests.yml secrets: inherit - python-version-tests: - name: Python Version Tests + different-operating-systems-tests: + name: Python Operating Systems Tests needs: [basic-tests, e2e-tests, cli-tests] - uses: ./.github/workflows/python_version_tests.yml + uses: ./.github/workflows/test_different_operating_systems.yml with: python-versions: '["3.10.x", "3.11.x", "3.12.x"]' secrets: inherit @@ -124,7 +124,7 @@ jobs: cli-tests, graph-db-tests, notebook-tests, - python-version-tests, + different-operating-systems-tests, vector-db-tests, example-tests, gemini-tests, @@ -144,7 +144,7 @@ jobs: cli-tests, graph-db-tests, notebook-tests, - python-version-tests, + different-operating-systems-tests, vector-db-tests, example-tests, db-examples-tests, @@ -165,7 +165,7 @@ jobs: "${{ needs.cli-tests.result }}" == "success" && "${{ needs.graph-db-tests.result }}" == "success" && "${{ needs.notebook-tests.result }}" == "success" && - "${{ needs.python-version-tests.result }}" == "success" && + "${{ needs.different-operating-systems-tests.result }}" == "success" && "${{ needs.vector-db-tests.result }}" == "success" && "${{ needs.example-tests.result }}" == "success" && "${{ needs.db-examples-tests.result }}" == "success" &&