name: test | s3 file storage

on:
  workflow_call:

permissions:
  contents: read

env:
  RUNTIME__LOG_LEVEL: ERROR
  ENV: 'dev'

jobs:
  test-s3-storage:
    name: Run S3 File Storage Test
    runs-on: ubuntu-22.04
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Cognee Setup
        uses: ./.github/actions/cognee_setup
        with:
          python-version: '3.11.x'
          extra-dependencies: "aws"

      - name: Run S3 File Storage Test
        env:
          STORAGE_BACKEND: s3
          ENABLE_BACKEND_ACCESS_CONTROL: True
          AWS_REGION: eu-west-1
          AWS_ENDPOINT_URL: https://s3-eu-west-1.amazonaws.com
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_DEV_USER_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_DEV_USER_SECRET_KEY }}
          STORAGE_BUCKET_NAME: github-runner-cognee-tests
          LLM_MODEL: ${{ secrets.LLM_MODEL }}
          LLM_ENDPOINT: ${{ secrets.LLM_ENDPOINT }}
          LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
          LLM_API_VERSION: ${{ secrets.LLM_API_VERSION }}
          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_s3_file_storage.py
