ZanSara d8ac30fa47
refactor!: extract preprocessing and file conversion deps (#4605)
* isolate file-conversion deps

* pylint

* add to all extra

* chain was missing

* move langdetect into preprocessing and fix tika

* add file-conversion extra
2023-04-14 11:34:16 +02:00

1466 lines
50 KiB
YAML

# If you change this name also do it in tests_skipper.yml and ci_metrics.yml
name: Tests
on:
workflow_dispatch: # Activate this workflow manually
push:
branches:
- main
# release branches have the form v1.9.x
- 'v[0-9].*[0-9].x'
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths:
- "**.py"
- "pyproject.toml"
- "!.github/**/*.py"
- "!rest_api/**/*.py"
env:
PYTEST_PARAMS: --maxfail=5 --durations=10 --suppress-no-test-exit-code
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SUITES_EXCLUDED_FROM_WINDOWS:
--ignore=test/pipelines/test_ray.py
--ignore=test/document_stores/test_knowledge_graph.py
--ignore=test/nodes/test_audio.py
--ignore=test/nodes/test_summarizer_translation.py
--ignore=test/nodes/test_summarizer.py
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
PYTHON_VERSION: "3.8"
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Black
run: |
pip install --upgrade pip
pip install .[formatting]
- name: Check status
run: |
if ! black . --check; then
git status
echo "###################################################################################################"
echo "# "
echo "# CHECK FAILED! Black found issues with your code formatting."
echo "# "
echo "# Either:"
echo "# 1. Run Black locally before committing:"
echo "# "
echo "# pip install .[formatting]"
echo "# black ."
echo "# "
echo "# 2. Install the pre-commit hook:"
echo "# "
echo "# pre-commit install --hook-type pre-push"
echo "# "
echo "# 3. See https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help."
echo "# "
echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues"
echo "# "
echo "##################################################################################################"
exit 1
fi
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
unit-tests:
name: Unit / ${{ matrix.topic }} / ${{ matrix.os }}
needs: black
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
topic:
- document_stores
- nodes
- agents
- preview
- prompt
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[all]
- name: Run
run: pytest -m "unit" test/${{ matrix.topic }}
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-elasticsearch:
name: Integration / Elasticsearch / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
elasticsearch:
image: elasticsearch:7.17.6
env:
discovery.type: "single-node"
ES_JAVA_OPTS: "-Xms128m -Xmx256m"
ports:
- 9200:9200
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_elasticsearch.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-sql:
name: Integration / SQL / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,sql,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_sql.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-opensearch:
name: Integration / Opensearch / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
opensearch:
image: opensearchproject/opensearch:1.3.5
env:
discovery.type: "single-node"
ES_JAVA_OPTS: "-Xms128m -Xmx256m"
ports:
- 9200:9200
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,opensearch,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_opensearch.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-dc:
name: Integration / dC / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_deepsetcloud.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-faiss:
name: Integration / faiss / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[faiss,dev,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_faiss.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-weaviate:
name: Integration / Weaviate / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
weaviate:
image: semitechnologies/weaviate:1.17.2
env:
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true"
PERSISTENCE_DATA_PATH: "/var/lib/weaviate"
ENABLE_EXPERIMENTAL_BM25: "true"
DISK_USE_READONLY_PERCENTAGE: 95
ports:
- 8080:8080
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,weaviate,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_weaviate.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-pinecone:
name: Integration / pinecone / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,pinecone,preprocessing]
- name: Run tests
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_pinecone.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-memory:
name: Integration / memory / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "document_store and integration" test/document_stores/test_memory.py
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-promptnode:
name: Integration / PromptNode / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest,windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "integration" test/prompt
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-agents:
name: Integration / Agents / ${{ matrix.os }}
needs:
- unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[dev,preprocessing]
- name: Run tests
run: |
pytest --maxfail=5 -m "integration" test/agents
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
#
# IMPORTANT: the following steps need to be revisited PLEASE DO NOT ADD ANYTHING TO THE JOBS BELOW!
#
unit-tests-linux:
needs: black
strategy:
fail-fast: false # Avoid cancelling the others if one of these fails
matrix:
folder:
- "nodes"
- "pipelines"
- "modeling"
- "others"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
# TODO evaluate if tests that need these libraries are really unit tests
- name: Install audio libraries
run: |
sudo apt-get update
sudo apt-get install ffmpeg
- name: Install Haystack
run: pip install .[all]
- name: Run tests
env:
TOKENIZERS_PARALLELISM: 'false'
TESSDATA_PREFIX: '/usr/share/tesseract-ocr/4.00/tessdata'
# as confusing as it seems, we skip tests marked as unit here as it means they have been migrated to the right job already
run: |
pytest ${{ env.PYTEST_PARAMS }} -m "not elasticsearch and not faiss and not milvus and not weaviate and not pinecone and not integration and not unit" test/${{ matrix.folder }} --document_store_type=memory
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
unit-tests-windows:
needs: black
strategy:
fail-fast: false # Avoid cancelling the others if one of these fails
matrix:
folder:
- "nodes"
- "pipelines"
- "modeling"
runs-on: windows-latest
if: contains(github.event.pull_request.labels.*.name, 'topic:windows') || !github.event.pull_request.draft
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
# - name: Install sndfile (audio support) # https://github.com/libsndfile/libsndfile/releases/download/1.1.0/libsndfile-1.1.0-win64.zip
- name: Install Haystack
run: pip install .[all]
- name: Run tests
env:
TOKENIZERS_PARALLELISM: 'false'
TESSDATA_PREFIX: 'C:\Program Files\Tesseract-OCR\tessdata'
# as confusing as it seems, we skip tests marked as unit here as it means they have been migrated to the right job already
run: |
pytest ${{ env.PYTEST_PARAMS }} -m "not elasticsearch and not faiss and not milvus and not weaviate and not pinecone and not integration and not unit" ${{ env.SUITES_EXCLUDED_FROM_WINDOWS }} test/${{ matrix.folder }} --document_store_type=memory
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-linux:
needs:
- unit-tests-linux
timeout-minutes: 60
strategy:
fail-fast: false # Avoid cancelling the others if one of these fails
matrix:
folder:
- "nodes"
- "pipelines"
- "modeling"
- "others"
runs-on: ubuntu-latest-4-cores
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run Elasticsearch
run: |
docker run -d -p 9200:9200 -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms128m -Xmx256m" elasticsearch:7.9.2
- name: Run Opensearch
run: |
docker run -d -p 9201:9200 -p 9600:9600 -e "discovery.type=single-node" opensearchproject/opensearch:1.3.5
- name: Run Weaviate
run: docker run -d -p 8080:8080 --name haystack_test_weaviate --env AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED='true' --env PERSISTENCE_DATA_PATH='/var/lib/weaviate' --env ENABLE_EXPERIMENTAL_BM25='true' --env DISK_USE_READONLY_PERCENTAGE='95' semitechnologies/weaviate:1.17.2
- name: Run Apache Tika
run: docker run -d -p 9998:9998 -e "TIKA_CHILD_JAVA_OPTS=-JXms128m" -e "TIKA_CHILD_JAVA_OPTS=-JXmx128m" apache/tika:1.28.4
- name: Run Parsr
run: docker run -d -p 3001:3001 axarev/parsr:v1.2.2
- name: Install tesseract
run: |
sudo apt update
sudo apt-get install tesseract-ocr libtesseract-dev poppler-utils
- name: Install audio libraries
run: |
sudo apt-get update
sudo apt-get install libsndfile1 ffmpeg
- name: Install Haystack
run: pip install .[all]
- name: Cache HF models
id: cache-hf-models
uses: actions/cache@v3
with:
path: ~/.cache/huggingface/transformers/
key: hf-models
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
- name: Download models
if: steps.cache-hf-models.outputs.cache-hit != 'true'
run: |
python -c "from transformers import AutoModel;[AutoModel.from_pretrained(model_name) for model_name in ['vblagoje/bart_lfqa','yjernite/bart_eli5', 'vblagoje/dpr-ctx_encoder-single-lfqa-wiki', 'vblagoje/dpr-question_encoder-single-lfqa-wiki', 'facebook/dpr-question_encoder-single-nq-base', 'facebook/dpr-ctx_encoder-single-nq-base', 'elastic/distilbert-base-cased-finetuned-conll03-english', 'deepset/bert-medium-squad2-distilled']]"
- name: Run tests
env:
TOKENIZERS_PARALLELISM: 'false' # Avoid logspam by tokenizers
TESSDATA_PREFIX: '/usr/share/tesseract-ocr/4.00/tessdata'
# we add "and not document_store" to exclude the tests that were ported to the new strategy
run: |
pytest ${{ env.PYTEST_PARAMS }} -m "integration and not document_store" test/${{ matrix.folder }}
- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v1
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
integration-tests-windows:
needs:
- unit-tests-windows
runs-on: windows-latest
if: contains(github.event.pull_request.labels.*.name, 'topic:windows') || !github.event.pull_request.draft
timeout-minutes: 30
strategy:
fail-fast: false # Avoid cancelling the others if one of these fails
matrix:
folder:
- "nodes"
- "pipelines"
- "modeling"
- "others"
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
choco install --no-progress tesseract
choco install --no-progress openjdk --version=11.0.2.01
refreshenv
choco install --no-progress elasticsearch --version=7.9.2
refreshenv
Get-Service elasticsearch-service-x64 | Start-Service
- name: Add Tesseract to system PATH
shell: pwsh
run: |
echo "C:\Program Files\Tesseract-OCR\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Haystack
run: pip install .[all]
- name: Run tests
env:
TOKENIZERS_PARALLELISM: 'false' # Avoid logspam by tokenizers
TESSDATA_PREFIX: 'C:\Program Files\Tesseract-OCR\tessdata'
# FIXME many tests are disabled here!
run: |
pytest ${{ env.PYTEST_PARAMS }} -m "integration and not tika and not graphdb" ${{ env.SUITES_EXCLUDED_FROM_WINDOWS }} test/${{ matrix.folder }} --document_store_type=memory,faiss,elasticsearch
- uses: slackapi/slack-github-action@v1.23.0
if: failure() && github.ref == 'refs/heads/main'
with:
payload: |
{
"blocks": [
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4",
"alt_text": "Actor"
},
{
"type": "mrkdwn",
"text": "*<https://github.com/${{ github.actor }}|${{ github.actor }}>*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job ${{ github.job }} in workflow <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/workflow/|${{ github.workflow }}>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by ${{ github.event_name }} for ${{ github.ref_type }} `${{ github.ref_name }}`"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/favicons/favicon.png",
"alt_text": "Github logo"
},
{
"type": "mrkdwn",
"text": "<https://github.com/${{ github.repository }}/|${{ github.repository }}> Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/|#${{ github.run_number }} | Attempt #${{ github.run_attempt }}>"
}
]
}
]
}
catch-all:
name: Catch-all check
runs-on: ubuntu-latest
# This job will be executed only after all the other tests
# are successful.
# This way we'll be able to mark only this test as required
# and skip it accordingly.
needs:
- integration-tests-elasticsearch
- integration-tests-sql
- integration-tests-opensearch
- integration-tests-dc
- integration-tests-faiss
- integration-tests-weaviate
- integration-tests-pinecone
- integration-tests-memory
- integration-tests-linux
- integration-tests-windows
steps:
- name: Finisher
run: echo "Finish him!"