Skip to content

Integration Tests #1853

Integration Tests

Integration Tests #1853

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Integration Tests
env:
ENVIRONMENT: INTEGRATION
on:
# weekday mealtimes
schedule:
- cron: '0 6,12,18 * * 1-5'
# or on-demand
workflow_dispatch:
# or on push to main
push:
branches:
- 'main'
permissions:
id-token: write
contents: read
jobs:
backend-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.COMMIT_HASH }}
path: integration
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Set up Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.7.0
- name: Build Containers
run: |
cd integration
mkdir -p data/elastic/
chmod -R 777 data/
cp tests/.env.integration .env
echo AZURE_OPENAI_ENDPOINT=${{ secrets.AZURE_OPENAI_ENDPOINT }} >> .env
echo AZURE_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }} >> .env
echo EMBEDDING_AZURE_OPENAI_ENDPOINT=${{ secrets.AZURE_OPENAI_ENDPOINT }} >> .env
echo EMBEDDING_OPENAI_API_KEY=${{ secrets.AZURE_OPENAI_API_KEY }} >> .env
docker compose up -d --wait elasticsearch minio db
docker compose up -d --wait django-app worker
docker ps
- name: Test integration with pytest
run: |
cd integration
poetry install --only dev
poetry run playwright install --with-deps chromium
poetry run pytest tests/ --browser chromium
- name: notify slack failure
id: slack-failure
uses: slackapi/slack-github-action@v1.24.0
if: ${{ failure() && github.event_name == 'schedule' }}
with:
payload: |
{
"text": "Scheduled Integration Tests Failed",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Scheduled integration tests are failing :alert:"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "logs"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: notify slack pass
id: slack-pass
uses: slackapi/slack-github-action@v1.24.0
if: ${{ success() && github.event_name == 'schedule' }}
with:
payload: |
{
"text": "Scheduled Integration Tests Passed",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Scheduled integration tests are passing :white_check_mark:"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Dump logs
if: failure()
uses: jwalton/gh-docker-logs@v2