cognee/.github/workflows/test_common.yml
Vasilije 212e5dcf78
Cog 174 (#84)
* Add telemetry

* test: add github action test

* fix: create graph only once

* fix: handle graph file not existing while deleting it

* fix: close qdrant connection in methods

---------

Co-authored-by: Boris Arzentar <borisarzentar@gmail.com>
2024-04-26 00:16:03 +02:00

162 lines
No EOL
5 KiB
YAML

name: common | common
on:
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RUNTIME__LOG_LEVEL: ERROR
jobs:
get_docs_changes:
name: docs changes
uses: ./.github/workflows/get_docs_changes.yml
run_common:
name: test
needs: get_docs_changes
if: needs.get_docs_changes.outputs.changes_outside_docs == 'true'
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.11.x"]
# Test all python versions on ubuntu only
include:
- python-version: "3.10.x"
os: "ubuntu-latest"
- python-version: "3.12.x"
os: "ubuntu-latest"
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tzdata on windows
run: |
cd %USERPROFILE%
curl https://data.iana.org/time-zones/releases/tzdata2021e.tar.gz --output tzdata.tar.gz
mkdir tzdata
tar --extract --file tzdata.tar.gz --directory tzdata
mkdir %USERPROFILE%\Downloads\tzdata
copy tzdata %USERPROFILE%\Downloads\tzdata
curl https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml --output %USERPROFILE%\Downloads\tzdata\windowsZones.xml
if: runner.os == 'Windows'
shell: cmd
- name: Install Poetry
# https://github.com/snok/install-poetry#running-on-windows
uses: snok/install-poetry@v1.3.2
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction
# - name: Build with Poetry
# run: poetry build
# - name: Install Package
# run: |
# cd dist
# pip install *.whl
# - name: Download NLTK Punkt Tokenizer Models
# run: |
# python -m nltk.downloader punkt
# python -m nltk.downloader stopwords
# python -m nltk.downloader wordnet
# python -m nltk.downloader averaged_perceptron_tagger
- name: Run test script
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
QDRANT_URL: ${{ secrets.QDRANT_API_URL }}
run: poetry run python ./cognee/tests/test_library.py
# - run: |
# poetry run
# if: runner.os != 'Windows'
# name: Run common tests with minimum dependencies Linux/MAC
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
# QDRANT_API_URL: ${{ secrets.QDRANT_API_URL }}
# - run: |
# poetry run python ./cognee/tests/test_library.py
# if: runner.os == 'Windows'
# name: Run common tests with minimum dependencies Windows
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
# QDRANT_API_URL: ${{ secrets.QDRANT_API_URL }}
# shell: cmd
# - name: Install dependencies
# run: poetry install --no-interaction
# - name: Build with Poetry
# run: poetry build
# - name: Install Package
# run: |
# cd dist
# pip install *.whl
# - name: Download NLTK Punkt Tokenizer Models
# run: |
# python -m nltk.downloader punkt
# - run: |
# poetry run python ./cognee/tests/test_library.py
# if: runner.os != 'Windows'
# name: Run pipeline smoke tests with minimum deps Linux/MAC
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
# QDRANT_API_URL: ${{ secrets.QDRANT_API_URL }}
# - name: Download NLTK Punkt Tokenizer Models
# run: |
# python -m nltk.downloader punkt
# - run: |
# poetry run python ./cognee/tests/test_library.py
# if: runner.os == 'Windows'
# name: Run smoke tests with minimum deps Windows
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# QDRANT_API_KEY: ${{ secrets.QDRANT_API_KEY }}
# QDRANT_API_URL: ${{ secrets.QDRANT_API_URL }}
# shell: cmd
matrix_job_required_check:
name: common | common tests
needs: run_common
runs-on: ubuntu-latest
if: always()
steps:
- name: Check matrix job results
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One or more matrix job tests failed or were cancelled. You may need to re-run them." && exit 1